diff --git a/src/AbstractContainerCommandLoader.php b/src/AbstractContainerCommandLoader.php index 4891c92..f876b77 100644 --- a/src/AbstractContainerCommandLoader.php +++ b/src/AbstractContainerCommandLoader.php @@ -22,7 +22,7 @@ abstract class AbstractContainerCommandLoader implements CommandLoaderInterface private $commandMap; /** @psalm-param array $commandMap */ - final public function __construct(private ContainerInterface $container, array $commandMap) + final public function __construct(private readonly ContainerInterface $container, array $commandMap) { Assert::isMap($commandMap); Assert::allString($commandMap); diff --git a/src/ContainerResolver.php b/src/ContainerResolver.php index b7a2036..d3bf3a1 100644 --- a/src/ContainerResolver.php +++ b/src/ContainerResolver.php @@ -28,7 +28,7 @@ final class ContainerResolver * @psalm-param non-empty-string $projectRoot */ public function __construct( - private string $projectRoot + private readonly string $projectRoot ) { } diff --git a/src/Input/AbstractInputParam.php b/src/Input/AbstractInputParam.php index 186d8c6..937e497 100644 --- a/src/Input/AbstractInputParam.php +++ b/src/Input/AbstractInputParam.php @@ -56,7 +56,7 @@ public function __construct( /** * Parameter name; must be set by class composing trait! */ - private string $name + private readonly string $name ) { } diff --git a/src/Input/AbstractParamAwareInput.php b/src/Input/AbstractParamAwareInput.php index 4bdaf99..e53de72 100644 --- a/src/Input/AbstractParamAwareInput.php +++ b/src/Input/AbstractParamAwareInput.php @@ -5,6 +5,7 @@ namespace Laminas\Cli\Input; use InvalidArgumentException; +use Stringable; use Symfony\Component\Console\Helper\QuestionHelper; use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputInterface; @@ -26,7 +27,7 @@ * * @internal */ -abstract class AbstractParamAwareInput implements ParamAwareInputInterface +abstract class AbstractParamAwareInput implements ParamAwareInputInterface, Stringable { /** * @param array $params diff --git a/src/Input/Mapper/ArrayInputMapper.php b/src/Input/Mapper/ArrayInputMapper.php index f44f351..b4f9e5c 100644 --- a/src/Input/Mapper/ArrayInputMapper.php +++ b/src/Input/Mapper/ArrayInputMapper.php @@ -17,7 +17,7 @@ final class ArrayInputMapper implements InputMapperInterface * @psalm-param array> $map */ public function __construct( - private array $map + private readonly array $map ) { } diff --git a/src/Listener/TerminateListener.php b/src/Listener/TerminateListener.php index 414697e..3399bf2 100644 --- a/src/Listener/TerminateListener.php +++ b/src/Listener/TerminateListener.php @@ -18,11 +18,10 @@ use function array_search; use function file_get_contents; +use function get_debug_type; use function getcwd; -use function gettype; use function is_array; use function is_int; -use function is_object; use function is_string; use function json_decode; use function preg_match; @@ -151,7 +150,7 @@ private function createInputMapper(mixed $inputMapperSpec, string $commandClass) 'Expected array option map or %s class implementation name for %s input mapper; received "%s"', InputMapperInterface::class, $commandClass, - is_object($inputMapperSpec) ? $inputMapperSpec::class : gettype($inputMapperSpec) + get_debug_type($inputMapperSpec) )); Assert::classExists(