diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 086fcea0..b5241d95 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,12 +1,11 @@ - + - diff --git a/src/AbstractFactory/ConfigAbstractFactory.php b/src/AbstractFactory/ConfigAbstractFactory.php index 4629a6d2..5e6b7600 100644 --- a/src/AbstractFactory/ConfigAbstractFactory.php +++ b/src/AbstractFactory/ConfigAbstractFactory.php @@ -71,7 +71,7 @@ public function __invoke(ContainerInterface $container, string $requestedName, ? ); } - $arguments = array_map([$container, 'get'], $serviceDependencies); + $arguments = array_map($container->get(...), $serviceDependencies); return new $requestedName(...$arguments); } diff --git a/src/AbstractFactory/ReflectionBasedAbstractFactory.php b/src/AbstractFactory/ReflectionBasedAbstractFactory.php index 32e23cab..da5b9150 100644 --- a/src/AbstractFactory/ReflectionBasedAbstractFactory.php +++ b/src/AbstractFactory/ReflectionBasedAbstractFactory.php @@ -66,7 +66,7 @@ */ final class ReflectionBasedAbstractFactory implements AbstractFactoryInterface { - private ConstructorParameterResolverInterface $constructorParameterResolver; + private readonly ConstructorParameterResolverInterface $constructorParameterResolver; /** * Allows overriding the internal list of aliases. These should be of the diff --git a/src/AbstractPluginManager.php b/src/AbstractPluginManager.php index e284c280..3f099abd 100644 --- a/src/AbstractPluginManager.php +++ b/src/AbstractPluginManager.php @@ -117,7 +117,7 @@ abstract class AbstractPluginManager implements PluginManagerInterface */ protected array $shared = []; - private ServiceManager $plugins; + private readonly ServiceManager $plugins; /** * @param ServiceManagerConfiguration $config diff --git a/src/Exception/CyclicAliasException.php b/src/Exception/CyclicAliasException.php index 5c86025f..5a26d6ca 100644 --- a/src/Exception/CyclicAliasException.php +++ b/src/Exception/CyclicAliasException.php @@ -103,7 +103,7 @@ private static function printReferencesMap(array $aliases): string */ private static function printCycles(array $detectedCycles): string { - return "[\n" . implode("\n", array_map([self::class, 'printCycle'], $detectedCycles)) . "\n]"; + return "[\n" . implode("\n", array_map(self::printCycle(...), $detectedCycles)) . "\n]"; } /** diff --git a/src/Exception/InvalidArgumentException.php b/src/Exception/InvalidArgumentException.php index 2cca6fd8..7a9c44a1 100644 --- a/src/Exception/InvalidArgumentException.php +++ b/src/Exception/InvalidArgumentException.php @@ -7,8 +7,7 @@ use InvalidArgumentException as SplInvalidArgumentException; use Laminas\ServiceManager\Initializer\InitializerInterface; -use function gettype; -use function is_object; +use function get_debug_type; use function sprintf; /** @@ -22,7 +21,7 @@ public static function fromInvalidInitializer(mixed $initializer): self 'An invalid initializer was registered. Expected a callable or an' . ' instance of "%s"; received "%s"', InitializerInterface::class, - is_object($initializer) ? $initializer::class : gettype($initializer) + get_debug_type($initializer) )); } } diff --git a/test/Proxy/LazyServiceFactoryTest.php b/test/Proxy/LazyServiceFactoryTest.php index 87d4541e..c1c40abd 100644 --- a/test/Proxy/LazyServiceFactoryTest.php +++ b/test/Proxy/LazyServiceFactoryTest.php @@ -91,7 +91,7 @@ static function ($className, $initializer) use ($expectedService, $proxy): MockO } ); - $result = $this->factory->__invoke($this->container, 'fooService', [$callback, 'callback']); + $result = $this->factory->__invoke($this->container, 'fooService', $callback->callback(...)); self::assertSame($expectedService, $result, 'service created not match the expected'); } diff --git a/test/TestAsset/FactoryObject.php b/test/TestAsset/FactoryObject.php index df072a3c..60ff2eed 100644 --- a/test/TestAsset/FactoryObject.php +++ b/test/TestAsset/FactoryObject.php @@ -6,14 +6,10 @@ final class FactoryObject { - /** @var mixed */ - public $dependency; - /** * @param mixed $dependency */ - public function __construct($dependency) + public function __construct(public $dependency) { - $this->dependency = $dependency; } } diff --git a/test/TestAsset/InvokableObject.php b/test/TestAsset/InvokableObject.php index b44cd484..6d53519c 100644 --- a/test/TestAsset/InvokableObject.php +++ b/test/TestAsset/InvokableObject.php @@ -6,11 +6,8 @@ class InvokableObject { - public array $options; - - public function __construct(array $options = []) + public function __construct(public array $options = []) { - $this->options = $options; } public function getOptions(): array