Skip to content

chore: handle fixer options without allowed types defined#8973

Merged
keradus merged 2 commits intoPHP-CS-Fixer:masterfrom
gharlan:option-allowed-types
Aug 24, 2025
Merged

chore: handle fixer options without allowed types defined#8973
keradus merged 2 commits intoPHP-CS-Fixer:masterfrom
gharlan:option-allowed-types

Conversation

@gharlan
Copy link
Copy Markdown
Member

@gharlan gharlan commented Aug 24, 2025

All of our built-in fixers have defined allowed values or types for their options. But it is not required.

@coveralls
Copy link
Copy Markdown

coveralls commented Aug 24, 2025

Coverage Status

coverage: 94.753% (+0.002%) from 94.751%
when pulling ebd4265 on gharlan:option-allowed-types
into fe0cefc on PHP-CS-Fixer:master.

} else {
$allowedKind = 'Allowed values';
$allowed = array_map(static fn ($value): string => $value instanceof AllowedValueSubset
? 'a subset of ``'.Utils::toString($value->getAllowedValues()).'``'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

should we handle same for allowed values?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

null === $option->getAllowedValues() is checked in line 169 (implicitly).

And getAllowedValues method of AllowedValueSubset cannot return null.

@keradus keradus enabled auto-merge (squash) August 24, 2025 21:48
@keradus keradus merged commit 002c527 into PHP-CS-Fixer:master Aug 24, 2025
31 checks passed
@gharlan gharlan deleted the option-allowed-types branch September 12, 2025 16: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