Skip to content

Commit

Permalink
Update container to use PSR 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dantleech committed Jul 27, 2024
1 parent 8a9665e commit 6bd2ff8
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 15 deletions.
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
}
],
"require": {
"php": "^8.0",
"php": "^8.1",
"phpactor/map-resolver": "^1.4",
"psr/container": "^1.0"
"psr/container": "^2.0"
},
"require-dev": {
"ergebnis/composer-normalize": "^2.0",
"friendsofphp/php-cs-fixer": "^3.0",
"phpstan/phpstan": "^1.0",
"phpunit/phpunit": "^9.0",
"phpunit/phpunit": "^11.0",
"phpspec/prophecy-phpunit": "^2.0"
},
"extra": {
Expand Down
2 changes: 1 addition & 1 deletion lib/PhpactorContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function get($id)
}


public function has($id)
public function has($id): bool
{
return array_key_exists($id, $this->factories);
}
Expand Down
18 changes: 9 additions & 9 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- http://www.phpunit.de/manual/current/en/appendixes.configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" colors="true" bootstrap="vendor/autoload.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage includeUncoveredFiles="true">
<include>
<directory>.</directory>
</include>
<exclude>
<directory>vendor/</directory>
</exclude>
</coverage>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" colors="true" bootstrap="vendor/autoload.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.2/phpunit.xsd">
<testsuites>
<testsuite name="PhpActor Test Suite">
<directory>./tests</directory>
Expand All @@ -17,4 +9,12 @@
<php>
<env name="PHPACTOR_ALLOW_XDEBUG" value="1"/>
</php>
<source>
<include>
<directory>.</directory>
</include>
<exclude>
<directory>vendor/</directory>
</exclude>
</source>
</phpunit>
20 changes: 20 additions & 0 deletions phpunit.xml.dist.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- http://www.phpunit.de/manual/current/en/appendixes.configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" colors="true" bootstrap="vendor/autoload.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage includeUncoveredFiles="true">
<include>
<directory>.</directory>
</include>
<exclude>
<directory>vendor/</directory>
</exclude>
</coverage>
<testsuites>
<testsuite name="PhpActor Test Suite">
<directory>./tests</directory>
</testsuite>
</testsuites>
<php>
<env name="PHPACTOR_ALLOW_XDEBUG" value="1"/>
</php>
</phpunit>
5 changes: 3 additions & 2 deletions tests/Unit/ParameterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Closure;
use Generator;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Phpactor\Container\Parameter;
use RuntimeException;
Expand All @@ -21,9 +22,9 @@ public function testCast(): void
}

/**
* @dataProvider provideCastException
* @param Closure(Parameter): mixed $invoker
*/
#[DataProvider('provideCastException')]
public function testCastException(mixed $value, Closure $invoker, string $message): void
{
$this->expectException(RuntimeException::class);
Expand All @@ -35,7 +36,7 @@ public function testCastException(mixed $value, Closure $invoker, string $messag
/**
* @return Generator<string,array{mixed,Closure(Parameter): mixed,string}>
*/
public function provideCastException(): Generator
public static function provideCastException(): Generator
{
yield 'not an int' => [
'12',
Expand Down

0 comments on commit 6bd2ff8

Please sign in to comment.