Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArrayKeysAndInArrayToArrayKeyExistsRector revmoves variables that are used later #7699

Closed
sreichel opened this issue Jan 1, 2023 · 1 comment
Labels

Comments

@sreichel
Copy link

sreichel commented Jan 1, 2023

Bug Report

Subject Details
Rector version 0.15.2
Rule ArrayKeysAndInArrayToArrayKeyExistsRector

Variables that are used later are ignored.

For example below phpstan now complains about ...

249    Undefined variable: $tableAliases                

Minimal PHP Code Causing Issue

https://getrector.org/demo/85d78e6e-df97-485e-9412-e90550777ee5

Expected Behaviour

Skip it. (in this case)

@sreichel sreichel added the bug label Jan 1, 2023
sreichel added a commit to sreichel/openmage-rector that referenced this issue Jan 2, 2023
sreichel added a commit to sreichel/openmage-rector that referenced this issue Jan 2, 2023
elidrissidev pushed a commit to OpenMage/magento-lts that referenced this issue Jan 2, 2023
* Add "never" return-type for methods that never return anything

- see https://github.com/rectorphp/rector/blob/main/docs/rector_rules_overview.md#returnnevertyperector

* Updated phpstan.dist.baseline.neon

* Added ddev rector command shortcut

* Change array_push() to direct variable assign

- see https://github.com/rectorphp/rector/blob/main/docs/rector_rules_overview.md#changearraypushtoarrayassignrector

* Replace array_keys() and in_array() to array_key_exists()

- see https://github.com/rectorphp/rector/blob/main/docs/rector_rules_overview.md#arraykeysandinarraytoarraykeyexistsrector

* Use common != instead of less known <> with same meaning

- see https://github.com/rectorphp/rector/blob/main/docs/rector_rules_overview.md#commonnotequalrector

* Issue in rector found ...reverted

- see rectorphp/rector#7699

* Updated phpstan.dist.baseline.neon

* Change compact() call to own array

- see https://github.com/rectorphp/rector/blob/main/docs/rector_rules_overview.md#compacttovariablesrector

* Change OR, AND to ||, && with more common understanding

- see https://github.com/rectorphp/rector/blob/main/docs/rector_rules_overview.md#logicaltobooleanrector

* Replace the Double not operator (!!) by type-casting to boolean

- see https://github.com/rectorphp/rector/blob/main/docs/rector_rules_overview.md#replacemultiplebooleannotrector

* Simplify array_search to in_array

- see https://github.com/rectorphp/rector/blob/main/docs/rector_rules_overview.md#simplifyarraysearchrector

* Changes compared to value and return of expr to direct return

- see https://github.com/rectorphp/rector/blob/main/docs/rector_rules_overview.md#simplifyifexactvaluereturnvaluerector

* Updated phpstan.dist.baseline.neon

This error goes and comes ...

* Changes strlen comparison to 0 to direct empty string compare

- see https://github.com/rectorphp/rector/blob/main/docs/rector_rules_overview.md#strlenzerotoidenticalemptystringrector

* Simplify conditions

- see https://github.com/rectorphp/rector/blob/main/docs/rector_rules_overview.md#simplifyconditionsrector

* Simplify tautology ternary to value

- see https://github.com/rectorphp/rector/blob/main/docs/rector_rules_overview.md#simplifytautologyternaryrector

* Splits [$a, $b] = [5, 10] scalar assign to standalone lines

- see https://github.com/rectorphp/rector/blob/main/docs/rector_rules_overview.md#splitlistassigntoseparatelinerector
fballiano pushed a commit to OpenMage/magento-lts that referenced this issue Jan 3, 2023
* Add "never" return-type for methods that never return anything

- see https://github.com/rectorphp/rector/blob/main/docs/rector_rules_overview.md#returnnevertyperector

* Updated phpstan.dist.baseline.neon

* Added ddev rector command shortcut

* Change array_push() to direct variable assign

- see https://github.com/rectorphp/rector/blob/main/docs/rector_rules_overview.md#changearraypushtoarrayassignrector

* Replace array_keys() and in_array() to array_key_exists()

- see https://github.com/rectorphp/rector/blob/main/docs/rector_rules_overview.md#arraykeysandinarraytoarraykeyexistsrector

* Use common != instead of less known <> with same meaning

- see https://github.com/rectorphp/rector/blob/main/docs/rector_rules_overview.md#commonnotequalrector

* Issue in rector found ...reverted

- see rectorphp/rector#7699

* Updated phpstan.dist.baseline.neon

* Change compact() call to own array

- see https://github.com/rectorphp/rector/blob/main/docs/rector_rules_overview.md#compacttovariablesrector

* Change OR, AND to ||, && with more common understanding

- see https://github.com/rectorphp/rector/blob/main/docs/rector_rules_overview.md#logicaltobooleanrector

* Replace the Double not operator (!!) by type-casting to boolean

- see https://github.com/rectorphp/rector/blob/main/docs/rector_rules_overview.md#replacemultiplebooleannotrector

* Simplify array_search to in_array

- see https://github.com/rectorphp/rector/blob/main/docs/rector_rules_overview.md#simplifyarraysearchrector

* Changes compared to value and return of expr to direct return

- see https://github.com/rectorphp/rector/blob/main/docs/rector_rules_overview.md#simplifyifexactvaluereturnvaluerector

* Updated phpstan.dist.baseline.neon

This error goes and comes ...

* Changes strlen comparison to 0 to direct empty string compare

- see https://github.com/rectorphp/rector/blob/main/docs/rector_rules_overview.md#strlenzerotoidenticalemptystringrector

* Simplify conditions

- see https://github.com/rectorphp/rector/blob/main/docs/rector_rules_overview.md#simplifyconditionsrector

* Simplify tautology ternary to value

- see https://github.com/rectorphp/rector/blob/main/docs/rector_rules_overview.md#simplifytautologyternaryrector

* Splits [$a, $b] = [5, 10] scalar assign to standalone lines

- see https://github.com/rectorphp/rector/blob/main/docs/rector_rules_overview.md#splitlistassigntoseparatelinerector
@samsonasik
Copy link
Member

I am closing it as the rule no longer exists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants