From 687886cf2af9cbe2aafd23644c8381221f294a8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Viktor=20Sz=C3=A9pe?= Date: Sun, 16 Apr 2023 10:08:03 +0200 Subject: [PATCH 1/3] Fix --- src/Reflection/Reflector.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Reflection/Reflector.php b/src/Reflection/Reflector.php index 4aa5bf2..c43a857 100644 --- a/src/Reflection/Reflector.php +++ b/src/Reflection/Reflector.php @@ -148,8 +148,8 @@ private function getParameterTypeFromDocComment(ReflectionParameter $parameter): $pattern = '/@param(.*)\$' . $parameter->getName() . '\W/'; - /** @var list $matches */ preg_match_all($pattern, $docComment, $matches, PREG_SET_ORDER); + /** @var list> $matches */ if (count($matches) === 0) { return null; @@ -238,7 +238,7 @@ private function getParameterTypeFromReflection(ReflectionType $type, Reflection if ($type instanceof ReflectionUnionType) { return $this->createUnionType( array_map( - function (ReflectionNamedType|ReflectionIntersectionType $type) use ($reflectionParameter): SimpleType|ClassType|EnumType|ArrayType { + function (ReflectionNamedType|ReflectionIntersectionType $type) use ($reflectionParameter): SimpleType|ClassType|EnumType { /** @psalm-suppress DocblockTypeContradiction https://github.com/vimeo/psalm/issues/9079 */ if ($type instanceof ReflectionIntersectionType) { $this->throwOnIntersectionType($reflectionParameter); From 38f1fc607afd58c68dde299b9621b808c8fa1a72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Viktor=20Sz=C3=A9pe?= Date: Sun, 16 Apr 2023 10:09:55 +0200 Subject: [PATCH 2/3] Fix --- src/Reflection/Type/SimpleType.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Reflection/Type/SimpleType.php b/src/Reflection/Type/SimpleType.php index e7b5e93..e50676b 100644 --- a/src/Reflection/Type/SimpleType.php +++ b/src/Reflection/Type/SimpleType.php @@ -12,7 +12,7 @@ final class SimpleType implements Stringable { /** - * @psalm-param 'int'|'float'|'string'|'bool'|'true'|'false'|'null'|'array'|'object'|'mixed' $type + * @psalm-param 'int'|'float'|'string'|'bool'|'true'|'false'|'null'|'array'|'object'|'mixed' $name */ public function __construct( public readonly string $name, From 3287b0f579a3500e90a75d6e8c767b98125d4bf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Viktor=20Sz=C3=A9pe?= Date: Sun, 16 Apr 2023 10:10:35 +0200 Subject: [PATCH 3/3] Fix --- src/Reflection/TypeTokenizer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Reflection/TypeTokenizer.php b/src/Reflection/TypeTokenizer.php index 2265d7a..29b835b 100644 --- a/src/Reflection/TypeTokenizer.php +++ b/src/Reflection/TypeTokenizer.php @@ -41,8 +41,8 @@ final class TypeTokenizer */ public static function tokenize(string $type): array { - /** @var list> $matches */ preg_match_all(self::PATTERN, $type, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE); + /** @var list> $matches */ $tokens = [];