phpinspectionsea icon indicating copy to clipboard operation
phpinspectionsea copied to clipboard

PHP named attributes are not taken into account

Open guerinetn opened this issue 1 year ago • 11 comments

Subject Details
Plugin Php Inspections (EA Ultimate),
Language level PHP 8.2

Current behaviour

If I use a named attributes for a function it's not understood.

If I write :

$token = uniqid(more_entropy: true)

EA raise the error : Please provide 'more_entropy' parameter in order to increase likelihood of uniqueness.

It would be nice, il named attributes are understood by EA because this feature helps a lot when you have a lots of optional parameter to a function.

guerinetn avatar Jan 24 '24 07:01 guerinetn

I confirm the bug. Capture d’écran 2024-01-31 à 08 05 15

COil avatar Jan 31 '24 07:01 COil

Other methods have the same issues e.g. json_decode Screenshot 2024-01-31 at 08 51 24

And it seems to be a duplicate of:

  • https://github.com/kalessil/phpinspectionsea/issues/1639
  • https://github.com/kalessil/phpinspectionsea/issues/1725
  • https://github.com/kalessil/phpinspectionsea/issues/1807
  • https://github.com/kalessil/phpinspectionsea/issues/1845

DannyvdSluijs avatar Jan 31 '24 07:01 DannyvdSluijs

The cause seems to be in this line of code where the arguments length is being checked as greater or equal to 4

I guess if possible the arguments should be checked for the index flags and take that argument

DannyvdSluijs avatar Jan 31 '24 08:01 DannyvdSluijs

@ea-inspections-team: +1 request to address this at least in the mentioned inspections.

kalessil avatar Jan 31 '24 08:01 kalessil

Thank you for reporting @guerinetn.

Question for everyone: are uniqid and json_decode are the only functions which we need to consider for hot-fix release?

ea-inspections-team avatar Feb 04 '24 10:02 ea-inspections-team

Hello @ea-inspections-team at the moment it's the only method with this issues. Thanks for your reply

guerinetn avatar Mar 14 '24 14:03 guerinetn

@ea-inspections-team Is there a reason this open PR https://github.com/kalessil/phpinspectionsea/pull/1815 has not been picked up yet to resolve this issue?

Flexo013 avatar Apr 26 '24 12:04 Flexo013

@ea-inspections-team: +1 request to address this at least in the mentioned inspections.

+1

Elnadrion avatar Jun 10 '24 11:06 Elnadrion

@kalessil I wanted to kindly check with you if this is something @ea-inspections-team is working on?

Perhaps some pointers could be given in order help me (or other people watching this issue) out in trying to create a PR addressing this issue?

DannyvdSluijs avatar Jun 19 '24 12:06 DannyvdSluijs