Skip to content

Conversation

gharlan
Copy link
Member

@gharlan gharlan commented Aug 16, 2025

It resolves 21 phpstan errors.

@@ -46,7 +46,7 @@
* close: int,
* elements: non-empty-list<_Element>
* }
* @phpstan-type _Element array{token: Token, type: string, index: int, start?: int, end?: int}
* @phpstan-type _Element array{token: Token, type: string, index: int, start: int, end: int}
Copy link
Member Author

Choose a reason for hiding this comment

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

all elements have start and end, when fully created

$element['start'] = $this->getFirstTokenIndexOfClassElement($tokens, $class, $element);
$element['end'] = $this->getLastTokenIndexOfClassElement($tokens, $class, $element, $tokensAnalyzer);
$element['start'] = $this->getFirstTokenIndexOfClassElement($tokens, $class['open'], $index);
$element['end'] = $this->getLastTokenIndexOfClassElement($tokens, $class['index'], $index, $element['type'], $tokensAnalyzer);
Copy link
Member Author

@gharlan gharlan Aug 16, 2025

Choose a reason for hiding this comment

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

at this place start and end are added. so the passed $element isn't fully created yet. That's why I pass now only the element values really needed inside these methods (so I do not have to define a partial _Element shape).

Copy link
Member Author

Choose a reason for hiding this comment

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

same for $class

@coveralls
Copy link

coveralls commented Aug 16, 2025

Coverage Status

coverage: 94.75%. remained the same
when pulling f1b2bb0 on gharlan:class-attributes-separation
into bfb6fc3 on PHP-CS-Fixer:master.

@keradus keradus enabled auto-merge (squash) August 20, 2025 20:59
@keradus
Copy link
Member

keradus commented Aug 20, 2025

nice

@keradus keradus merged commit 239ae3b into PHP-CS-Fixer:master Aug 20, 2025
30 of 31 checks passed
@gharlan gharlan deleted the class-attributes-separation branch August 24, 2025 21:31
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