Skip to content

Commit

Permalink
Bump nikic/php-parser to 4.13.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kukulich committed Sep 23, 2021
1 parent c0ee39b commit 1d1ece4
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"php": "~8.0.0 || ~8.1.0",
"ext-json": "*",
"jetbrains/phpstorm-stubs": "2021.2",
"nikic/php-parser": "^4.12.0",
"nikic/php-parser": "^4.13.0",
"phpdocumentor/reflection-docblock": "^5.2.2",
"phpdocumentor/type-resolver": "^1.5.0",
"roave/signature": "^1.5"
Expand Down
14 changes: 7 additions & 7 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions src/Reflection/ReflectionType.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@

namespace Roave\BetterReflection\Reflection;

use PhpParser\Node\ComplexType;
use PhpParser\Node\Identifier;
use PhpParser\Node\Name;
use PhpParser\Node\NullableType;
use PhpParser\Node\UnionType;

abstract class ReflectionType
{
protected function __construct(private bool $allowsNull)
{
}

public static function createFromTypeAndReflector(Identifier|Name|NullableType|UnionType $type, bool $forceAllowsNull = false): ReflectionNamedType|ReflectionUnionType
public static function createFromTypeAndReflector(Identifier|Name|ComplexType $type, bool $forceAllowsNull = false): ReflectionNamedType|ReflectionUnionType
{
$allowsNull = $forceAllowsNull;
if ($type instanceof NullableType) {
Expand All @@ -27,6 +27,10 @@ public static function createFromTypeAndReflector(Identifier|Name|NullableType|U
return new ReflectionNamedType($type, $allowsNull);
}

/**
* @psalm-suppress ArgumentTypeCoercion
* @phpstan-ignore-next-line
*/
return new ReflectionUnionType($type, $allowsNull);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ private function setParameterDefaultValue(ReflectionParameter $parameterReflecti
$parameterNode->setDefault($parameterReflection->getDefaultValue());
}

private function formatType(CoreReflectionNamedType|CoreReflectionUnionType $type): Name|FullyQualified|NullableType|UnionType
private function formatType(CoreReflectionNamedType|CoreReflectionUnionType $type): Name|FullyQualified|Node\ComplexType
{
if ($type instanceof CoreReflectionUnionType) {
$types = [];
Expand Down

0 comments on commit 1d1ece4

Please sign in to comment.