mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +01:00
commit
205e8cc73e
@ -601,7 +601,7 @@ class AssertionReconciler extends Reconciler
|
|||||||
$codebase,
|
$codebase,
|
||||||
$type_1_atomic,
|
$type_1_atomic,
|
||||||
$type_2_atomic,
|
$type_2_atomic,
|
||||||
!($type_1_atomic instanceof TNamedObject && $type_2_atomic instanceof TNamedObject),
|
$type_1_atomic instanceof TClassString && $type_2_atomic instanceof TClassString,
|
||||||
false,
|
false,
|
||||||
$atomic_comparison_results
|
$atomic_comparison_results
|
||||||
);
|
);
|
||||||
|
@ -19,6 +19,31 @@ class TypeTest extends TestCase
|
|||||||
public function providerValidCodeParse(): iterable
|
public function providerValidCodeParse(): iterable
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
'instanceOfInterface' => [
|
||||||
|
'code' => '<?php
|
||||||
|
interface Supplier {
|
||||||
|
public function get(): iterable;
|
||||||
|
}
|
||||||
|
|
||||||
|
class SomeClass {
|
||||||
|
protected Supplier|iterable $prop;
|
||||||
|
|
||||||
|
public function __construct(Supplier|iterable $value) {
|
||||||
|
$this->prop = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function do(): void {
|
||||||
|
$var = $this->prop;
|
||||||
|
|
||||||
|
if ($var instanceof Supplier) {
|
||||||
|
$var->get();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}',
|
||||||
|
'assertions' => [],
|
||||||
|
'ignored_issues' => [],
|
||||||
|
'php_version' => '8.0'
|
||||||
|
],
|
||||||
'nullableMethodWithTernaryGuard' => [
|
'nullableMethodWithTernaryGuard' => [
|
||||||
'code' => '<?php
|
'code' => '<?php
|
||||||
class A {
|
class A {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user