1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-26 20:34:47 +01:00

Merge pull request #10240 from ging-dev/cache

fix: #10239
This commit is contained in:
orklah 2023-09-30 18:26:59 +02:00 committed by GitHub
commit c67dce7d14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 54 additions and 1 deletions

View File

@ -115,7 +115,11 @@ class FileStatementsDiffer extends AstDiffer
$b_code, $b_code,
); );
$keep = [...$keep, ...$class_keep[0]]; if ($diff_elem->old->getDocComment() === $diff_elem->new->getDocComment()) {
$keep = [...$keep, ...$class_keep[0]];
} else {
$keep_signature = [...$keep_signature, ...$class_keep[0]];
}
$keep_signature = [...$keep_signature, ...$class_keep[1]]; $keep_signature = [...$keep_signature, ...$class_keep[1]];
$add_or_delete = [...$add_or_delete, ...$class_keep[2]]; $add_or_delete = [...$add_or_delete, ...$class_keep[2]];
$diff_map = [...$diff_map, ...$class_keep[3]]; $diff_map = [...$diff_map, ...$class_keep[3]];

View File

@ -199,5 +199,54 @@ class CacheTest extends TestCase
], ],
], ],
]; ];
yield 'classDocblockChange' => [
[
[
'files' => [
'/src/A.php' => <<<'PHP'
<?php
/**
* @template T
*/
class A {
/**
* @param T $baz
*/
public function foo($baz): void
{
}
}
PHP,
],
'issues' => [],
],
[
'files' => [
'/src/A.php' => <<<'PHP'
<?php
/**
* @template K
*/
class A {
/**
* @param T $baz
*/
public function foo($baz): void
{
}
}
PHP,
],
'issues' => [
'/src/A.php' => [
"UndefinedDocblockClass: Docblock-defined class, interface or enum named T does not exist",
],
],
],
],
];
} }
} }