Skip to content

Conversation

@JohJohan
Copy link
Contributor

@JohJohan JohJohan commented Nov 16, 2022

@JohJohan JohJohan changed the title [SimplifyEmptyCheckOnEmptyArrayRector] Add new rule [SimplifyEmptyCheckOnEmptyArrayRector] Add new rule #7485 Nov 16, 2022
@ghost
Copy link

ghost commented Nov 16, 2022

Fixes rectorphp/rector#7485

[SimplifyEmptyCheckOnEmptyArrayRector] Add new rule 7485
@TomasVotruba
Copy link
Member

Thank you @JohJohan 👏

@TomasVotruba TomasVotruba merged commit 07941b8 into rectorphp:main Nov 16, 2022
@JohJohan JohJohan deleted the 7485 branch November 16, 2022 15:28
@staabm
Copy link
Contributor

staabm commented Nov 16, 2022

thanks for working on it.

I think this PR is missing test-coverage for things like

  • Iterators
  • ArrayObject
  • parameters typed to array via phpdoc, e.g. @param array<int>, @param array<int, string>, @param int[] @param list<int>, @param array{string, int} ,@param array{aKey: string, aThing: int}

?

@samsonasik
Copy link
Member

@staabm this is just for starter, and not registed to config set yet, as considered still risky, like from param, if not typed, that should be skipped via ExprAnalyzer::isNonTypedFromParam()

public function isNonTypedFromParam(Expr $expr): bool

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add rule to improve performance checking on empty array

4 participants