mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 04:45:20 +01:00
fix is_object assertions
This commit is contained in:
parent
e2957a1631
commit
baff6fb36a
@ -1609,11 +1609,7 @@ class SimpleAssertionReconciler extends Reconciler
|
||||
&& self::areIntersectionTypesAllowed($codebase, $type)
|
||||
) {
|
||||
$object_types[] = $type->addIntersectionType($assertion_type);
|
||||
$redundant = false;
|
||||
} elseif ($type instanceof TNamedObject
|
||||
&& $codebase->classlike_storage_provider->has($type->value)
|
||||
&& $codebase->classlike_storage_provider->get($type->value)->final
|
||||
) {
|
||||
// This is wrong, a proper check for redundant object shape assertions should be added
|
||||
$redundant = false;
|
||||
} elseif ($type->isObjectType()) {
|
||||
$object_types[] = $type;
|
||||
|
@ -1334,6 +1334,16 @@ class TypeTest extends TestCase
|
||||
/** @param non-empty-array $a */
|
||||
function expectNonEmptyArray(array $a): array { return $a; }',
|
||||
],
|
||||
'isObjectMakesObject' => [
|
||||
'code' => '<?php
|
||||
|
||||
final class test {}
|
||||
|
||||
/** @var array|int|float|test|null */
|
||||
$a = null;
|
||||
if (\is_object($a)) {
|
||||
}',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user