Skip to content

Commit

Permalink
Merge pull request #8670 from danog/fix_8669
Browse files Browse the repository at this point in the history
Fix #8669
  • Loading branch information
orklah committed Nov 5, 2022
2 parents 2ae819e + 923f1d2 commit 205e8cc
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Psalm/Internal/Type/AssertionReconciler.php
Expand Up @@ -601,7 +601,7 @@ private static function filterAtomicWithAnother(
$codebase,
$type_1_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,
$atomic_comparison_results
);
Expand Down
25 changes: 25 additions & 0 deletions tests/TypeReconciliation/TypeTest.php
Expand Up @@ -19,6 +19,31 @@ class TypeTest extends TestCase
public function providerValidCodeParse(): iterable
{
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' => [
'code' => '<?php
class A {
Expand Down

0 comments on commit 205e8cc

Please sign in to comment.