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

fix: assert_line_count on multiline #265

Merged
merged 4 commits into from
Jun 18, 2024
Merged

Conversation

Chemaclass
Copy link
Member

@Chemaclass Chemaclass commented Jun 18, 2024

📚 Description

Issue: phpstan/phpstan-src#3160 (comment)

Multiline strings are passes as multiple args to assert_line_count which makes it complicated to pass around and manipulate as unique string.

🔖 Changes

  • assert_line_count uses first arg for the expected and the rest (think about a variadic ...string arg) will be the string itself that will be use to count its lines.

💡 Extra

Tradeoff: I had to rollback #262 in order to make it working. I think I can make it back again, but it might take another couple of hours... so, I thought to ship this first, make it work, and then in a follow up make it better.

@Chemaclass Chemaclass force-pushed the fix/assert-line-count-2 branch from 28e0735 to 4925501 Compare June 18, 2024 11:53
@@ -318,8 +318,9 @@ function assert_greater_or_equal_than() {

function assert_line_count() {
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel sorry for opening this can of worms :-).

thanks for working thru all these problem.

Copy link
Member Author

Choose a reason for hiding this comment

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

You opened a pandora box... nah, it is also fun - even though I really dislike bash 😝

Copy link
Contributor

Choose a reason for hiding this comment

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

"you just need to count the lines" - they said

@Chemaclass Chemaclass requested a review from staabm June 18, 2024 14:12
@Chemaclass Chemaclass merged commit 6ee04d3 into main Jun 18, 2024
7 checks passed
@Chemaclass Chemaclass deleted the fix/assert-line-count-2 branch June 18, 2024 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants