mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +01:00
Possible fix
This commit is contained in:
parent
5a44522efb
commit
923f1d2eb7
@ -601,7 +601,7 @@ class AssertionReconciler extends Reconciler
|
||||
$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
|
||||
);
|
||||
|
@ -62,7 +62,7 @@ class ObjectComparator
|
||||
foreach ($intersection_input_types as $input_type_key => $intersection_input_type) {
|
||||
if ($allow_interface_equality
|
||||
&& $container_type_is_interface
|
||||
&& isset($intersection_container_types[$input_type_key])
|
||||
&& !isset($intersection_container_types[$input_type_key])
|
||||
) {
|
||||
$any_inputs_contained = true;
|
||||
} elseif (self::isIntersectionShallowlyContainedBy(
|
||||
|
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user