mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 13:51:54 +01:00
Fix #4326 - Prevent later remapping of properties
This commit is contained in:
parent
1915f34959
commit
05f2d01cb6
@ -1004,9 +1004,7 @@ class InstancePropertyFetchAnalyzer
|
||||
$class_storage,
|
||||
$declaring_class_storage
|
||||
);
|
||||
}
|
||||
|
||||
if ($lhs_type_part instanceof TGenericObject) {
|
||||
} elseif ($lhs_type_part instanceof TGenericObject) {
|
||||
$class_property_type = self::localizePropertyType(
|
||||
$codebase,
|
||||
$class_property_type,
|
||||
|
@ -3005,7 +3005,7 @@ class ClassTemplateTest extends TestCase
|
||||
}
|
||||
}'
|
||||
],
|
||||
'flippedParamsInside' => [
|
||||
'flippedParamsMethodInside' => [
|
||||
'<?php
|
||||
/**
|
||||
* @template A
|
||||
@ -3026,7 +3026,7 @@ class ClassTemplateTest extends TestCase
|
||||
}
|
||||
}'
|
||||
],
|
||||
'flippedParamsOutside' => [
|
||||
'flippedParamsMethodOutside' => [
|
||||
'<?php
|
||||
/**
|
||||
* @template B
|
||||
@ -3048,6 +3048,49 @@ class ClassTemplateTest extends TestCase
|
||||
public abstract function getTraversable() : Traversable;
|
||||
}'
|
||||
],
|
||||
'flippedParamsPropertyInside' => [
|
||||
'<?php
|
||||
/**
|
||||
* @template A
|
||||
* @template B
|
||||
*/
|
||||
abstract class Foo
|
||||
{
|
||||
/** @var Traversable<A, B> */
|
||||
public $traversable;
|
||||
|
||||
/**
|
||||
* @param Foo<B, A> $flipped
|
||||
* @return Traversable<B, A>
|
||||
*/
|
||||
public function getFlippedTraversable(Foo $flipped): Traversable
|
||||
{
|
||||
return $flipped->traversable;
|
||||
}
|
||||
}'
|
||||
],
|
||||
'flippedParamsPropertyOutside' => [
|
||||
'<?php
|
||||
/**
|
||||
* @template B
|
||||
* @template A
|
||||
* @param Foo<B, A> $flipped
|
||||
* @return Traversable<B, A>
|
||||
*/
|
||||
function getFlippedTraversable(Foo $flipped): Traversable {
|
||||
return $flipped->traversable;
|
||||
}
|
||||
|
||||
/**
|
||||
* @template A
|
||||
* @template B
|
||||
*/
|
||||
abstract class Foo
|
||||
{
|
||||
/** @var Traversable<A, B> */
|
||||
public $traversable;
|
||||
}'
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user