From e83d25752104f376f5b46e52fdcfdfa7f353ec72 Mon Sep 17 00:00:00 2001 From: spiralbot Date: Wed, 11 Dec 2024 19:42:35 +0000 Subject: [PATCH] prepare release --- composer.json | 2 +- src/ConfigsInterface.php | 2 +- src/Internal/Resolver.php | 4 ++-- src/Internal/Resolver/ResolvingState.php | 2 +- tests/ExceptionsTest.php | 2 +- tests/Fixtures/DatetimeInjector.php | 2 +- tests/Fixtures/SoftDependedClass.php | 2 +- tests/InjectableConfigTest.php | 4 +++- tests/Internal/Factory/BaseTestCase.php | 2 +- tests/Internal/Proxy/ProxyClassRendererTest.php | 4 ++-- tests/Internal/Resolver/PositionArgumentTest.php | 2 +- 11 files changed, 15 insertions(+), 13 deletions(-) diff --git a/composer.json b/composer.json index 15a1381c..b3225ef3 100644 --- a/composer.json +++ b/composer.json @@ -35,7 +35,7 @@ "require": { "php": ">=8.1", "psr/container": "^1.1|^2.0", - "spiral/security": "^3.15" + "spiral/security": "^3.14.8" }, "require-dev": { "mockery/mockery": "^1.5", diff --git a/src/ConfigsInterface.php b/src/ConfigsInterface.php index 4c9d4c61..79cf1c38 100644 --- a/src/ConfigsInterface.php +++ b/src/ConfigsInterface.php @@ -22,5 +22,5 @@ interface ConfigsInterface extends InjectorInterface * * @throws ConfiguratorException */ - public function getConfig(string $section = null): array; + public function getConfig(?string $section = null): array; } diff --git a/src/Internal/Resolver.php b/src/Internal/Resolver.php index d3aae0d0..10526e2f 100644 --- a/src/Internal/Resolver.php +++ b/src/Internal/Resolver.php @@ -294,8 +294,8 @@ private function resolveObject( private function processArgument( ResolvingState $state, mixed &$value, - ReflectionParameter $validateWith = null, - int|string $key = null + ?ReflectionParameter $validateWith = null, + int|string|null $key = null ): void { // Resolve Autowire objects if ($value instanceof Autowire) { diff --git a/src/Internal/Resolver/ResolvingState.php b/src/Internal/Resolver/ResolvingState.php index ac0a881e..cb845b7e 100644 --- a/src/Internal/Resolver/ResolvingState.php +++ b/src/Internal/Resolver/ResolvingState.php @@ -27,7 +27,7 @@ public function __construct( $this->modeNamed = $this->isNamedMode(); } - public function addResolvedValue(mixed &$value, string $key = null): void + public function addResolvedValue(mixed &$value, ?string $key = null): void { if ($key === null) { $this->resolvedValues[] = &$value; diff --git a/tests/ExceptionsTest.php b/tests/ExceptionsTest.php index 586b4553..e5120079 100644 --- a/tests/ExceptionsTest.php +++ b/tests/ExceptionsTest.php @@ -60,7 +60,7 @@ public function testInjectionUsingIntersectionTypes(): void $container->resolveArguments(new \ReflectionMethod(IntersectionTypes::class, 'example')); } - public function testArgumentException(string $param = null): void + public function testArgumentException(?string $param = null): void { $method = new \ReflectionMethod($this, 'testArgumentException'); diff --git a/tests/Fixtures/DatetimeInjector.php b/tests/Fixtures/DatetimeInjector.php index bb16dc4f..940119eb 100644 --- a/tests/Fixtures/DatetimeInjector.php +++ b/tests/Fixtures/DatetimeInjector.php @@ -14,7 +14,7 @@ */ class DatetimeInjector implements InjectorInterface { - public function createInjection(\ReflectionClass $class, string $context = null): object + public function createInjection(\ReflectionClass $class, ?string $context = null): object { return match ($class->getName()) { DateTime::class => new DateTime(), diff --git a/tests/Fixtures/SoftDependedClass.php b/tests/Fixtures/SoftDependedClass.php index 4ccf279c..4f83823e 100644 --- a/tests/Fixtures/SoftDependedClass.php +++ b/tests/Fixtures/SoftDependedClass.php @@ -20,7 +20,7 @@ class SoftDependedClass * @param string $name * @param SampleClass $sample */ - public function __construct(string $name, SampleClass $sample = null) + public function __construct(string $name, ?SampleClass $sample = null) { $this->name = $name; $this->sample = $sample; diff --git a/tests/InjectableConfigTest.php b/tests/InjectableConfigTest.php index 974df844..72225706 100644 --- a/tests/InjectableConfigTest.php +++ b/tests/InjectableConfigTest.php @@ -12,7 +12,6 @@ use Spiral\Tests\Core\Fixtures\IntKeysConfig; use Spiral\Tests\Core\Fixtures\TestConfig; -#[\PHPUnit\Framework\Attributes\CoversClass(\Spiral\Core\InjectableConfig::class)] class InjectableConfigTest extends TestCase { use AliasTrait; @@ -102,6 +101,9 @@ public function testGetError(): void $config['keyC']; } + /** + * @covers \Spiral\Core\InjectableConfig::__set_state() + */ public function testSerialize(): void { $config = new TestConfig([ diff --git a/tests/Internal/Factory/BaseTestCase.php b/tests/Internal/Factory/BaseTestCase.php index 88b4e023..27772e2c 100644 --- a/tests/Internal/Factory/BaseTestCase.php +++ b/tests/Internal/Factory/BaseTestCase.php @@ -6,7 +6,7 @@ abstract class BaseTestCase extends \Spiral\Tests\Core\Internal\BaseTestCase { - protected function make(string $class, array $args = [], string $context = null): mixed + protected function make(string $class, array $args = [], ?string $context = null): mixed { return $this->createFactory()->make($class, $args, $context); } diff --git a/tests/Internal/Proxy/ProxyClassRendererTest.php b/tests/Internal/Proxy/ProxyClassRendererTest.php index eb249fd6..9c75fe27 100644 --- a/tests/Internal/Proxy/ProxyClassRendererTest.php +++ b/tests/Internal/Proxy/ProxyClassRendererTest.php @@ -64,8 +64,8 @@ public static function provideRenderParameter(): iterable yield [$from(fn(float $string = 42) => 0), 'mixed $string = 42.0']; yield [$from(fn(?bool $string = false) => 0), 'mixed $string = false']; yield [$from(fn(bool|null $string = true) => 0), 'mixed $string = true']; - yield [$from(fn(object $string = null) => 0), 'mixed $string = NULL']; - yield [$from(fn(iterable $string = null) => 0), 'mixed $string = NULL']; + yield [$from(fn(?object $string = null) => 0), 'mixed $string = NULL']; + yield [$from(fn(?iterable $string = null) => 0), 'mixed $string = NULL']; yield [$from(fn(Countable&ArrayAccess $val) => 0), 'mixed $val']; yield [$from(fn(string ...$val) => 0), 'mixed ...$val']; yield [$from(fn(string|int ...$val) => 0), 'mixed ...$val']; diff --git a/tests/Internal/Resolver/PositionArgumentTest.php b/tests/Internal/Resolver/PositionArgumentTest.php index 84cccb94..ca85fb93 100644 --- a/tests/Internal/Resolver/PositionArgumentTest.php +++ b/tests/Internal/Resolver/PositionArgumentTest.php @@ -33,7 +33,7 @@ public function testSecondPositionArgument(): void public function testFirstIsOptionalSecondPassedAsArgument(): void { $result = $this->resolveClosure( - static fn(int $foo = 42, EngineInterface $engine2 = null) => null, + static fn(int $foo = 42, ?EngineInterface $engine2 = null) => null, [1 => ($engineB = new EngineZIL130())] );