diff --git a/examples/reqwest/.gitignore b/examples/reqwest/.gitignore new file mode 100644 index 0000000..3d0b430 --- /dev/null +++ b/examples/reqwest/.gitignore @@ -0,0 +1 @@ +.php_cs.cache diff --git a/examples/reqwest/.php-cs-fixer.dist.php b/examples/reqwest/.php-cs-fixer.dist.php new file mode 100644 index 0000000..c75730e --- /dev/null +++ b/examples/reqwest/.php-cs-fixer.dist.php @@ -0,0 +1,23 @@ + true, + 'array_indentation' => true, + 'ternary_to_null_coalescing' => true, + 'assign_null_coalescing_to_coalesce_equal' => true, + ]); + } +}; + +$config->getFinder() + ->in(__DIR__ . '/lib') + ->append([__DIR__ . '/test.php']); + +$cacheDir = getenv('TRAVIS') ? getenv('HOME') . '/.php-cs-fixer' : __DIR__; + +$config->setCacheFile($cacheDir . '/.php_cs.cache'); + +return $config; diff --git a/examples/reqwest/composer.json b/examples/reqwest/composer.json index 1e4fcba..01bfb7a 100644 --- a/examples/reqwest/composer.json +++ b/examples/reqwest/composer.json @@ -3,9 +3,15 @@ "revolt/event-loop": "^1.0", "amphp/amp": "^3.0" }, + "require-dev": { + "amphp/php-cs-fixer-config": "v2.x-dev" + }, "autoload": { "psr-4": { "Reqwest\\": "lib" } + }, + "scripts": { + "cs-fix": "PHP_CS_FIXER_IGNORE_ENV=1 php -d pcre.jit=0 vendor/bin/php-cs-fixer fix -v --diff" } } diff --git a/examples/reqwest/lib/Client.php b/examples/reqwest/lib/Client.php index 41f90c2..7bb429e 100644 --- a/examples/reqwest/lib/Client.php +++ b/examples/reqwest/lib/Client.php @@ -1,4 +1,4 @@ - \Client::wakeup()); + $f = \fopen("php://fd/".\Client::init(), 'r+'); + \stream_set_blocking($f, false); + self::$id = EventLoop::onReadable($f, fn () => \Client::wakeup()); } public static function reference(): void diff --git a/examples/reqwest/test.php b/examples/reqwest/test.php index 8710379..6e840f1 100644 --- a/examples/reqwest/test.php +++ b/examples/reqwest/test.php @@ -1,4 +1,4 @@ -