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

Fix handling of property type with default

This commit is contained in:
Matthew Brown 2019-06-06 17:42:23 -04:00
parent 4a954acf84
commit 36ac342496
2 changed files with 10 additions and 1 deletions

View File

@ -763,7 +763,6 @@ class ClassAnalyzer extends ClassLikeAnalyzer
foreach ($stmt->props as $prop) {
if ($prop->default) {
$member_stmts[] = $stmt;
break;
}
if ($codebase->alter_code) {

View File

@ -377,6 +377,11 @@ class ClassMoveTest extends \Psalm\Tests\TestCase
* @param Bat $b
*/
function doSomething(Bat $b) : void {}
class A {
/** @var ?Bat */
public $x = null;
}
}
namespace Bar {
class Bat {
@ -393,6 +398,11 @@ class ClassMoveTest extends \Psalm\Tests\TestCase
* @param Bahh $b
*/
function doSomething(Bahh $b) : void {}
class A {
/** @var null|Bahh */
public $x = null;
}
}
namespace Bar\Baz {
class Bahh {