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

Refactor RegexGroupParser for more immutability and less pass-by-ref #3508

Merged
merged 2 commits into from
Oct 6, 2024

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Sep 27, 2024

less magic, less error prone

Part 2

@staabm staabm marked this pull request as ready for review September 27, 2024 12:54
@phpstan-bot
Copy link
Collaborator

This pull request has been marked as ready for review.

@staabm
Copy link
Contributor Author

staabm commented Sep 27, 2024

//cc @mvorisek lets wait until a few of the open Regex-inference PRs are merged so we don't step on each others toes

{
return new self(
-1,
100,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know you moved the code only, but why 100?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the initial implementation there we so many arrays involved, that I used a different start-index to trigger php warnings in case I mixed up the keys between different arrays ;)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add a comment into the code

);
}

public function nextAlternationId(): self
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

name it better, it does not return int

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it returns a "copy" of the current object, which contains the next alternation id.

I think the name fits.

@ondrejmirtes ondrejmirtes merged commit 83ba597 into phpstan:1.12.x Oct 6, 2024
481 of 499 checks passed
@ondrejmirtes
Copy link
Member

Thank you.

@staabm staabm deleted the refa branch October 6, 2024 14:33
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.

4 participants