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

Tokens - fix for checking block edges #5597

Merged
merged 1 commit into from
Apr 13, 2021
Merged

Tokens - fix for checking block edges #5597

merged 1 commit into from
Apr 13, 2021

Conversation

kubawerlos
Copy link
Contributor

@kubawerlos kubawerlos commented Apr 5, 2021

Found this when investigating #5533.

This loop was problematic, ) was passed to findBlockEnd and it was returning index of ( and thus loop was infinitive.

See separate commits for better understanding if needed.

@coveralls
Copy link

coveralls commented Apr 5, 2021

Coverage Status

Coverage increased (+0.003%) to 91.854% when pulling eb4a86b on kubawerlos:fix_Tokens into 524b57d on FriendsOfPHP:2.18.

@kubawerlos kubawerlos marked this pull request as ready for review April 5, 2021 21:48
@keradus keradus added this to the 2.18.6 milestone Apr 7, 2021
@@ -50,7 +50,7 @@ class Tokens extends \SplFixedArray
/**
* Cache of block edges. Any change in collection will invalidate it.
*
* @var array<int, int>
* @var array<string, array<int, int>>
*/
private $blockEndCache = [];
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
private $blockEndCache = [];
private $blockEndCache = [
'start_to_end' = [],
'end_to_start' = [],
];

Copy link
Member

Choose a reason for hiding this comment

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

to avoid autovivification. pls fix other places too

@keradus
Copy link
Member

keradus commented Apr 13, 2021

Thank you @kubawerlos.

@keradus keradus merged commit e1a2604 into PHP-CS-Fixer:2.18 Apr 13, 2021
@kubawerlos kubawerlos deleted the fix_Tokens branch April 13, 2021 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants