Skip to content

Suggestion: make isset, unset and empty parenthesis owners #3118

Closed as not planned

Description

@jrfnl

I was just wondering why isset(), unset() and empty() - all language constructs which require parentheses - are not considered parentheses owners.

Would it make sense to change that ? Should be a relatively easy change to make as far as I can see.

Happy to make the changes if there is interest.


[Edit]: Might be useful to include exit(), die() and eval() as well, though these three don't require parentheses, but are "owners" when the parentheses are present.

Activity

  1. gsherwood commented on Sep 21, 2020

    @gsherwood
    Member

    Makes sense to me. For the constructs that don't require parenthesis, just need to make sure they don't go hunting for unowned ones and claiming them, although this may already be protected against.

  2. jrfnl commented on Sep 22, 2020

    @jrfnl
    ContributorAuthor

    For the constructs that don't require parenthesis, just need to make sure they don't go hunting for unowned ones and claiming them, although this may already be protected against.

    Eh.. not really... that's part of the problem with closure T_USE as parenthesis owner for which PR #3104 is open.....

    With that in mind, should this be addressed in PHPCS 3.x or 4.x ? (PR #3104 is for 4.x and includes part of the protection which would need to be added for the above as well.)

  3. jrfnl commented on Dec 2, 2023

    @jrfnl
    ContributorAuthor

    Closing as replaced by PHPCSStandards/PHP_CodeSniffer#23

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions