Phpinspectionsea: [False positive] ::class result and the class qualified name are not identical when aliasing class

Created on 19 Jun 2018  路  12Comments  路  Source: kalessil/phpinspectionsea

use Ololo\FrontEndBundle\Entity\Product\Product as ProductSearch;

// displays error
ProductSearch::class;
bug / false-positive fixed

All 12 comments

Oh, how did I miss that case... Thank you for reporting @Koc

@Koc, cannot reproduce. I suspect that NS in the Ololo\FrontEndBundle\Entity\Product\Product class is not identical to Ololo\FrontEndBundle\Entity\Product. Would you please check if this is a case?

Hm, this is strange. PHP autoloading loads this aliased class without any error on Linux (with case sensetive filesystem)

Em, so was it a case with case mismatch?

ping @Koc

Will recheck on Monday (because haven't access to code until it).

Ha!

This class was imported twice: one time without alias and one more time with alias. When I've removed first import - error has gone.

Not sure, do we need create new inspection for double imported classes?)

Makes sense, can you provide a specific example please? As I'm not sure for 100% how the issues is looking like practically.

use Ololo\FrontEndBundle\Entity\Product\Product;
use Ololo\FrontEndBundle\Entity\Product\Product as ProductSearch;

ProductSearch::class;

For myself: scan all imports.

Wonder if this is related or if I should open a new issue, but using EA Ultimate v2.0.8 I get the same warning when I alias a class like this:

<?php

use App\Http\Requests\FeedRequest as StoreRequest;

doSomething(StoreRequest::class);

auswahl_038

Fixed finally!

Was this page helpful?
0 / 5 - 0 ratings