Phpinspectionsea: Use the qualified reference doesn't work with imported functions.

Created on 14 Sep 2018  路  4Comments  路  Source: kalessil/phpinspectionsea

| Subject | Details
| :------------- | :----
| Issue type | False-Positive
| Plugin | Php Inspections (EA Extended) 3.0.6
| Language level | PHP 7.1

Current behaviour (description/screenshot:)

Sample code:

<?php
namespace My;
use function array_filter;
array_filter();

_Use the qualified reference_ shows up on both, the import _and_ the function usage.
Note that the issue is not consistent - for instance I could replicate it with str_replace(), but not count(), where in the latter case importing function doesn't trigger then inspection warning.

Expected behaviour

Importing function should not trigger the inspection.

Environment details

PhpStorm 2018.2.2
build 182.4129.45
JRE: 1.8.0_152-release-1248-b8 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains
edit: replicated on PhpStorm 2018.2.3 #182.4323.68

bug / false-positive fixed

All 4 comments

Thank you for reporting @oshdev, fixed!

Thanks for such a quick turn around!
May I ask why count() didn't have false positive?
Another thing - looking at the commit, it seems that there's a related issue that won't be fixed with this.
Same as above, but constant:

<?php
namespace My;
use const PHP_INT_MAX;
PHP_INT_MAX;

count is one of op-coded functions and my implementation had a bug with reporting non-opcoded functions even if they are imported.

Oh, I'll add new test cases to check the behaviour, thank you!

Confirmed, the constants were getting reported. Fixed.

Was this page helpful?
0 / 5 - 0 ratings