-
Notifications
You must be signed in to change notification settings - Fork 148
[CLEANUP] Clean extra whitespace in css selector #1398
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
base: main
Are you sure you want to change the base?
Changes from 3 commits
1806b17
1c035a1
86ba52b
b5eaeea
04c34f8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -141,4 +141,29 @@ public function isValidForInvalidSelectorReturnsFalse(string $selector): void | |||||
| { | ||||||
| self::assertFalse(Selector::isValid($selector)); | ||||||
| } | ||||||
|
|
||||||
| /** | ||||||
| * @test | ||||||
| */ | ||||||
| public function cleanupSpacesWithinSelector(): void | ||||||
|
||||||
| public function cleanupSpacesWithinSelector(): void | |
| public function cleansUpSpacesWithinSelector(): void |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't use heredoc - indented heredoc doesn't work with with PHP 7.2 (though it works with 7.3 upwards), and it makes autoformatting the code more of a hassle.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead, could you please switch to a literal, quotes-enclosed string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for bringing this to my attention, it's fixed.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| public function doNotCleanupSpacesWithinAttributeSelector(): void | |
| public function doesNotCleanupSpacesWithinAttributeSelector(): void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
\sneeds double-escaping (it does technically work single-escaped, but fails a coding style check).We could also convert any whitespace to an actual space - e.g. a single newline, tab, etc. - and have a test for that too.
And for better performance (and to avoid catastrophic backtracking in the unlikely case of a selector string with a million spaces being passed), we can use the possessive quantifier (
+).