Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: bump amp to v3 #52

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

strategy:
matrix:
php: [ '7.3', '7.4', '8.0' ]
php: [ '8.1' ]

steps:
- name: 'Init repository'
Expand Down
14 changes: 13 additions & 1 deletion .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,19 @@
]
);

$config = new M6Web\CS\Config\BedrockStreaming();
$baseConfig = new M6Web\CS\Config\BedrockStreaming();

$config = new PhpCsFixer\Config('Bedrock Streaming');
$config->setFinder($finder);

$override_rules = array_merge(
$baseConfig->getRules(),
[
// Adding strict_types should be part of another PR
'declare_strict_types' => false,
]
);

$config->setRules($override_rules);

return $config;
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@
}
},
"require": {
"php": "^7.3|^8.0",
"php": "^8.1",
"psr/http-message": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "^9.4.4",
"amphp/amp": "^2.0",
"amphp/amp": "^3.0",
"guzzlehttp/guzzle": "^6.3",
"m6web/php-cs-fixer-config": "^2.0",
"ext-curl": "^7.3|^8.0",
"ext-curl": "^8.0",
"react/event-loop": "^1.0",
"react/promise": "^2.7",
"phpstan/phpstan": "^0.12",
"phpstan/phpstan": "^1.10",
"symfony/http-client": "^4.3",
"psr/http-factory": "^1.0",
"http-interop/http-factory-guzzle": "^1.0"
Expand Down
6 changes: 3 additions & 3 deletions examples/00-README-samples.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ function waitException(Tornado\EventLoop $eventLoop)

// Choose your adapter.
$eventLoop = new Tornado\Adapter\Tornado\EventLoop();
//$eventLoop = new Tornado\Adapter\Tornado\SynchronousEventLoop();
//$eventLoop = new Tornado\Adapter\Amp\EventLoop();
//$eventLoop = new Tornado\Adapter\ReactPhp\EventLoop(new \React\EventLoop\StreamSelectLoop());
// $eventLoop = new Tornado\Adapter\Tornado\SynchronousEventLoop();
// $eventLoop = new Tornado\Adapter\Amp\EventLoop();
// $eventLoop = new Tornado\Adapter\ReactPhp\EventLoop(new \React\EventLoop\StreamSelectLoop());

// Tornado provides only one HttpClient implementation, using Guzzle
$httpClient = new Tornado\Adapter\Guzzle\HttpClient($eventLoop, new Tornado\Adapter\Guzzle\CurlMultiClientWrapper());
Expand Down
6 changes: 3 additions & 3 deletions examples/01-async-countdown.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ function asynchronousCountdown(EventLoop $eventLoop, string $name, int $count):

// Choose your adapter.
$eventLoop = new Adapter\Tornado\EventLoop();
//$eventLoop = new Adapter\Tornado\SynchronousEventLoop();
//$eventLoop = new Adapter\Amp\EventLoop();
//$eventLoop = new Adapter\ReactPhp\EventLoop(new \React\EventLoop\StreamSelectLoop());
// $eventLoop = new Adapter\Tornado\SynchronousEventLoop();
// $eventLoop = new Adapter\Amp\EventLoop();
// $eventLoop = new Adapter\ReactPhp\EventLoop(new \React\EventLoop\StreamSelectLoop());

echo "Let's start!\n";

Expand Down
6 changes: 3 additions & 3 deletions examples/02-failures.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ function throwingGenerator(): \Generator

// Choose your adapter.
$eventLoop = new Adapter\Tornado\EventLoop();
//$eventLoop = new Adapter\Tornado\SynchronousEventLoop();
//$eventLoop = new Adapter\Amp\EventLoop();
//$eventLoop = new Adapter\ReactPhp\EventLoop(new \React\EventLoop\StreamSelectLoop());
// $eventLoop = new Adapter\Tornado\SynchronousEventLoop();
// $eventLoop = new Adapter\Amp\EventLoop();
// $eventLoop = new Adapter\ReactPhp\EventLoop(new \React\EventLoop\StreamSelectLoop());

echo "Let's start!\n";

Expand Down
12 changes: 6 additions & 6 deletions examples/03-http-client.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ function monitorRequest(EventLoop $eventLoop, HttpClient $httpClient, string $ur

// Choose your adapter.
$eventLoop = new Adapter\Tornado\EventLoop();
//$eventLoop = new Adapter\Tornado\SynchronousEventLoop();
//$eventLoop = new Adapter\Amp\EventLoop();
//$eventLoop = new Adapter\ReactPhp\EventLoop(new \React\EventLoop\StreamSelectLoop());
// $eventLoop = new Adapter\Tornado\SynchronousEventLoop();
// $eventLoop = new Adapter\Amp\EventLoop();
// $eventLoop = new Adapter\ReactPhp\EventLoop(new \React\EventLoop\StreamSelectLoop());

// Choose your adapter
$httpClient = new Adapter\Symfony\HttpClient(new \Symfony\Component\HttpClient\CurlHttpClient(), $eventLoop, new \Http\Factory\Guzzle\ResponseFactory(), new \Http\Factory\Guzzle\StreamFactory());
//$httpClient = new Adapter\Guzzle\HttpClient($eventLoop, new Adapter\Guzzle\CurlMultiClientWrapper());
// $httpClient = new Adapter\Guzzle\HttpClient($eventLoop, new Adapter\Guzzle\CurlMultiClientWrapper());

// Let's call several endpoints… concurrently!
echo "Let's start!\n";
Expand All @@ -41,8 +41,8 @@ function monitorRequest(EventLoop $eventLoop, HttpClient $httpClient, string $ur
// Check https://http2.akamai.com/demo for the full HTTP2 demonstration.
for ($i = 0; $i < 10; $i++) {
$promises[] = $eventLoop->async(monitorRequest(
$eventLoop,
$httpClient,
$eventLoop,
$httpClient,
"https://http2.akamai.com/demo/tile-$i.png"
));
}
Expand Down
6 changes: 3 additions & 3 deletions examples/04-foreach.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ function compareMethods(EventLoop $eventLoop)

// Choose your adapter.
$eventLoop = new Adapter\Tornado\EventLoop();
//$eventLoop = new Adapter\Tornado\SynchronousEventLoop();
//$eventLoop = new Adapter\Amp\EventLoop();
//$eventLoop = new Adapter\ReactPhp\EventLoop(new \React\EventLoop\StreamSelectLoop());
// $eventLoop = new Adapter\Tornado\SynchronousEventLoop();
// $eventLoop = new Adapter\Amp\EventLoop();
// $eventLoop = new Adapter\ReactPhp\EventLoop(new \React\EventLoop\StreamSelectLoop());

echo "Let's start!\n";
// Run the event loop until our goal promise is reached.
Expand Down
Loading
Loading