mirror of
https://github.com/danog/psalm.git
synced 2025-01-21 21:31:13 +01:00
Be resilient to docblock spaces
This commit is contained in:
parent
2e7d26af6a
commit
0221282074
@ -1038,18 +1038,19 @@ class CommentAnalyzer
|
||||
|
||||
if ($nexter_char === ' ') {
|
||||
++$i;
|
||||
$type .= $next_char;
|
||||
$type .= $next_char . ' ';
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if ($last_char === '|' || $last_char === '&') {
|
||||
$type .= ' ';
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($next_char === ':') {
|
||||
++$i;
|
||||
$type .= ':';
|
||||
$type .= ' :';
|
||||
$expects_callable_return = true;
|
||||
continue;
|
||||
}
|
||||
|
@ -132,6 +132,37 @@ class ClassMoveTest extends \Psalm\Tests\TestCase
|
||||
'Ns\A' => 'Ns\B',
|
||||
]
|
||||
],
|
||||
'renameEmptyClassWithSpacesInDocblock' => [
|
||||
'<?php
|
||||
namespace Ns;
|
||||
|
||||
class A {}
|
||||
|
||||
/**
|
||||
* @param ?A $a
|
||||
* @param string | null $b
|
||||
* @return A | null
|
||||
*/
|
||||
function foo(?A $a, $b) : ?A {
|
||||
return $a;
|
||||
}',
|
||||
'<?php
|
||||
namespace Ns;
|
||||
|
||||
class B {}
|
||||
|
||||
/**
|
||||
* @param null|B $a
|
||||
* @param string | null $b
|
||||
* @return null|B
|
||||
*/
|
||||
function foo(?B $a, $b) : ?B {
|
||||
return $a;
|
||||
}',
|
||||
[
|
||||
'Ns\A' => 'Ns\B',
|
||||
]
|
||||
],
|
||||
'renameClassWithInstanceMethod' => [
|
||||
'<?php
|
||||
namespace Ns;
|
||||
|
Loading…
x
Reference in New Issue
Block a user