feat: HeaderCommentFixer - allow validators#8452
Merged
kubawerlos merged 9 commits intoPHP-CS-Fixer:masterfrom Feb 21, 2025
Merged
feat: HeaderCommentFixer - allow validators#8452kubawerlos merged 9 commits intoPHP-CS-Fixer:masterfrom
HeaderCommentFixer - allow validators#8452kubawerlos merged 9 commits intoPHP-CS-Fixer:masterfrom
Conversation
HeaderCommentFixer - allow validators
kubawerlos
reviewed
Feb 21, 2025
| (new FixerOptionBuilder('validator', 'RegEx validator for header content.')) | ||
| ->setAllowedTypes(['string', 'null']) | ||
| ->setNormalizer(static function (Options $options, ?string $value) use ($fixerName): ?string { | ||
| if (null !== $value && !str_starts_with($value, '/')) { |
Member
There was a problem hiding this comment.
What about simply:
try {
Preg::match($value, '');
} catch (PregException $exception) {
throw new InvalidFixerConfigurationException($fixerName, 'Regex is invalido:' . $exception->getMessage());
}
kubawerlos
approved these changes
Feb 21, 2025
fabpot
added a commit
to symfony/symfony
that referenced
this pull request
Feb 24, 2025
This PR was squashed before being merged into the 7.3 branch. Discussion ---------- chore: PHP CS Fixer - allow header validator | Q | A | ------------- | --- | Branch? | 7.3 | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Issues | Fixer config | License | MIT ~so `php-cs-fixer check --diff src/Symfony/Component/HttpKernel/HttpCache/Store.php` doesn't complain (on header rule)~ so `php-cs-fixer check --diff` doesn't complain (on header rule) based on PHP-CS-Fixer/PHP-CS-Fixer#8452 **Requires PHP CS Fixer ^3.70** Commits ------- 20f00d5 chore: PHP CS Fixer - allow header validator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
needed for symfony/symfony#59823