Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,14 @@ public function getTypes(string $class, string $property, array $context = []):
continue;
}

if (
$tagDocNode->value instanceof ParamTagValueNode
&& null === $prefix
&& $tagDocNode->value->parameterName !== '$'.$property
) {
continue;
}

foreach ($this->phpStanTypeHelper->getTypes($tagDocNode->value, $nameScope) as $type) {
switch ($type->getClassName()) {
case 'self':
Expand Down Expand Up @@ -239,10 +247,6 @@ private function getDocBlockFromProperty(string $class, string $property): ?arra
$phpDocNode = $this->phpDocParser->parse($tokens);
$tokens->consumeTokenType(Lexer::TOKEN_END);

if (self::MUTATOR === $source && !$this->filterDocBlockParams($phpDocNode, $property)) {
return null;
}

return [$phpDocNode, $source, $reflectionProperty->class];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@ public function php80TypesProvider()
return [
[Php80Dummy::class, 'promotedAndMutated', [new Type(Type::BUILTIN_TYPE_STRING)]],
[Php80Dummy::class, 'promoted', null],
[Php80Dummy::class, 'collection', [new Type(Type::BUILTIN_TYPE_ARRAY, collection: true, collectionValueType: new Type(Type::BUILTIN_TYPE_STRING))]],
[Php80PromotedDummy::class, 'promoted', null],
];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ class Php80Dummy

/**
* @param string $promotedAndMutated
* @param array<string> $collection
*/
public function __construct(private mixed $promoted, private mixed $promotedAndMutated)
public function __construct(private mixed $promoted, private mixed $promotedAndMutated, private array $collection)
{
}

Expand Down