1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00

Force a rescan if adding an extra method

This commit is contained in:
Brown 2018-10-26 11:48:21 -04:00
parent dbb155f18d
commit 89e91f6ae2
2 changed files with 52 additions and 0 deletions

View File

@ -137,6 +137,7 @@ class OffsetMapCheckerVisitor extends PhpParser\NodeVisitorAbstract implements P
if (!$replacement_stmts
|| !$replacement_stmts[0] instanceof PhpParser\Node\Stmt\ClassLike
|| count($replacement_stmts[0]->stmts) > 1
) {
$hacky_class_fix = preg_replace('/(\)[\s]*):([\s]*\{)/', '$1 $2', $fake_class);
@ -148,6 +149,7 @@ class OffsetMapCheckerVisitor extends PhpParser\NodeVisitorAbstract implements P
if (!$replacement_stmts
|| !$replacement_stmts[0] instanceof PhpParser\Node\Stmt\ClassLike
|| count($replacement_stmts[0]->stmts) > 1
) {
\error_log($hacky_class_fix);

View File

@ -1196,6 +1196,56 @@ class FileDiffTest extends TestCase
[],
[[-36, -1]]
],
'docblockTwiceOver' => [
'<?php
namespace Bar;
class Foo
{
public function a()
{
return 5;
}
/**
* @return bool
*/
public function c()
{
return true;
}
}',
'<?php
namespace Bar;
class Foo
{
public function a()
{
return 5;
}
/**
* @return void
*/
public function b()
{
$a = 1;
}
/**
* @return bool
*/
public function c()
{
return true;
}
}',
['bar\foo::a', 'bar\foo::c'],
[],
['bar\foo::b'],
[[229, 8]]
],
];
}
}