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

Allow installation alongside PHPUnit 11 #352

Merged
merged 3 commits into from
Feb 14, 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 composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"illuminate/contracts": "^9 || ^10",
"illuminate/support": "^9 || ^10",
"laminas/laminas-code": "^3.4 || ^4",
"nikic/php-parser": "^4.13"
"nikic/php-parser": "^4.13 || ^5"
},
"require-dev": {
"doctrine/dbal": "^3.4",
Expand All @@ -42,7 +42,7 @@
"phpstan/phpstan": "^1.8.2",
"phpstan/phpstan-mockery": "^1.1",
"phpstan/phpstan-phpunit": "^1.1.1",
"phpunit/phpunit": "^9.5.21 || ^10",
"phpunit/phpunit": "^9.5.21 || ^10 || ^11",
"rector/rector": "^0.19",
"symplify/rule-doc-generator": "^11 || ^12"
},
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/EnumAnnotateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ protected function getDocblockWithoutTags(DocBlockReflection $docBlockReflection
*
* @return array<\Laminas\Code\Generator\DocBlock\Tag\TagInterface>
*/
protected function getDocblockTags(DocBlockGenerator|null $originalDocblock, \ReflectionClass $reflectionClass): array
protected function getDocblockTags(?DocBlockGenerator $originalDocblock, \ReflectionClass $reflectionClass): array
{
$constants = $reflectionClass->getConstants();
$constantKeys = array_keys($constants);
Expand Down
2 changes: 1 addition & 1 deletion src/Enum.php
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ public static function getKeys(mixed $values = null): array
*
* @return array<int, TValue>
*/
public static function getValues(string|array $keys = null): array
public static function getValues(string|array|null $keys = null): array
{
if ($keys === null) {
return array_values(static::getConstants());
Expand Down
16 changes: 8 additions & 8 deletions src/Rector/ToNativeUsagesRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ protected function refactorFromKey(StaticCall $call): ?Node

$enumInstanceMatchesKey = new ArrowFunction([
'params' => [new Param($paramVariable, null, $class)],
'returnType' => 'bool',
'returnType' => new Identifier('bool'),
'expr' => new Identical(
new PropertyFetch($paramVariable, 'name'),
$key,
Expand Down Expand Up @@ -309,7 +309,7 @@ protected function refactorFromKey(StaticCall $call): ?Node

return new ArrowFunction([
'static' => true,
'params' => [new Param($keyVariable, null, 'string')],
'params' => [new Param($keyVariable, null, new Identifier('string'))],
'returnType' => $class,
'expr' => $makeFromKey($keyVariable),
]);
Expand Down Expand Up @@ -354,7 +354,7 @@ protected function refactorGetKeys(StaticCall $call): ?Node
new ArrowFunction([
'static' => true,
'params' => [new Param($paramVariable, null, $class)],
'returnType' => 'string',
'returnType' => new Identifier('string'),
'expr' => new PropertyFetch($paramVariable, 'name'),
])
),
Expand Down Expand Up @@ -449,8 +449,8 @@ protected function refactorHasValue(StaticCall $call): ?Node

return new ArrowFunction([
'static' => true,
'params' => [new Param($valueVariable, null, 'mixed')],
'returnType' => 'bool',
'params' => [new Param($valueVariable, null, new Identifier('mixed'))],
'returnType' => new Identifier('bool'),
'expr' => $expr,
]);
}
Expand Down Expand Up @@ -571,8 +571,8 @@ protected function refactorIsOrIsNot(MethodCall|NullsafeMethodCall $call, bool $
$param = new Variable('value');

return new ArrowFunction([
'params' => [new Param($param, null, 'mixed')],
'returnType' => 'bool',
'params' => [new Param($param, null, new Identifier('mixed'))],
'returnType' => new Identifier('bool'),
'expr' => new $comparison($call->var, $param, [self::COMPARED_AGAINST_ENUM_INSTANCE => true]),
]);
}
Expand Down Expand Up @@ -607,7 +607,7 @@ protected function refactorInOrNotIn(MethodCall|NullsafeMethodCall $call, bool $
$haystackValue = $haystack->value;
if ($haystackValue instanceof Array_) {
foreach ($haystackValue->items as $item) {
$item?->setAttribute(self::COMPARED_AGAINST_ENUM_INSTANCE, true);
$item->setAttribute(self::COMPARED_AGAINST_ENUM_INSTANCE, true);
}
}

Expand Down
Loading