mirror of
https://github.com/danog/psalm.git
synced 2025-01-21 21:31:13 +01:00
Add extra trait test
This commit is contained in:
parent
92e43b8fa0
commit
67ef894ecc
@ -191,12 +191,12 @@ class CallChecker
|
||||
$has_valid_function_call_type = true;
|
||||
} elseif ($var_type_part instanceof TMixed) {
|
||||
$has_valid_function_call_type = true;
|
||||
// @todo maybe emit issue here
|
||||
// @todo maybe emit issue here
|
||||
} elseif (($var_type_part instanceof TNamedObject && $var_type_part->value === 'Closure') ||
|
||||
$var_type_part instanceof TCallable
|
||||
) {
|
||||
$has_valid_function_call_type = true;
|
||||
// this is fine
|
||||
// this is fine
|
||||
} elseif ($var_type_part instanceof TNull) {
|
||||
// handled above
|
||||
} elseif (!$var_type_part instanceof TNamedObject ||
|
||||
|
@ -366,6 +366,32 @@ class TraitTest extends TestCase
|
||||
use T;
|
||||
}',
|
||||
],
|
||||
'namespacedTraitLookup' => [
|
||||
'<?php
|
||||
namespace Classes {
|
||||
use Traits\T;
|
||||
|
||||
class A {}
|
||||
|
||||
class B {
|
||||
use T;
|
||||
}
|
||||
}
|
||||
|
||||
namespace Traits {
|
||||
use Classes\A;
|
||||
|
||||
trait T {
|
||||
public function getA() : A {
|
||||
return new A;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace {
|
||||
$a = (new Classes\B)->getA();
|
||||
}',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user