Phpinspectionsea: False-positive "Null Pointer exception may occur here" after webmozart/assert check

Created on 22 Oct 2018  路  3Comments  路  Source: kalessil/phpinspectionsea

| Subject | Details |
| :------------- | :---------------------------------------------------------------------------- |
| Issue type | Bug/False-Positive |
| Plugin | Php Inspections (EA Extended), v3.0.7 |
| Language level | PHP 7.1 |

Current behaviour:
Suppose i have code with Webmozart assertion instead of instanceof check:

$object = $container->getNullableObject();
Webmozart\Assert\Assert::isInstanceOf($object, SomeClass::class);
$object->methodCall();
$object->anythingElse();

I see "Null Pointer exception may occur here" errors triggered on lines 3 & 4.

Expected behaviour

No "Null Pointer exception may occur here" errors triggered.

Environment details

PhpStorm 2018.3 EAP
Build #PS-183.3795.24, built on October 17, 2018
PhpStorm EAP User
Expiration date: November 16, 2018
JRE: 1.8.0_152-release-1343-b12 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.4.0-137-generic

bug / false-positive fixed

All 3 comments

Thank you for reporting @nkonev-4xxi, the assertions suppose to be supported. I'll check what's broken.

Fixed!

Woohoo, thanks

Was this page helpful?
0 / 5 - 0 ratings