diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 90608f0..8ebe78e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,7 +6,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php: [ '8.0', '8.1', '8.2', '8.3', '8.4' ] + php: [ '8.2', '8.3', '8.4', '8.5' ] steps: - uses: actions/checkout@master diff --git a/Makefile b/Makefile index a49f09d..e1cead7 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,7 @@ -.PHONY: test +.PHONY: tests -test: vendor +tests: vendor php vendor/bin/pest -vendor: composer.json composer.phar - php composer.phar install - -composer.phar: - php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" - php -r "if (hash_file('sha384', 'composer-setup.php') === 'dac665fdc30fdd8ec78b38b9800061b4150413ff2e3b6f88543c636f7cd84f6db9189d43a81e5503cda447da73c7e5b6') { echo 'Installer verified'.PHP_EOL; } else { echo 'Installer corrupt'.PHP_EOL; unlink('composer-setup.php'); exit(1); }" - php composer-setup.php - php -r "unlink('composer-setup.php');" \ No newline at end of file +vendor: composer.json + composer install diff --git a/README.md b/README.md index d7266e3..376110e 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ - [PSR Container][psr-11] compatibility - [Semantic Versioning](http://semver.org/) -- PHP 8.0+ +- PHP 8.2+ - Minimal yet elegant API ### Features diff --git a/composer.json b/composer.json index 0304f79..0ad4f81 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ "technically/array-container": "^2.0" }, "require-dev": { - "pestphp/pest": "^1.0|^2.0|^3.0" + "pestphp/pest": "^2.0|^3.0|^4.0" }, "license": "MIT", "autoload": { diff --git a/src/CascadeContainer.php b/src/CascadeContainer.php index b7e72e2..6b1ee61 100644 --- a/src/CascadeContainer.php +++ b/src/CascadeContainer.php @@ -35,8 +35,8 @@ final class CascadeContainer implements ContainerInterface * @param DependencyResolverInterface|null $resolver */ public function __construct( - ContainerInterface | array | null $parent = null, - DependencyResolverInterface $resolver = null, + ContainerInterface | array | null $parent = null, + DependencyResolverInterface | null $resolver = null, ) { if (is_array($parent)) { foreach ($parent as $id => $instance) { @@ -54,8 +54,6 @@ public function __construct( /** * Create a new nested isolated layer of the CascadeContainer. * Anything defined in the nested layer will not affect the parent container. - * - * @return CascadeContainer */ public function cascade(): self { @@ -105,10 +103,6 @@ public function has(string $id): bool /** * Bind the given instance as a service to the service container. - * - * @param string $id - * @param mixed $instance - * @return void */ public function set(string $id, mixed $instance): void { @@ -136,10 +130,6 @@ public function alias(string $id, string $alias): void * use `->deferred()`. * * @see deferred() - * - * @param string $id - * @param callable $constructor - * @return void */ public function factory(string $id, callable $constructor): void { @@ -153,10 +143,6 @@ public function factory(string $id, callable $constructor): void * * Unlike factories, the deferred resolver will be invoked only once -- for the very first time, * and then its result will be remembered as a regular service instance defined in the container. - * - * @param string $id - * @param callable $resolver - * @return void */ public function deferred(string $id, callable $resolver): void { @@ -171,8 +157,6 @@ public function deferred(string $id, callable $resolver): void * It can be either found in the container or constructed on the fly, * recursively auto-resolving the required parameters. * - * @param string $id - * @return mixed * @throws \Psr\Container\ContainerExceptionInterface * @throws \Psr\Container\NotFoundExceptionInterface */ @@ -191,10 +175,6 @@ public function resolve(string $id): mixed * - Whatever the callback function returns will replace the previous instance. * - If the service being extended is defined via a deferred resolver, the extension will become a deferred resolver too. * - If the service being extended is defined as a factory, the extension will become a factory too. - * - * @param string $id - * @param callable $extension - * @return void */ public function extend(string $id, callable $extension): void { @@ -240,9 +220,10 @@ public function extend(string $id, callable $extension): void * Even if the container already has the instance bound, * it will still be instantiated. * - * @param class-string $className + * @template T + * @param class-string $className * @param array $bindings - * @return object + * @return T * * @throws ClassCannotBeInstantiated * @throws CannotAutowireDependencyArgument diff --git a/tests/Pest.php b/tests/Pest.php deleted file mode 100644 index a1d52b9..0000000 --- a/tests/Pest.php +++ /dev/null @@ -1,15 +0,0 @@ -extend(\Tests\TestCase::class)->in('Feature'); - diff --git a/tests/TestCase.php b/tests/TestCase.php deleted file mode 100644 index cfb05b6..0000000 --- a/tests/TestCase.php +++ /dev/null @@ -1,10 +0,0 @@ -