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 to latest PHP 8.1 syntax #129

Merged
merged 1 commit into from
Nov 22, 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
2 changes: 1 addition & 1 deletion src/AbstractContainerCommandLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ abstract class AbstractContainerCommandLoader implements CommandLoaderInterface
private $commandMap;

/** @psalm-param array<string, string> $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);
Expand Down
2 changes: 1 addition & 1 deletion src/ContainerResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ final class ContainerResolver
* @psalm-param non-empty-string $projectRoot
*/
public function __construct(
private string $projectRoot
private readonly string $projectRoot
) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/Input/AbstractInputParam.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function __construct(
/**
* Parameter name; must be set by class composing trait!
*/
private string $name
private readonly string $name
) {
}

Expand Down
3 changes: 2 additions & 1 deletion src/Input/AbstractParamAwareInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -26,7 +27,7 @@
*
* @internal
*/
abstract class AbstractParamAwareInput implements ParamAwareInputInterface
abstract class AbstractParamAwareInput implements ParamAwareInputInterface, Stringable
{
/**
* @param array<string, InputParamInterface> $params
Expand Down
2 changes: 1 addition & 1 deletion src/Input/Mapper/ArrayInputMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ final class ArrayInputMapper implements InputMapperInterface
* @psalm-param array<string|int, string|array<string, string>> $map
*/
public function __construct(
private array $map
private readonly array $map
) {
}

Expand Down
5 changes: 2 additions & 3 deletions src/Listener/TerminateListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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(
Expand Down