Skip to content

Commit

Permalink
Add test case for property type change not invalidating methods
Browse files Browse the repository at this point in the history
  • Loading branch information
tscni committed Jun 24, 2023
1 parent 1b1915e commit 703a4b4
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions tests/Cache/CacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,5 +158,46 @@ public function do(): void
],
],
];

yield 'classPropertyTypeChangeInvalidatesReferencingMethod' => [
[
[
'files' => [
'/src/A.php' => <<<'PHP'
<?php
class A {
public function foo(B $b): int
{
return $b->value;
}
}
PHP,
'/src/B.php' => <<<'PHP'
<?php
class B {
public ?int $value = 0;
}
PHP,
],
'issues' => [
'/src/A.php' => [
"NullableReturnStatement: The declared return type 'int' for A::foo is not nullable, but the function returns 'int|null'",
"InvalidNullableReturnType: The declared return type 'int' for A::foo is not nullable, but 'int|null' contains null",
],
],
],
[
'files' => [
'/src/B.php' => <<<'PHP'
<?php
class B {
public int $value = 0;
}
PHP,
],
'issues' => [],
],
],
];
}
}

0 comments on commit 703a4b4

Please sign in to comment.