Skip to content

Commit 395d194

Browse files
committed
php83
1 parent 1758fe3 commit 395d194

15 files changed

+49
-73
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,36 +6,36 @@ on:
66
- cron: "0 0 * * *"
77

88
jobs:
9-
php82:
10-
name: PHP 8.2
9+
php83:
10+
name: PHP 8.3
1111
runs-on: ubuntu-24.04
1212
steps:
1313
- name: checkout
1414
uses: actions/checkout@v4
1515
- name: composer test
16-
uses: docker://ghcr.io/chubbyphp/ci-php82:latest
16+
uses: docker://ghcr.io/chubbyphp/ci-php83:latest
1717
env:
1818
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1919
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}
20-
php83:
21-
name: PHP 8.3
20+
php84:
21+
name: PHP 8.4
2222
runs-on: ubuntu-24.04
2323
steps:
2424
- name: checkout
2525
uses: actions/checkout@v4
2626
- name: composer test
27-
uses: docker://ghcr.io/chubbyphp/ci-php83:latest
27+
uses: docker://ghcr.io/chubbyphp/ci-php84:latest
2828
env:
2929
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3030
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}
31-
php84:
32-
name: PHP 8.4
31+
php85:
32+
name: PHP 8.5
3333
runs-on: ubuntu-24.04
3434
steps:
3535
- name: checkout
3636
uses: actions/checkout@v4
3737
- name: composer test
38-
uses: docker://ghcr.io/chubbyphp/ci-php84:latest
38+
uses: docker://ghcr.io/chubbyphp/ci-php85:latest
3939
env:
4040
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4141
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}

.php-cs-fixer.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,8 @@
1212
/** @var array $config */
1313
$config = require __DIR__ . '/vendor/chubbyphp/chubbyphp-dev-helper/phpcs.php';
1414

15-
// drop onces code is >= 8.0
16-
unset($config['rules']['phpdoc_to_return_type']);
17-
1815
return (new PhpCsFixer\Config)
16+
->setUnsupportedPhpVersionAllowed(true)
1917
->setIndent($config['indent'])
2018
->setLineEnding($config['lineEnding'])
2119
->setRules($config['rules'])

composer.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@
1414
}
1515
],
1616
"require": {
17-
"php": "^8.2",
17+
"php": "^8.3",
1818
"psr/container": "^2.0.2"
1919
},
2020
"require-dev": {
2121
"chubbyphp/chubbyphp-dev-helper": "dev-master",
22-
"chubbyphp/chubbyphp-mock": "^2.0",
23-
"infection/infection": "^0.29.13",
24-
"php-coveralls/php-coveralls": "^2.7.0",
22+
"chubbyphp/chubbyphp-mock": "^2.0.1",
23+
"infection/infection": "^0.31.9",
24+
"php-coveralls/php-coveralls": "^2.9",
2525
"phpstan/extension-installer": "^1.4.3",
26-
"phpstan/phpstan": "^2.1.6",
27-
"phpunit/phpunit": "^11.5.10"
26+
"phpstan/phpstan": "^2.1.32",
27+
"phpunit/phpunit": "^12.4.5"
2828
},
2929
"autoload": {
3030
"psr-4": { "Chubbyphp\\Container\\": "src/" }
@@ -45,7 +45,7 @@
4545
}
4646
},
4747
"scripts": {
48-
"fix:cs": "mkdir -p build && PHP_CS_FIXER_IGNORE_ENV=1 vendor/bin/php-cs-fixer fix --cache-file=build/phpcs.cache",
48+
"fix:cs": "mkdir -p build && vendor/bin/php-cs-fixer fix --cache-file=build/phpcs.cache",
4949
"test": [
5050
"@test:lint",
5151
"@test:unit",
@@ -54,7 +54,7 @@
5454
"@test:static-analysis",
5555
"@test:cs"
5656
],
57-
"test:cs": "mkdir -p build && PHP_CS_FIXER_IGNORE_ENV=1 vendor/bin/php-cs-fixer fix --dry-run --stop-on-violation --cache-file=build/phpcs.cache",
57+
"test:cs": "mkdir -p build && vendor/bin/php-cs-fixer fix --dry-run --stop-on-violation --cache-file=build/phpcs.cache",
5858
"test:infection": "vendor/bin/infection --threads=$(nproc) --min-msi=100 --verbose --coverage=build/phpunit",
5959
"test:integration": "vendor/bin/phpunit --testsuite=Integration --cache-directory=build/phpunit",
6060
"test:lint": "mkdir -p build && find src tests -name '*.php' -print0 | xargs -0 -n1 -P$(nproc) php -l | tee build/phplint.log",

src/Container.php

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,7 @@ public function prototypeFactory(string $id, callable $factory): ContainerInterf
8989
return $this;
9090
}
9191

92-
/**
93-
* @return mixed
94-
*/
95-
public function get(string $id)
92+
public function get(string $id): mixed
9693
{
9794
if (isset($this->prototypeFactories[$id])) {
9895
return $this->createFromPrototypeFactory($id);
@@ -106,10 +103,7 @@ public function has(string $id): bool
106103
return isset($this->factories[$id]) || isset($this->prototypeFactories[$id]);
107104
}
108105

109-
/**
110-
* @return mixed
111-
*/
112-
private function createFromFactory(string $id)
106+
private function createFromFactory(string $id): mixed
113107
{
114108
if (!isset($this->factories[$id])) {
115109
throw NotFoundException::create($id);
@@ -122,10 +116,7 @@ private function createFromFactory(string $id)
122116
}
123117
}
124118

125-
/**
126-
* @return mixed
127-
*/
128-
private function createFromPrototypeFactory(string $id)
119+
private function createFromPrototypeFactory(string $id): mixed
129120
{
130121
try {
131122
return ($this->prototypeFactories[$id])($this);

src/Exceptions/ExistsException.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88

99
final class ExistsException extends \LogicException implements ContainerExceptionInterface
1010
{
11-
public const TYPE_FACTORY = 'factory';
12-
public const TYPE_PROTOTYPE_FACTORY = 'prototype factory';
11+
public const string TYPE_FACTORY = 'factory';
12+
13+
public const string TYPE_PROTOTYPE_FACTORY = 'prototype factory';
1314

1415
private function __construct(string $message, int $code, ?\Throwable $previous = null)
1516
{

src/Factory.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,7 @@ public function __construct(callable $previousFactory, callable $factory)
2424
$this->factory = $factory;
2525
}
2626

27-
/**
28-
* @return mixed
29-
*/
30-
public function __invoke(ContainerInterface $container)
27+
public function __invoke(ContainerInterface $container): mixed
3128
{
3229
return ($this->factory)($container, $this->previousFactory);
3330
}

src/MinimalContainer.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,7 @@ public function factory(string $id, callable $factory): ContainerInterface
5252
return $this;
5353
}
5454

55-
/**
56-
* @return mixed
57-
*/
58-
public function get(string $id)
55+
public function get(string $id): mixed
5956
{
6057
return $this->services[$id] ?? $this->services[$id] = $this->createFromFactory($id);
6158
}
@@ -65,10 +62,7 @@ public function has(string $id): bool
6562
return isset($this->factories[$id]);
6663
}
6764

68-
/**
69-
* @return mixed
70-
*/
71-
private function createFromFactory(string $id)
65+
private function createFromFactory(string $id): mixed
7266
{
7367
if (!isset($this->factories[$id])) {
7468
throw NotFoundException::create($id);

src/Parameter.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@ final class Parameter
1111
*/
1212
public function __construct(private $parameter) {}
1313

14-
/**
15-
* @return mixed
16-
*/
17-
public function __invoke()
14+
public function __invoke(): mixed
1815
{
1916
return $this->parameter;
2017
}

tests/Unit/ContainerTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
use Chubbyphp\Container\Exceptions\ContainerException;
99
use Chubbyphp\Container\Exceptions\ExistsException;
1010
use Chubbyphp\Container\Exceptions\NotFoundException;
11+
use PHPUnit\Framework\Attributes\CoversClass;
1112
use PHPUnit\Framework\TestCase;
1213
use Psr\Container\ContainerInterface;
1314

1415
/**
15-
* @covers \Chubbyphp\Container\Container
16-
*
1716
* @internal
1817
*/
18+
#[CoversClass(Container::class)]
1919
final class ContainerTest extends TestCase
2020
{
2121
/**
@@ -120,7 +120,7 @@ public function testFactoryReplace(): void
120120
{
121121
$container = new Container();
122122

123-
$container->factory('id', static function (): void {
123+
$container->factory('id', static function (): never {
124124
throw new \Exception('should not be called!');
125125
});
126126

@@ -249,7 +249,7 @@ public function testPrototypeFactoryReplace(): void
249249
{
250250
$container = new Container();
251251

252-
$container->prototypeFactory('id', static function (): void {
252+
$container->prototypeFactory('id', static function (): never {
253253
throw new \Exception('should not be called!');
254254
});
255255

tests/Unit/Exceptions/ContainerExceptionTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
namespace Chubbyphp\Tests\Container\Unit\Exceptions;
66

77
use Chubbyphp\Container\Exceptions\ContainerException;
8+
use PHPUnit\Framework\Attributes\CoversClass;
89
use PHPUnit\Framework\TestCase;
910

1011
/**
11-
* @covers \Chubbyphp\Container\Exceptions\ContainerException
12-
*
1312
* @internal
1413
*/
14+
#[CoversClass(ContainerException::class)]
1515
final class ContainerExceptionTest extends TestCase
1616
{
1717
public function testConstruct(): void

0 commit comments

Comments
 (0)