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

[Transform] Adds the ScalarValueToConstFetchRector rule #6195

Merged
merged 1 commit into from
Aug 12, 2024

Conversation

peterfox
Copy link
Contributor

Changes

  • Adds a new ScalarValueToConstFetchRector rule
  • Adds a value object for configuring ScalarValueToConstFetchRector
  • Adds tests
  • Updates the docs

Why

Feels like a useful rule for removing certain Scalar values within a codebase with a predefined constant.

-$var = 10;
+$var = \SomeClass::FOOBAR_INT;

@peterfox peterfox changed the title Adds the ScalarValueToConstFetchRector rule [Transform] Adds the ScalarValueToConstFetchRector rule Jul 30, 2024
@TomasVotruba
Copy link
Member

@peterfox Thanks for the PR. Could you rebase on latest main? I'll make it shipped then

@samsonasik
Copy link
Member

@peterfox please use rebase instead of merge when possible :), no "Merge remote tracking" commit, I wrote a blog post about it https://samsonasik.wordpress.com/2015/09/16/practical-git-4-rebasing-conflicted-task-branch-against-primary-branch/

@peterfox peterfox force-pushed the feature/scalar-to-constfetch branch from 1edc74c to b0f794a Compare August 12, 2024 20:58
@peterfox
Copy link
Contributor Author

Sorry @samsonasik, force of habit

@samsonasik samsonasik merged commit e4ceb29 into rectorphp:main Aug 12, 2024
35 checks passed
@samsonasik
Copy link
Member

Thank you @peterfox

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.

3 participants