phpinspectionsea icon indicating copy to clipboard operation
phpinspectionsea copied to clipboard

Php Inspections (EA Extended) | Language level migration | ::class can be used

Open WinterSilence opened this issue 4 years ago • 3 comments

Subject Details
Plugin Php Inspections (EA Extended) master
Language level PHP 7.2

  1. Your action/fix don't work: string 'CodeIgniter\Filters\DebugToolbar' in namespace CodeIgniter\View converted to DebugToolbar::class
  2. ::class better only if classes in same namespace

WinterSilence avatar Jan 08 '21 23:01 WinterSilence

Thanks for reporting @WinterSilence!

Sounds like expected behavior, we are not really sure what you do you mean by don't work and did testing with this code fragment: https://3v4l.org/OTo07. If you could share an updated code fragment explaining your concerns, that would be very helpful. Thanks!

Out of curiosity, what do you mean by "better only if classes in same namespace"? Asking as mainstream practices are encouraging using the constant over strings.

ea-inspections-team avatar Dec 04 '21 12:12 ea-inspections-team

@ea-inspections-team

don't work

as you planed

your action convert string 'CodeIgniter\Filters\DebugToolbar' in method of class CodeIgniter\View\Render to DebugToolbar::class, but not add use CodeIgniter\Filters\DebugToolbar;, it's generate error because class CodeIgniter\View\DebugToolbar not exists.

WinterSilence avatar Dec 04 '21 16:12 WinterSilence

@WinterSilence could you please provide a piece of code ("before"/working and "after"/not-working)?

rentalhost avatar Dec 04 '21 17:12 rentalhost