Skip to content
Merged
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/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 4 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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');"
vendor: composer.json
composer install
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
29 changes: 5 additions & 24 deletions src/CascadeContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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
{
Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -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
{
Expand All @@ -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
{
Expand All @@ -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
*/
Expand All @@ -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
{
Expand Down Expand Up @@ -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<T> $className
* @param array<string,mixed> $bindings
* @return object
* @return T
*
* @throws ClassCannotBeInstantiated
* @throws CannotAutowireDependencyArgument
Expand Down
15 changes: 0 additions & 15 deletions tests/Pest.php

This file was deleted.

10 changes: 0 additions & 10 deletions tests/TestCase.php

This file was deleted.