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
4 changes: 2 additions & 2 deletions src/Analyser/NodeScopeResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ private function processStmtNode(
$throwPoints = [];
$impurePoints = [];
$this->processAttributeGroups($stmt, $stmt->attrGroups, $scope, $nodeCallback);
[$templateTypeMap, $phpDocParameterTypes, $phpDocImmediatelyInvokedCallableParameters, $phpDocClosureThisTypeParameters, $phpDocReturnType, $phpDocThrowType, $deprecatedDescription, $isDeprecated, $isInternal, $isFinal, $isPure, $acceptsNamedArguments, , $phpDocComment, $asserts, $selfOutType, $phpDocParameterOutTypes] = $this->getPhpDocs($scope, $stmt);
[$templateTypeMap, $phpDocParameterTypes, $phpDocImmediatelyInvokedCallableParameters, $phpDocClosureThisTypeParameters, $phpDocReturnType, $phpDocThrowType, $deprecatedDescription, $isDeprecated, $isInternal, $isFinal, $isPure, $acceptsNamedArguments, $isReadOnly, $phpDocComment, $asserts, $selfOutType, $phpDocParameterOutTypes] = $this->getPhpDocs($scope, $stmt);

foreach ($stmt->params as $param) {
$this->processParamNode($stmt, $param, $scope, $nodeCallback);
Expand Down Expand Up @@ -718,7 +718,7 @@ private function processStmtNode(
true,
$isFromTrait,
$param,
false,
$isReadOnly,
$scope->isInTrait(),
$classReflection->isReadOnly(),
false,
Expand Down
5 changes: 5 additions & 0 deletions tests/PHPStan/Rules/Generics/PropertyVarianceRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,9 @@ public function testBug9153(): void
$this->analyse([__DIR__ . '/data/bug-9153.php'], []);
}

public function testBug13049(): void
{
$this->analyse([__DIR__ . '/data/bug-13049.php'], []);
}

}
41 changes: 41 additions & 0 deletions tests/PHPStan/Rules/Generics/data/bug-13049.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php // lint >= 8.0

declare(strict_types = 1);

namespace Bug13049;

/**
* @template-covariant Value of string|list<string>
*
* @immutable
*/
final class LanguageProperty
{

/** @var Value */
public $value;

/**
* @param Value $value
*/
public function __construct($value)
{
$this->value = $value;
}
}

/**
* @template-covariant Value of string|list<string>
*
* @immutable
*/
final class LanguageProperty2
{
/**
* @param Value $value
*/
public function __construct(public $value)
{
$this->value = $value;
}
}
Loading