1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-22 05:41:20 +01:00

Merge pull request #8670 from danog/fix_8669

Fix #8669
This commit is contained in:
orklah 2022-11-05 22:29:37 +01:00 committed by GitHub
commit 205e8cc73e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 1 deletions

View File

@ -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
); );

View File

@ -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 {