1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 04:45:20 +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) { foreach ($stmt->props as $prop) {
if ($prop->default) { if ($prop->default) {
$member_stmts[] = $stmt; $member_stmts[] = $stmt;
break;
} }
if ($codebase->alter_code) { if ($codebase->alter_code) {

View File

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