Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CI to support PHP 8.4 and include PHP 8.3 in old_stable #293

Merged
merged 6 commits into from
Nov 29, 2024
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
4 changes: 2 additions & 2 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ jobs:
ci:
uses: ray-di/.github/.github/workflows/continuous-integration.yml@v1
with:
old_stable: '["7.2", "7.3", "7.4", "8.0", "8.1", "8.2"]'
current_stable: 8.3
old_stable: '["7.2", "7.3", "7.4", "8.0", "8.1", "8.2", "8.3"]'
current_stable: 8.4
koriym marked this conversation as resolved.
Show resolved Hide resolved
script: demo/run.php
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
"koriym/attributes": "^1.0.4",
"koriym/null-object": "^1.0",
"koriym/param-reader": "^1.0",
"ray/aop": "^2.14",
"ray/aop": "^2.16",
"ray/compiler": "^1.10.3"
},
"require-dev": {
"ext-pdo": "*",
"phpunit/phpunit": "^8.5.24 || ^9.5",
"phpunit/phpunit": "^8.5.40 || ^9.5",
"bamarni/composer-bin-plugin": "^1.4"
},
"config": {
Expand Down
2 changes: 1 addition & 1 deletion src/di/Argument.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function getMeta(): string
/**
* {@inheritDoc}
*/
public function serialize(): ?string
public function serialize(): ?string // @phpstan-ignore-line
{
return serialize($this->__serialize());
}
Expand Down
2 changes: 1 addition & 1 deletion src/di/Bind.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ private function getStringName(array $name): string
* @param array-key $key
*/
static function (array $carry, $key) use ($name): array {
if (! is_string($key)) {
if (! is_string($key)) { // @phpstan-ignore-line
throw new InvalidToConstructorNameParameter((string) $key);
}

Expand Down
2 changes: 1 addition & 1 deletion src/di/Di/Inject.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ final class Inject implements InjectInterface
public $optional = false;

/**
* @SuppressWarnings(PHPMD.BooleanArgumentFlag)
* @SuppressWarnings(PHPMD.BooleanArgumentFlag) // @phpstan-ignore-line
*/
public function __construct(bool $optional = false)
{
Expand Down
2 changes: 1 addition & 1 deletion src/di/InjectionPoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public function __unserialize(array $array): void
[$this->pClass, $this->pFunction, $this->pName] = $array;
}

public function serialize(): ?string
public function serialize(): ?string // @phpstan-ignore-line
{
return serialize($this->__serialize());
}
Expand Down
3 changes: 0 additions & 3 deletions src/di/MultiBinding/LazyProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
use Ray\Di\InjectorInterface;
use Ray\Di\ProviderInterface;

use function assert;

/**
* @template T of ProviderInterface
*/
Expand All @@ -31,7 +29,6 @@ public function __construct(string $class)
public function __invoke(InjectorInterface $injector)
{
$provider = $injector->getInstance($this->class);
assert($provider instanceof ProviderInterface);

return $provider->get();
}
Expand Down
3 changes: 2 additions & 1 deletion src/di/Name.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,12 @@ private function parseName(string $name): array
$exploded = explode('=', $keyValue);
if (isset($exploded[1])) {
[$key, $value] = $exploded;
assert(is_string($key));
if (isset($key[0]) && $key[0] === '$') {
assert(is_string($key)); // @phpstan-ignore-line
$key = substr($key, 1);
}

/** @psalm-suppress MixedArgument */
$names[trim($key)] = trim($value);
}
}
Expand Down
3 changes: 0 additions & 3 deletions tests/di/ArgumentsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
use ReflectionMethod;
use ReflectionParameter;

use function assert;
use function is_object;
use function spl_object_hash;

class ArgumentsTest extends TestCase
Expand All @@ -29,7 +27,6 @@ public function testInject(): void
$this->assertInstanceOf(FakeTyre::class, $parameters[0]);
$this->assertInstanceOf(FakeTyre::class, $parameters[1]);
$param0 = $parameters[0];
assert(is_object($param0));
$this->assertNotSame(spl_object_hash($param0), $parameters[1]);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/di/DependencyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public function testInjectInterceptor(): void
$isWeave = (new ReflectionClass($instance))->implementsInterface(WeavedInterface::class);
$this->assertTrue($isWeave);
assert(property_exists($instance, 'bindings'));
$this->assertArrayHasKey('returnSame', $instance->bindings);
$this->assertArrayHasKey('returnSame', (array) $instance->bindings);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/di/Fake/FakePhp8Car.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function setQualiferMirrors(#[FakeRight] FakeMirrorInterface $rightMirror
}

#[Inject]
public function notQualifer(#[FakeNotQualifer] FakeMirrorInterface $rightMirror = null): void
public function notQualifer(#[FakeNotQualifer] ?FakeMirrorInterface $rightMirror = null): void
{
}

Expand Down
4 changes: 0 additions & 4 deletions tests/di/GrapherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@

use function assert;
use function file_get_contents;
use function is_object;
use function is_string;
use function passthru;
use function property_exists;
use function unserialize;

class GrapherTest extends TestCase
Expand All @@ -28,8 +26,6 @@ public function testGetInstanceWithArgs(): void
$grapher = new Grapher(new FakeUntargetModule(), __DIR__ . '/tmp');
$instance = $grapher->newInstanceArgs(FakeUntargetChild::class, ['1']);
$this->assertInstanceOf(FakeUntargetChild::class, $instance);
assert(is_object($instance));
assert(property_exists($instance, 'val'));
$this->assertSame('1', $instance->val);
}

Expand Down
7 changes: 1 addition & 6 deletions tests/di/InjectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
use function file_get_contents;
use function is_string;
use function passthru;
use function property_exists;
use function serialize;
use function spl_object_hash;
use function unlink;
Expand Down Expand Up @@ -184,7 +183,6 @@ public function testAnnotationBasedInjection(): Injector
$this->assertInstanceOf(FakeMirrorInterface::class, $car->spareMirror);
$this->assertSame(spl_object_hash($car->rightMirror), spl_object_hash($car->spareMirror));
$this->assertInstanceOf(FakeHandle::class, $car->handle);
assert($car->handle instanceof FakeHandle);
$this->assertSame($car->handle->logo, 'momo');

return $injector;
Expand Down Expand Up @@ -242,7 +240,6 @@ public function testSerializeBuiltinBinding(): void
$injector = unserialize(serialize(new Injector()));
assert($injector instanceof InjectorInterface);
$instance = $injector->getInstance(FakeBuiltin::class);
assert(property_exists($instance, 'injector'));
$this->assertInstanceOf(Injector::class, $instance->injector);
}

Expand Down Expand Up @@ -430,9 +427,7 @@ protected function configure()
$instance = $injector->getInstance(FakeAop::class);
$result = $instance->returnSame(2);
$this->assertSame(2, $result);
assert(property_exists($instance, 'bindings'));
assert(isset($instance->bindings['returnSame'][0]));
$this->assertInstanceOf(NullInterceptor::class, $instance->bindings['returnSame'][0]);
$this->assertInstanceOf(NullInterceptor::class, $instance->bindings['returnSame'][0]); // @phpstan-ignore-line
}

public function testModuleArray(): void
Expand Down
4 changes: 2 additions & 2 deletions vendor-bin/tools/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"doctrine/coding-standard": "^9.0",
"phpmd/phpmd": "^2.9",
"phpmetrics/phpmetrics": "^2.7",
"phpstan/phpstan": "^1.0",
"phpstan/phpstan": "^2.0",
"squizlabs/php_codesniffer": "^3.5",
"vimeo/psalm": "^4.2",
"phpstan/phpstan-phpunit": "^1.1",
"phpstan/phpstan-phpunit": "^2.0",
"psalm/plugin-phpunit": "^0.17.0"
},
"config": {
Expand Down
Loading
Loading