repo
stringlengths
7
63
file_url
stringlengths
81
284
file_path
stringlengths
5
200
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:02:33
2026-01-05 05:24:06
truncated
bool
2 classes
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PSR12RiskySet.php
src/RuleSet/Sets/PSR12RiskySet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractRuleSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PSR12RiskySet extends AbstractRuleSetDefinition { public function getRules(): array { return [ 'no_trailing_whitespace_in_string' => true, 'no_unreachable_default_argument_value' => true, ]; } public function getDescription(): string { return 'Rules that follow `PSR-12 <https://www.php-fig.org/psr/psr-12/>`_ standard.'; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHPUnit54MigrationRiskySet.php
src/RuleSet/Sets/PHPUnit54MigrationRiskySet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractMajorMinorDeprecationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHPUnit54MigrationRiskySet extends AbstractMajorMinorDeprecationSetDefinition {}
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHPUnit5x5MigrationRiskySet.php
src/RuleSet/Sets/PHPUnit5x5MigrationRiskySet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\Fixer\PhpUnit\PhpUnitTargetVersion; use PhpCsFixer\RuleSet\AbstractMigrationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHPUnit5x5MigrationRiskySet extends AbstractMigrationSetDefinition { public function getRules(): array { return [ '@PHPUnit5x4Migration:risky' => true, 'php_unit_mock' => [ 'target' => PhpUnitTargetVersion::VERSION_5_5, ], ]; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PERCS30RiskySet.php
src/RuleSet/Sets/PERCS30RiskySet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractRuleSetDefinition; use PhpCsFixer\RuleSet\DeprecatedRuleSetDefinitionInterface; use PhpCsFixer\RuleSet\RuleSetDefinitionInterface; /** * @internal * * PER Coding Style v3.0. * * @see https://github.com/php-fig/per-coding-style/blob/3.0.0/spec.md * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PERCS30RiskySet extends AbstractRuleSetDefinition implements DeprecatedRuleSetDefinitionInterface { public function getName(): string { return '@PER-CS3.0:risky'; } public function getRules(): array { return $this->getProxiedSet()->getRules(); } public function getDescription(): string { return $this->getProxiedSet()->getDescription(); } public function getSuccessorsNames(): array { return [$this->getProxiedSet()->getName()]; } private function getProxiedSet(): RuleSetDefinitionInterface { return new PERCS3x0RiskySet(); } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHP7x4MigrationSet.php
src/RuleSet/Sets/PHP7x4MigrationSet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractMigrationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHP7x4MigrationSet extends AbstractMigrationSetDefinition { public function getRules(): array { return [ '@PHP7x3Migration' => true, 'assign_null_coalescing_to_coalesce_equal' => true, 'normalize_index_brace' => true, 'short_scalar_cast' => true, ]; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHPUnit84MigrationRiskySet.php
src/RuleSet/Sets/PHPUnit84MigrationRiskySet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractMajorMinorDeprecationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHPUnit84MigrationRiskySet extends AbstractMajorMinorDeprecationSetDefinition {}
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHPUnit9x1MigrationRiskySet.php
src/RuleSet/Sets/PHPUnit9x1MigrationRiskySet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractMigrationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHPUnit9x1MigrationRiskySet extends AbstractMigrationSetDefinition { public function getRules(): array { return [ '@PHPUnit8x4Migration:risky' => true, 'php_unit_assert_new_names' => true, ]; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHP80MigrationRiskySet.php
src/RuleSet/Sets/PHP80MigrationRiskySet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractMajorMinorDeprecationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHP80MigrationRiskySet extends AbstractMajorMinorDeprecationSetDefinition {}
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHPUnit30MigrationRiskySet.php
src/RuleSet/Sets/PHPUnit30MigrationRiskySet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractMajorMinorDeprecationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHPUnit30MigrationRiskySet extends AbstractMajorMinorDeprecationSetDefinition {}
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHPUnit5x4MigrationRiskySet.php
src/RuleSet/Sets/PHPUnit5x4MigrationRiskySet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\Fixer\PhpUnit\PhpUnitTargetVersion; use PhpCsFixer\RuleSet\AbstractMigrationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHPUnit5x4MigrationRiskySet extends AbstractMigrationSetDefinition { public function getRules(): array { return [ '@PHPUnit5x2Migration:risky' => true, 'php_unit_mock' => [ 'target' => PhpUnitTargetVersion::VERSION_5_4, ], ]; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PERCS20RiskySet.php
src/RuleSet/Sets/PERCS20RiskySet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractRuleSetDefinition; use PhpCsFixer\RuleSet\DeprecatedRuleSetDefinitionInterface; use PhpCsFixer\RuleSet\RuleSetDefinitionInterface; /** * @internal * * PER Coding Style v2.0. * * @see https://github.com/php-fig/per-coding-style/blob/2.0.0/spec.md * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PERCS20RiskySet extends AbstractRuleSetDefinition implements DeprecatedRuleSetDefinitionInterface { public function getName(): string { return '@PER-CS2.0:risky'; } public function getRules(): array { return $this->getProxiedSet()->getRules(); } public function getDescription(): string { return $this->getProxiedSet()->getDescription(); } public function getSuccessorsNames(): array { return [$this->getProxiedSet()->getName()]; } private function getProxiedSet(): RuleSetDefinitionInterface { return new PERCS2x0RiskySet(); } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHP71MigrationRiskySet.php
src/RuleSet/Sets/PHP71MigrationRiskySet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractMajorMinorDeprecationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHP71MigrationRiskySet extends AbstractMajorMinorDeprecationSetDefinition {}
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHPUnit10x0MigrationRiskySet.php
src/RuleSet/Sets/PHPUnit10x0MigrationRiskySet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractMigrationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHPUnit10x0MigrationRiskySet extends AbstractMigrationSetDefinition { public function getRules(): array { return [ '@PHPUnit9x1Migration:risky' => true, 'php_unit_data_provider_static' => ['force' => true], ]; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHP8x2MigrationSet.php
src/RuleSet/Sets/PHP8x2MigrationSet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractMigrationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHP8x2MigrationSet extends AbstractMigrationSetDefinition { public function getRules(): array { return [ '@PHP8x1Migration' => true, 'simple_to_complex_string_variable' => true, ]; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHP8x4MigrationRiskySet.php
src/RuleSet/Sets/PHP8x4MigrationRiskySet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractMigrationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHP8x4MigrationRiskySet extends AbstractMigrationSetDefinition { public function getRules(): array { return [ '@PHP8x3Migration:risky' => true, ]; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHP56MigrationRiskySet.php
src/RuleSet/Sets/PHP56MigrationRiskySet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractMajorMinorDeprecationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHP56MigrationRiskySet extends AbstractMajorMinorDeprecationSetDefinition {}
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHPUnit91MigrationRiskySet.php
src/RuleSet/Sets/PHPUnit91MigrationRiskySet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractMajorMinorDeprecationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHPUnit91MigrationRiskySet extends AbstractMajorMinorDeprecationSetDefinition {}
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHPUnit5x7MigrationRiskySet.php
src/RuleSet/Sets/PHPUnit5x7MigrationRiskySet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\Fixer\PhpUnit\PhpUnitTargetVersion; use PhpCsFixer\RuleSet\AbstractMigrationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHPUnit5x7MigrationRiskySet extends AbstractMigrationSetDefinition { public function getRules(): array { return [ '@PHPUnit5x6Migration:risky' => true, 'php_unit_namespaced' => [ 'target' => PhpUnitTargetVersion::VERSION_5_7, ], ]; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PERSet.php
src/RuleSet/Sets/PERSet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractRuleSetDefinition; use PhpCsFixer\RuleSet\DeprecatedRuleSetDefinitionInterface; /** * @internal * * @deprecated use `@PER-CS` instead * * @TODO 4.0 remove me * * Last updated to PER Coding Style v2.0. * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PERSet extends AbstractRuleSetDefinition implements DeprecatedRuleSetDefinitionInterface { public function getRules(): array { return [ '@PER-CS' => true, ]; } public function getDescription(): string { return 'Alias for the newest ``PER-CS`` rules. It is recommended you use ``@PER-CS3.0`` instead if you want to stick with stable ruleset.'; } public function getSuccessorsNames(): array { return ['@PER-CS']; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHP82MigrationRiskySet.php
src/RuleSet/Sets/PHP82MigrationRiskySet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractMajorMinorDeprecationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHP82MigrationRiskySet extends AbstractMajorMinorDeprecationSetDefinition {}
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHP7x0MigrationRiskySet.php
src/RuleSet/Sets/PHP7x0MigrationRiskySet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractMigrationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHP7x0MigrationRiskySet extends AbstractMigrationSetDefinition { public function getRules(): array { return [ '@PHP5x6Migration:risky' => true, 'combine_nested_dirname' => true, 'declare_strict_types' => true, 'non_printable_character' => true, 'random_api_migration' => [ 'replacements' => [ 'mt_rand' => 'random_int', 'rand' => 'random_int', ], ], ]; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHPUnit48MigrationRiskySet.php
src/RuleSet/Sets/PHPUnit48MigrationRiskySet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractMajorMinorDeprecationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHPUnit48MigrationRiskySet extends AbstractMajorMinorDeprecationSetDefinition {}
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHP73MigrationSet.php
src/RuleSet/Sets/PHP73MigrationSet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractMajorMinorDeprecationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHP73MigrationSet extends AbstractMajorMinorDeprecationSetDefinition {}
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHPUnit8x4MigrationRiskySet.php
src/RuleSet/Sets/PHPUnit8x4MigrationRiskySet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\Fixer\PhpUnit\PhpUnitTargetVersion; use PhpCsFixer\RuleSet\AbstractMigrationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHPUnit8x4MigrationRiskySet extends AbstractMigrationSetDefinition { public function getRules(): array { return [ '@PHPUnit7x5Migration:risky' => true, 'php_unit_expectation' => [ 'target' => PhpUnitTargetVersion::VERSION_8_4, ], ]; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHPUnit52MigrationRiskySet.php
src/RuleSet/Sets/PHPUnit52MigrationRiskySet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractMajorMinorDeprecationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHPUnit52MigrationRiskySet extends AbstractMajorMinorDeprecationSetDefinition {}
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHP80MigrationSet.php
src/RuleSet/Sets/PHP80MigrationSet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractMajorMinorDeprecationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHP80MigrationSet extends AbstractMajorMinorDeprecationSetDefinition {}
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PERRiskySet.php
src/RuleSet/Sets/PERRiskySet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractRuleSetDefinition; use PhpCsFixer\RuleSet\DeprecatedRuleSetDefinitionInterface; /** * @internal * * @deprecated use `@PER-CS:risky` instead * * @TODO 4.0 remove me * * Last updated to PER Coding Style v2.0. * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PERRiskySet extends AbstractRuleSetDefinition implements DeprecatedRuleSetDefinitionInterface { public function getName(): string { return '@PER:risky'; } public function getRules(): array { return [ '@PER-CS:risky' => true, ]; } public function getDescription(): string { return 'Alias for the newest ``PER-CS`` risky rules. It is recommended you use ``@PER-CS2.0:risky`` instead if you want to stick with stable ruleset.'; } public function getSuccessorsNames(): array { return ['@PER-CS:risky']; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHP8x5MigrationRiskySet.php
src/RuleSet/Sets/PHP8x5MigrationRiskySet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractMigrationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHP8x5MigrationRiskySet extends AbstractMigrationSetDefinition { public function getRules(): array { return [ '@PHP8x4Migration:risky' => true, ]; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHP8x3MigrationSet.php
src/RuleSet/Sets/PHP8x3MigrationSet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractMigrationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHP8x3MigrationSet extends AbstractMigrationSetDefinition { public function getRules(): array { return [ '@PHP8x2Migration' => true, ]; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PERCS3x0Set.php
src/RuleSet/Sets/PERCS3x0Set.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractRuleSetDefinition; /** * @internal * * PER Coding Style v3.0. * * @see https://github.com/php-fig/per-coding-style/blob/3.0.0/spec.md * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PERCS3x0Set extends AbstractRuleSetDefinition { public function getName(): string { return '@PER-CS3x0'; } public function getRules(): array { return [ '@PER-CS2x0' => true, 'nullable_type_declaration' => true, 'operator_linebreak' => true, 'ordered_types' => [ 'null_adjustment' => 'always_last', 'sort_algorithm' => 'none', ], 'single_class_element_per_statement' => true, 'types_spaces' => true, ]; } public function getDescription(): string { return 'Rules that follow `PER Coding Style 3.0 <https://www.php-fig.org/per/coding-style/>`_.'; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/SymfonySet.php
src/RuleSet/Sets/SymfonySet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\Fixer\Phpdoc\PhpdocSeparationFixer; use PhpCsFixer\RuleSet\AbstractRuleSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class SymfonySet extends AbstractRuleSetDefinition { public function getRules(): array { return [ '@PER-CS3x0' => true, 'align_multiline_comment' => true, 'backtick_to_shell_exec' => true, 'binary_operator_spaces' => true, 'blank_line_before_statement' => [ 'statements' => [ 'return', ], ], 'braces_position' => [ 'allow_single_line_anonymous_functions' => true, 'allow_single_line_empty_anonymous_classes' => true, ], 'class_attributes_separation' => [ 'elements' => [ 'method' => 'one', ], ], 'class_definition' => [ 'single_line' => true, ], 'class_reference_name_casing' => true, 'clean_namespace' => true, 'concat_space' => true, // overrides @PER-CS2.0 'declare_parentheses' => true, 'echo_tag_syntax' => true, 'empty_loop_body' => ['style' => 'braces'], 'empty_loop_condition' => true, 'fully_qualified_strict_types' => true, 'function_declaration' => [ // overrides @PER-CS2.0 'closure_fn_spacing' => 'one', // @TODO: default value of this option changed, consider to switch to new default ], 'general_phpdoc_tag_rename' => [ 'replacements' => [ 'inheritDocs' => 'inheritDoc', ], ], 'global_namespace_import' => [ 'import_classes' => false, 'import_constants' => false, 'import_functions' => false, ], 'include' => true, 'increment_style' => true, 'integer_literal_case' => true, 'lambda_not_used_import' => true, 'linebreak_after_opening_tag' => true, 'magic_constant_casing' => true, 'magic_method_casing' => true, 'method_argument_space' => [ // overrides @PER-CS2.0 'after_heredoc' => true, 'on_multiline' => 'ignore', ], 'native_function_casing' => true, 'native_type_declaration_casing' => true, 'no_alias_language_construct_call' => true, 'no_alternative_syntax' => true, 'no_binary_string' => true, 'no_blank_lines_after_phpdoc' => true, 'no_empty_comment' => true, 'no_empty_phpdoc' => true, 'no_empty_statement' => true, 'no_extra_blank_lines' => [ 'tokens' => [ 'attribute', 'case', 'continue', 'curly_brace_block', 'default', 'extra', 'parenthesis_brace_block', 'square_brace_block', 'switch', 'throw', 'use', ], ], 'no_leading_namespace_whitespace' => true, 'no_mixed_echo_print' => true, 'no_multiline_whitespace_around_double_arrow' => true, 'no_null_property_initialization' => true, 'no_short_bool_cast' => true, 'no_singleline_whitespace_before_semicolons' => true, 'no_spaces_around_offset' => true, 'no_superfluous_phpdoc_tags' => [ 'allow_hidden_params' => true, 'remove_inheritdoc' => true, ], 'no_trailing_comma_in_singleline' => true, 'no_unneeded_braces' => [ 'namespaces' => true, ], 'no_unneeded_control_parentheses' => [ 'statements' => [ 'break', 'clone', 'continue', 'echo_print', 'others', 'return', 'switch_case', 'yield', 'yield_from', ], ], 'no_unneeded_import_alias' => true, 'no_unset_cast' => true, 'no_unused_imports' => true, 'no_useless_concat_operator' => true, 'no_useless_nullsafe_operator' => true, 'no_whitespace_before_comma_in_array' => ['after_heredoc' => true], 'normalize_index_brace' => true, 'nullable_type_declaration_for_default_null_value' => true, 'object_operator_without_whitespace' => true, 'operator_linebreak' => [ 'only_booleans' => true, ], 'ordered_imports' => [ 'imports_order' => [ 'class', 'function', 'const', ], 'sort_algorithm' => 'alpha', ], 'php_unit_fqcn_annotation' => true, 'php_unit_method_casing' => true, 'phpdoc_align' => true, 'phpdoc_annotation_without_dot' => true, 'phpdoc_indent' => true, 'phpdoc_inline_tag_normalizer' => true, 'phpdoc_no_access' => true, 'phpdoc_no_alias_tag' => [ 'replacements' => [ 'const' => 'var', // @TODO 4.0 add to @PhpdocNoAliasTagFixer defaults 'link' => 'see', 'property-read' => 'property', 'property-write' => 'property', 'type' => 'var', ], ], 'phpdoc_no_package' => true, 'phpdoc_no_useless_inheritdoc' => true, 'phpdoc_order' => [ 'order' => [ 'param', 'return', 'throws', ], ], 'phpdoc_return_self_reference' => true, 'phpdoc_scalar' => [ 'types' => [ // @TODO v4 drop custom config with => true, as v4 defaults are same 'boolean', 'callback', 'double', 'integer', 'never-return', 'never-returns', 'no-return', 'real', 'str', ], ], 'phpdoc_separation' => [ 'groups' => [ ['Annotation', 'NamedArgumentConstructor', 'Target'], ...PhpdocSeparationFixer::OPTION_GROUPS_DEFAULT, ], 'skip_unlisted_annotations' => false, // @TODO: default value of this option changed, consider to switch to new default ], 'phpdoc_single_line_var_spacing' => true, 'phpdoc_summary' => true, 'phpdoc_tag_type' => [ 'tags' => [ 'inheritDoc' => 'inline', ], ], 'phpdoc_to_comment' => [ 'allow_before_return_statement' => false, // @TODO: default value of this option changed, consider to switch to new default ], 'phpdoc_trim' => true, 'phpdoc_trim_consecutive_blank_line_separation' => true, 'phpdoc_types' => true, 'phpdoc_types_order' => [ 'null_adjustment' => 'always_last', 'sort_algorithm' => 'none', ], 'phpdoc_var_annotation_correct_order' => true, 'phpdoc_var_without_name' => true, 'semicolon_after_instruction' => true, 'simple_to_complex_string_variable' => true, 'single_import_per_statement' => true, 'single_line_comment_spacing' => true, 'single_line_comment_style' => [ 'comment_types' => [ 'hash', ], ], 'single_line_empty_body' => false, // overrides @PER-CS2.0 'single_line_throw' => true, 'single_quote' => true, 'single_space_around_construct' => true, 'space_after_semicolon' => [ 'remove_in_empty_for_expressions' => true, ], 'standardize_increment' => true, 'standardize_not_equals' => true, 'statement_indentation' => [ 'stick_comment_to_next_continuous_control_statement' => true, ], 'switch_continue_to_break' => true, 'trailing_comma_in_multiline' => [ 'after_heredoc' => true, 'elements' => [ // explicitly omit 'arguments' 'array_destructuring', 'arrays', 'match', 'parameters', ], ], 'trim_array_spaces' => true, 'type_declaration_spaces' => [ 'elements' => ['function', 'property'], // @TODO v4.0 and before consider to add 'constant' (default value) ], 'unary_operator_spaces' => true, 'whitespace_after_comma_in_array' => true, 'yoda_style' => true, ]; } public function getDescription(): string { return 'Rules that follow the official `Symfony Coding Standards <https://symfony.com/doc/current/contributing/code/standards.html>`_. Extends ``@PER-CS``.'; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHP5x6MigrationRiskySet.php
src/RuleSet/Sets/PHP5x6MigrationRiskySet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractMigrationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHP5x6MigrationRiskySet extends AbstractMigrationSetDefinition { public function getRules(): array { return [ 'pow_to_exponentiation' => true, ]; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PSR1Set.php
src/RuleSet/Sets/PSR1Set.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractRuleSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PSR1Set extends AbstractRuleSetDefinition { public function getRules(): array { return [ 'encoding' => true, 'full_opening_tag' => true, ]; } public function getDescription(): string { return 'Rules that follow `PSR-1 <https://www.php-fig.org/psr/psr-1/>`_ standard.'; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/SymfonyRiskySet.php
src/RuleSet/Sets/SymfonyRiskySet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractRuleSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class SymfonyRiskySet extends AbstractRuleSetDefinition { public function getRules(): array { return [ '@PHP5x6Migration:risky' => true, '@PSR12:risky' => true, 'array_push' => true, 'combine_nested_dirname' => true, 'dir_constant' => true, 'ereg_to_preg' => true, 'error_suppression' => true, 'fopen_flag_order' => true, 'fopen_flags' => [ 'b_mode' => false, ], 'function_to_constant' => true, 'get_class_to_class_keyword' => true, 'implode_call' => true, 'is_null' => true, 'logical_operators' => true, 'long_to_shorthand_operator' => true, 'modernize_strpos' => true, 'modernize_types_casting' => true, 'native_constant_invocation' => ['strict' => false], 'native_function_invocation' => [ 'include' => [ '@compiler_optimized', ], 'scope' => 'namespaced', 'strict' => true, ], 'no_alias_functions' => true, 'no_homoglyph_names' => true, 'no_php4_constructor' => true, 'no_trailing_whitespace_in_string' => false, // override PER-CS 'no_unneeded_final_method' => true, 'no_useless_sprintf' => true, 'non_printable_character' => true, 'ordered_traits' => true, 'php_unit_construct' => true, 'php_unit_mock_short_will_return' => true, 'php_unit_set_up_tear_down_visibility' => true, 'php_unit_test_annotation' => true, 'psr_autoloading' => true, 'self_accessor' => true, 'set_type_to_cast' => true, 'string_length_to_empty' => true, 'string_line_ending' => true, 'ternary_to_elvis_operator' => true, ]; } public function getDescription(): string { return 'Rules that follow the official `Symfony Coding Standards <https://symfony.com/doc/current/contributing/code/standards.html>`_. Extends ``@PER-CS:risky``.'; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHP70MigrationSet.php
src/RuleSet/Sets/PHP70MigrationSet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractMajorMinorDeprecationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHP70MigrationSet extends AbstractMajorMinorDeprecationSetDefinition {}
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHP8x0MigrationSet.php
src/RuleSet/Sets/PHP8x0MigrationSet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractMigrationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHP8x0MigrationSet extends AbstractMigrationSetDefinition { public function getRules(): array { return [ '@PHP7x4Migration' => true, 'clean_namespace' => true, 'no_unset_cast' => true, ]; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHP7x0MigrationSet.php
src/RuleSet/Sets/PHP7x0MigrationSet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractMigrationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHP7x0MigrationSet extends AbstractMigrationSetDefinition { public function getRules(): array { return [ '@PHP5x4Migration' => true, 'ternary_to_null_coalescing' => true, ]; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHP8x1MigrationRiskySet.php
src/RuleSet/Sets/PHP8x1MigrationRiskySet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractMigrationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHP8x1MigrationRiskySet extends AbstractMigrationSetDefinition { public function getRules(): array { return [ '@PHP8x0Migration:risky' => true, ]; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHPUnit5x6MigrationRiskySet.php
src/RuleSet/Sets/PHPUnit5x6MigrationRiskySet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\Fixer\PhpUnit\PhpUnitTargetVersion; use PhpCsFixer\RuleSet\AbstractMigrationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHPUnit5x6MigrationRiskySet extends AbstractMigrationSetDefinition { public function getRules(): array { return [ '@PHPUnit5x5Migration:risky' => true, 'php_unit_dedicate_assert' => [ 'target' => PhpUnitTargetVersion::VERSION_5_6, ], 'php_unit_expectation' => [ 'target' => PhpUnitTargetVersion::VERSION_5_6, ], ]; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHPUnit6x0MigrationRiskySet.php
src/RuleSet/Sets/PHPUnit6x0MigrationRiskySet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\Fixer\PhpUnit\PhpUnitTargetVersion; use PhpCsFixer\RuleSet\AbstractMigrationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHPUnit6x0MigrationRiskySet extends AbstractMigrationSetDefinition { public function getRules(): array { return [ '@PHPUnit5x7Migration:risky' => true, 'php_unit_namespaced' => [ 'target' => PhpUnitTargetVersion::VERSION_6_0, ], ]; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHP74MigrationRiskySet.php
src/RuleSet/Sets/PHP74MigrationRiskySet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractMajorMinorDeprecationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHP74MigrationRiskySet extends AbstractMajorMinorDeprecationSetDefinition {}
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHPUnit75MigrationRiskySet.php
src/RuleSet/Sets/PHPUnit75MigrationRiskySet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractMajorMinorDeprecationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHPUnit75MigrationRiskySet extends AbstractMajorMinorDeprecationSetDefinition {}
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHP82MigrationSet.php
src/RuleSet/Sets/PHP82MigrationSet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractMajorMinorDeprecationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHP82MigrationSet extends AbstractMajorMinorDeprecationSetDefinition {}
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHPUnit5x2MigrationRiskySet.php
src/RuleSet/Sets/PHPUnit5x2MigrationRiskySet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\Fixer\PhpUnit\PhpUnitTargetVersion; use PhpCsFixer\RuleSet\AbstractMigrationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHPUnit5x2MigrationRiskySet extends AbstractMigrationSetDefinition { public function getRules(): array { return [ '@PHPUnit5x0Migration:risky' => true, 'php_unit_expectation' => [ 'target' => PhpUnitTargetVersion::VERSION_5_2, ], ]; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHPUnit100MigrationRiskySet.php
src/RuleSet/Sets/PHPUnit100MigrationRiskySet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractMajorMinorDeprecationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHPUnit100MigrationRiskySet extends AbstractMajorMinorDeprecationSetDefinition {}
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHPUnit43MigrationRiskySet.php
src/RuleSet/Sets/PHPUnit43MigrationRiskySet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractMajorMinorDeprecationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHPUnit43MigrationRiskySet extends AbstractMajorMinorDeprecationSetDefinition {}
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PERCS3x0RiskySet.php
src/RuleSet/Sets/PERCS3x0RiskySet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractRuleSetDefinition; /** * @internal * * PER Coding Style v3.0. * * @see https://github.com/php-fig/per-coding-style/blob/3.0.0/spec.md * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PERCS3x0RiskySet extends AbstractRuleSetDefinition { public function getName(): string { return '@PER-CS3x0:risky'; } public function getRules(): array { return [ '@PER-CS2x0:risky' => true, ]; } public function getDescription(): string { return 'Rules that follow `PER Coding Style 3.0 <https://www.php-fig.org/per/coding-style/>`_.'; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHPUnit56MigrationRiskySet.php
src/RuleSet/Sets/PHPUnit56MigrationRiskySet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractMajorMinorDeprecationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHPUnit56MigrationRiskySet extends AbstractMajorMinorDeprecationSetDefinition {}
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PERCS10Set.php
src/RuleSet/Sets/PERCS10Set.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractRuleSetDefinition; use PhpCsFixer\RuleSet\DeprecatedRuleSetDefinitionInterface; use PhpCsFixer\RuleSet\RuleSetDefinitionInterface; /** * @internal * * PER Coding Style v1.0. * * @see https://github.com/php-fig/per-coding-style/blob/1.0.0/spec.md * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PERCS10Set extends AbstractRuleSetDefinition implements DeprecatedRuleSetDefinitionInterface { public function getName(): string { return '@PER-CS1.0'; } public function getRules(): array { return $this->getProxiedSet()->getRules(); } public function getDescription(): string { return $this->getProxiedSet()->getDescription(); } public function getSuccessorsNames(): array { return [$this->getProxiedSet()->getName()]; } private function getProxiedSet(): RuleSetDefinitionInterface { return new PERCS1x0Set(); } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHP8x0MigrationRiskySet.php
src/RuleSet/Sets/PHP8x0MigrationRiskySet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractMigrationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHP8x0MigrationRiskySet extends AbstractMigrationSetDefinition { public function getRules(): array { return [ '@PHP7x4Migration:risky' => true, 'get_class_to_class_keyword' => true, 'modernize_strpos' => true, 'no_alias_functions' => [ 'sets' => [ '@all', ], ], 'no_php4_constructor' => true, 'no_unneeded_final_method' => true, // final private method (not constructor) are no longer allowed >= PHP8.0 'no_unreachable_default_argument_value' => true, ]; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHP84MigrationSet.php
src/RuleSet/Sets/PHP84MigrationSet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractMajorMinorDeprecationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHP84MigrationSet extends AbstractMajorMinorDeprecationSetDefinition {}
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PERCS30Set.php
src/RuleSet/Sets/PERCS30Set.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractRuleSetDefinition; use PhpCsFixer\RuleSet\DeprecatedRuleSetDefinitionInterface; use PhpCsFixer\RuleSet\RuleSetDefinitionInterface; /** * @internal * * PER Coding Style v3.0. * * @see https://github.com/php-fig/per-coding-style/blob/3.0.0/spec.md * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PERCS30Set extends AbstractRuleSetDefinition implements DeprecatedRuleSetDefinitionInterface { public function getName(): string { return '@PER-CS3.0'; } public function getRules(): array { return $this->getProxiedSet()->getRules(); } public function getDescription(): string { return $this->getProxiedSet()->getDescription(); } public function getSuccessorsNames(): array { return [$this->getProxiedSet()->getName()]; } private function getProxiedSet(): RuleSetDefinitionInterface { return new PERCS3x0Set(); } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHP8x5MigrationSet.php
src/RuleSet/Sets/PHP8x5MigrationSet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractMigrationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHP8x5MigrationSet extends AbstractMigrationSetDefinition { public function getRules(): array { return [ '@PHP8x4Migration' => true, 'switch_case_semicolon_to_colon' => true, ]; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHP85MigrationSet.php
src/RuleSet/Sets/PHP85MigrationSet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractMajorMinorDeprecationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHP85MigrationSet extends AbstractMajorMinorDeprecationSetDefinition {}
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHP8x1MigrationSet.php
src/RuleSet/Sets/PHP8x1MigrationSet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractMigrationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHP8x1MigrationSet extends AbstractMigrationSetDefinition { public function getRules(): array { return [ '@PHP8x0Migration' => true, 'octal_notation' => true, ]; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHP7x1MigrationRiskySet.php
src/RuleSet/Sets/PHP7x1MigrationRiskySet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractMigrationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHP7x1MigrationRiskySet extends AbstractMigrationSetDefinition { public function getRules(): array { return [ '@PHP7x0Migration:risky' => true, 'void_return' => true, ]; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PERCSSet.php
src/RuleSet/Sets/PERCSSet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractRuleSetDefinition; use PhpCsFixer\RuleSet\DeprecatedRuleSetDefinitionInterface; use PhpCsFixer\RuleSet\RuleSetDefinitionInterface; use PhpCsFixer\RuleSet\RuleSets; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PERCSSet extends AbstractRuleSetDefinition { public function getName(): string { return '@PER-CS'; } public function getRules(): array { return [ $this->getHighestPerCsSet()->getName() => true, ]; } public function getDescription(): string { return 'Rules that follow `PER Coding Style <https://www.php-fig.org/per/coding-style/>`_, Set is an alias for the latest revision of ``PER-CS`` rules - use it if you always want to be in sync with newest ``PER-CS`` standard.'; } private function getHighestPerCsSet(): RuleSetDefinitionInterface { static $set = null; if (null === $set) { $currentSet = $this; $sets = array_filter( RuleSets::getSetDefinitions(), static fn (RuleSetDefinitionInterface $set): bool => !($set instanceof DeprecatedRuleSetDefinitionInterface) && $set->isRisky() === $currentSet->isRisky() && $set->getName() !== $currentSet->getName() && str_starts_with($set->getName(), $currentSet->getName()), ); ksort($sets, \SORT_NATURAL); $set = array_pop($sets); } return $set; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/AutoPHPMigrationSet.php
src/RuleSet/Sets/AutoPHPMigrationSet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractRuleSetDefinition; use PhpCsFixer\RuleSet\AutomaticMigrationSetTrait; use PhpCsFixer\RuleSet\AutomaticRuleSetDefinitionInterface; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class AutoPHPMigrationSet extends AbstractRuleSetDefinition implements AutomaticRuleSetDefinitionInterface { use AutomaticMigrationSetTrait; public function getName(): string { return '@'.lcfirst(ltrim(parent::getName(), '@')); } public function getRules(): array { return [ $this->calculateTargetSet($this->getName(), 'PHP', $this->isRisky()) => true, ]; } public function getDescription(): string { return 'Migration rules to improve code towards the minimum ``PHP`` supported by your project (taken from ``composer.json`` file).'; } public function getRulesCandidates(): array { $sets = array_values(self::calculateCandidateSets('PHP', $this->isRisky())); ksort($sets); return array_combine($sets, array_fill(0, \count($sets), true)); } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/AutoPHPUnitMigrationRiskySet.php
src/RuleSet/Sets/AutoPHPUnitMigrationRiskySet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractRuleSetDefinition; use PhpCsFixer\RuleSet\AutomaticMigrationSetTrait; use PhpCsFixer\RuleSet\AutomaticRuleSetDefinitionInterface; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class AutoPHPUnitMigrationRiskySet extends AbstractRuleSetDefinition implements AutomaticRuleSetDefinitionInterface { use AutomaticMigrationSetTrait; public function getName(): string { return '@'.lcfirst(ltrim(parent::getName(), '@')); } public function getRules(): array { return [ $this->calculateTargetSet($this->getName(), 'PHPUnit', $this->isRisky()) => true, ]; } public function getDescription(): string { return 'Migration rules to improve test code towards the minimum ``PHPUnit`` supported by your project (taken from ``composer.json`` file).'; } public function getRulesCandidates(): array { $sets = array_values(self::calculateCandidateSets('PHPUnit', $this->isRisky())); ksort($sets); return array_combine($sets, array_fill(0, \count($sets), true)); } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHPUnit50MigrationRiskySet.php
src/RuleSet/Sets/PHPUnit50MigrationRiskySet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractMajorMinorDeprecationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHPUnit50MigrationRiskySet extends AbstractMajorMinorDeprecationSetDefinition {}
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHPUnit4x8MigrationRiskySet.php
src/RuleSet/Sets/PHPUnit4x8MigrationRiskySet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\Fixer\PhpUnit\PhpUnitTargetVersion; use PhpCsFixer\RuleSet\AbstractMigrationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHPUnit4x8MigrationRiskySet extends AbstractMigrationSetDefinition { public function getRules(): array { return [ '@PHPUnit4x3Migration:risky' => true, 'php_unit_namespaced' => [ 'target' => PhpUnitTargetVersion::VERSION_4_8, ], ]; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHP54MigrationSet.php
src/RuleSet/Sets/PHP54MigrationSet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractMajorMinorDeprecationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHP54MigrationSet extends AbstractMajorMinorDeprecationSetDefinition {}
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PhpCsFixerRiskySet.php
src/RuleSet/Sets/PhpCsFixerRiskySet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractRuleSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PhpCsFixerRiskySet extends AbstractRuleSetDefinition { public function getRules(): array { return [ '@PER-CS:risky' => true, '@Symfony:risky' => true, 'comment_to_phpdoc' => true, 'final_internal_class' => true, 'get_class_to_class_keyword' => false, 'modernize_strpos' => false, // @TODO: consider switching to `true`, like in @Symfony 'native_constant_invocation' => [ 'fix_built_in' => false, 'include' => [ 'DIRECTORY_SEPARATOR', 'PHP_INT_SIZE', 'PHP_SAPI', 'PHP_VERSION_ID', ], 'scope' => 'namespaced', 'strict' => true, ], 'no_alias_functions' => [ 'sets' => [ '@all', ], ], 'no_trailing_whitespace_in_string' => true, // override Symfony to mimics PER / CS 'no_unset_on_property' => true, 'php_unit_data_provider_name' => true, 'php_unit_data_provider_return_type' => true, 'php_unit_data_provider_static' => ['force' => true], 'php_unit_strict' => true, 'php_unit_test_case_static_method_calls' => ['call_type' => 'self'], 'static_lambda' => true, 'strict_comparison' => true, 'strict_param' => true, 'yield_from_array_to_yields' => true, ]; } public function getDescription(): string { return 'Rules recommended by ``PHP CS Fixer`` team, highly opinionated. Extends ``@PER-CS:risky`` and ``@Symfony:risky``.'; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PERCS1x0RiskySet.php
src/RuleSet/Sets/PERCS1x0RiskySet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractRuleSetDefinition; /** * @internal * * PER Coding Style v1.0. * * @see https://github.com/php-fig/per-coding-style/blob/1.0.0/spec.md * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PERCS1x0RiskySet extends AbstractRuleSetDefinition { public function getName(): string { return '@PER-CS1x0:risky'; } public function getRules(): array { return [ '@PSR12:risky' => true, ]; } public function getDescription(): string { return 'Rules that follow `PER Coding Style 1.0 <https://www.php-fig.org/per/coding-style/>`_.'; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHP7x1MigrationSet.php
src/RuleSet/Sets/PHP7x1MigrationSet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractMigrationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHP7x1MigrationSet extends AbstractMigrationSetDefinition { public function getRules(): array { return [ '@PHP7x0Migration' => true, 'list_syntax' => true, 'modifier_keywords' => true, ]; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHPUnit5x0MigrationRiskySet.php
src/RuleSet/Sets/PHPUnit5x0MigrationRiskySet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\Fixer\PhpUnit\PhpUnitTargetVersion; use PhpCsFixer\RuleSet\AbstractMigrationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHPUnit5x0MigrationRiskySet extends AbstractMigrationSetDefinition { public function getRules(): array { return [ '@PHPUnit4x8Migration:risky' => true, 'php_unit_dedicate_assert' => [ 'target' => PhpUnitTargetVersion::VERSION_5_0, ], ]; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHP5x4MigrationSet.php
src/RuleSet/Sets/PHP5x4MigrationSet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractMigrationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHP5x4MigrationSet extends AbstractMigrationSetDefinition { public function getRules(): array { return [ 'array_syntax' => true, ]; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PhpCsFixerSet.php
src/RuleSet/Sets/PhpCsFixerSet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractRuleSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PhpCsFixerSet extends AbstractRuleSetDefinition { public function getRules(): array { return [ '@PER-CS' => true, '@Symfony' => true, 'blank_line_before_statement' => [ 'statements' => [ 'break', 'case', 'continue', 'declare', 'default', 'exit', 'goto', 'include', 'include_once', 'phpdoc', 'require', 'require_once', 'return', 'switch', 'throw', 'try', 'yield', 'yield_from', ], ], 'combine_consecutive_issets' => true, 'combine_consecutive_unsets' => true, 'empty_loop_body' => true, 'explicit_indirect_variable' => true, 'explicit_string_variable' => true, 'fully_qualified_strict_types' => [ 'import_symbols' => true, ], 'heredoc_to_nowdoc' => true, 'method_argument_space' => [ 'after_heredoc' => true, 'on_multiline' => 'ensure_fully_multiline', ], 'method_chaining_indentation' => true, 'multiline_comment_opening_closing' => true, 'multiline_whitespace_before_semicolons' => [ 'strategy' => 'new_line_for_chained_calls', ], 'no_extra_blank_lines' => [ 'tokens' => [ 'attribute', 'break', 'case', 'continue', 'curly_brace_block', 'default', 'extra', 'parenthesis_brace_block', 'return', 'square_brace_block', 'switch', 'throw', 'use', ], ], 'no_superfluous_elseif' => true, 'no_superfluous_phpdoc_tags' => [ 'allow_hidden_params' => true, 'allow_mixed' => true, // @TODO revalidate to keep `true` or unify into `false` 'remove_inheritdoc' => true, ], 'no_unneeded_control_parentheses' => [ 'statements' => [ 'break', 'clone', 'continue', 'echo_print', 'negative_instanceof', 'others', 'return', 'switch_case', 'yield', 'yield_from', ], ], 'no_useless_else' => true, 'no_useless_return' => true, 'operator_linebreak' => true, 'ordered_class_elements' => true, 'ordered_types' => [ 'null_adjustment' => 'always_last', ], 'php_unit_data_provider_method_order' => true, 'php_unit_internal_class' => true, 'php_unit_test_class_requires_covers' => true, 'phpdoc_add_missing_param_annotation' => true, 'phpdoc_no_empty_return' => true, 'phpdoc_order_by_value' => true, 'phpdoc_types_order' => true, 'protected_to_private' => true, 'return_assignment' => true, 'self_static_accessor' => true, 'single_line_comment_style' => true, 'single_line_empty_body' => true, 'single_line_throw' => false, 'string_implicit_backslashes' => true, 'trailing_comma_in_multiline' => ['after_heredoc' => true, 'elements' => ['array_destructuring', 'arrays']], 'whitespace_after_comma_in_array' => ['ensure_single_space' => true], ]; } public function getDescription(): string { return 'Rules recommended by ``PHP CS Fixer`` team, highly opinionated. Extends ``@PER-CS`` and ``@Symfony``.'; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHPUnit55MigrationRiskySet.php
src/RuleSet/Sets/PHPUnit55MigrationRiskySet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractMajorMinorDeprecationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHPUnit55MigrationRiskySet extends AbstractMajorMinorDeprecationSetDefinition {}
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PERCS1x0Set.php
src/RuleSet/Sets/PERCS1x0Set.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractRuleSetDefinition; /** * @internal * * PER Coding Style v1.0. * * @see https://github.com/php-fig/per-coding-style/blob/1.0.0/spec.md * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PERCS1x0Set extends AbstractRuleSetDefinition { public function getName(): string { return '@PER-CS1x0'; } public function getRules(): array { return [ '@PSR12' => true, ]; } public function getDescription(): string { return 'Rules that follow `PER Coding Style 1.0 <https://www.php-fig.org/per/coding-style/>`_.'; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PERCS2x0Set.php
src/RuleSet/Sets/PERCS2x0Set.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractRuleSetDefinition; /** * @internal * * PER Coding Style v2.0. * * @see https://github.com/php-fig/per-coding-style/blob/2.0.0/spec.md * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PERCS2x0Set extends AbstractRuleSetDefinition { public function getName(): string { return '@PER-CS2x0'; } public function getRules(): array { return [ '@PER-CS1x0' => true, 'array_indentation' => true, 'array_syntax' => true, 'cast_spaces' => true, 'concat_space' => ['spacing' => 'one'], 'function_declaration' => [ 'closure_fn_spacing' => 'none', ], 'method_argument_space' => [ 'after_heredoc' => false, // @TODO: default value of this option changed, consider to switch to new default ], 'new_with_parentheses' => [ 'anonymous_class' => false, ], 'single_line_empty_body' => true, 'single_space_around_construct' => [ 'constructs_followed_by_a_single_space' => [ 'abstract', 'as', 'case', 'catch', 'class', 'const', 'const_import', 'do', 'else', 'elseif', 'enum', 'final', 'finally', 'for', 'foreach', 'function', 'function_import', 'if', 'insteadof', 'interface', 'match', 'named_argument', 'namespace', 'new', 'private', 'protected', 'public', 'readonly', 'static', 'switch', 'trait', 'try', 'type_colon', 'use', 'use_lambda', 'while', ], 'constructs_preceded_by_a_single_space' => [ 'as', 'else', 'elseif', 'use_lambda', ], ], 'trailing_comma_in_multiline' => [ 'after_heredoc' => true, 'elements' => [ 'arguments', 'array_destructuring', 'arrays', 'match', 'parameters', ], ], ]; } public function getDescription(): string { return 'Rules that follow `PER Coding Style 2.0 <https://www.php-fig.org/per/coding-style/>`_.'; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHPUnit57MigrationRiskySet.php
src/RuleSet/Sets/PHPUnit57MigrationRiskySet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractMajorMinorDeprecationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHPUnit57MigrationRiskySet extends AbstractMajorMinorDeprecationSetDefinition {}
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHPUnit4x3MigrationRiskySet.php
src/RuleSet/Sets/PHPUnit4x3MigrationRiskySet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\Fixer\PhpUnit\PhpUnitTargetVersion; use PhpCsFixer\RuleSet\AbstractMigrationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHPUnit4x3MigrationRiskySet extends AbstractMigrationSetDefinition { public function getRules(): array { return [ '@PHPUnit3x5Migration:risky' => true, 'php_unit_no_expectation_annotation' => [ 'target' => PhpUnitTargetVersion::VERSION_4_3, ], ]; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PERCS10RiskySet.php
src/RuleSet/Sets/PERCS10RiskySet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractRuleSetDefinition; use PhpCsFixer\RuleSet\DeprecatedRuleSetDefinitionInterface; use PhpCsFixer\RuleSet\RuleSetDefinitionInterface; /** * @internal * * PER Coding Style v1.0. * * @see https://github.com/php-fig/per-coding-style/blob/1.0.0/spec.md * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PERCS10RiskySet extends AbstractRuleSetDefinition implements DeprecatedRuleSetDefinitionInterface { public function getName(): string { return '@PER-CS1.0:risky'; } public function getRules(): array { return $this->getProxiedSet()->getRules(); } public function getDescription(): string { return $this->getProxiedSet()->getDescription(); } public function getSuccessorsNames(): array { return [$this->getProxiedSet()->getName()]; } private function getProxiedSet(): RuleSetDefinitionInterface { return new PERCS1x0RiskySet(); } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/AutoRiskySet.php
src/RuleSet/Sets/AutoRiskySet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\ConfigurationException\UnresolvableAutoRuleSetConfigurationException; use PhpCsFixer\RuleSet\AbstractRuleSetDefinition; use PhpCsFixer\RuleSet\AutomaticRuleSetDefinitionInterface; use PhpCsFixer\RuleSet\RuleSetDefinitionInterface; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class AutoRiskySet extends AbstractRuleSetDefinition implements AutomaticRuleSetDefinitionInterface { public function getName(): string { return '@'.lcfirst(ltrim(parent::getName(), '@')); } public function getRules(): array { $sets = array_filter( $this->getCandidates(), fn (RuleSetDefinitionInterface $set): bool => $this->isSetDiscoverable($set), ); $sets = array_map( static fn (RuleSetDefinitionInterface $set): string => $set->getName(), $sets, ); return array_combine($sets, array_fill(0, \count($sets), true)); } public function getDescription(): string { return 'Default (risky) rule set. Applies newest ``PER-CS`` and optimizations for ``PHP`` and ``PHPUnit``, based on project\'s ``composer.json`` file.'; } public function getRulesCandidates(): array { $sets = array_map( static fn (RuleSetDefinitionInterface $set): string => $set->getName(), $this->getCandidates(), ); return array_combine($sets, array_fill(0, \count($sets), true)); } /** @return list<RuleSetDefinitionInterface> */ private function getCandidates(): array { // order matters return [ new PERCSRiskySet(), new AutoPHPMigrationRiskySet(), new AutoPHPUnitMigrationRiskySet(), ]; } private function isSetDiscoverable(RuleSetDefinitionInterface $set): bool { try { $set->getRules(); return true; } catch (UnresolvableAutoRuleSetConfigurationException $unused) { return false; } } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PERCS2x0RiskySet.php
src/RuleSet/Sets/PERCS2x0RiskySet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractRuleSetDefinition; /** * @internal * * PER Coding Style v2.0. * * @see https://github.com/php-fig/per-coding-style/blob/2.0.0/spec.md * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PERCS2x0RiskySet extends AbstractRuleSetDefinition { public function getName(): string { return '@PER-CS2x0:risky'; } public function getRules(): array { return [ '@PER-CS1x0:risky' => true, ]; } public function getDescription(): string { return 'Rules that follow `PER Coding Style 2.0 <https://www.php-fig.org/per/coding-style/>`_.'; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHPUnit11x0MigrationRiskySet.php
src/RuleSet/Sets/PHPUnit11x0MigrationRiskySet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\Fixer\PhpUnit\PhpUnitTargetVersion; use PhpCsFixer\RuleSet\AbstractMigrationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHPUnit11x0MigrationRiskySet extends AbstractMigrationSetDefinition { public function getRules(): array { return [ '@PHPUnit10x0Migration:risky' => true, 'php_unit_test_case_static_method_calls' => [ 'target' => PhpUnitTargetVersion::VERSION_11_0, ], ]; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PERCSRiskySet.php
src/RuleSet/Sets/PERCSRiskySet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractRuleSetDefinition; use PhpCsFixer\RuleSet\DeprecatedRuleSetDefinitionInterface; use PhpCsFixer\RuleSet\RuleSetDefinitionInterface; use PhpCsFixer\RuleSet\RuleSets; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PERCSRiskySet extends AbstractRuleSetDefinition { public function getName(): string { return '@PER-CS:risky'; } public function getRules(): array { return [ $this->getHighestPerCsSet()->getName() => true, ]; } public function getDescription(): string { return 'Rules that follow `PER Coding Style <https://www.php-fig.org/per/coding-style/>`_, Set is an alias for the latest revision of ``PER-CS`` rules - use it if you always want to be in sync with newest ``PER-CS`` standard.'; } private function getHighestPerCsSet(): RuleSetDefinitionInterface { static $set = null; if (null === $set) { $currentSet = $this; $sets = array_filter( RuleSets::getSetDefinitions(), static fn (RuleSetDefinitionInterface $set): bool => !($set instanceof DeprecatedRuleSetDefinitionInterface) && $set->isRisky() === $currentSet->isRisky() && $set->getName() !== $currentSet->getName() && str_starts_with($set->getName(), str_replace(':risky', '', $currentSet->getName())), ); ksort($sets, \SORT_NATURAL); $set = array_pop($sets); } return $set; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHPUnit7x5MigrationRiskySet.php
src/RuleSet/Sets/PHPUnit7x5MigrationRiskySet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\Fixer\PhpUnit\PhpUnitTargetVersion; use PhpCsFixer\RuleSet\AbstractMigrationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHPUnit7x5MigrationRiskySet extends AbstractMigrationSetDefinition { public function getRules(): array { return [ '@PHPUnit6x0Migration:risky' => true, 'php_unit_dedicate_assert_internal_type' => [ 'target' => PhpUnitTargetVersion::VERSION_7_5, ], ]; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/AutoSet.php
src/RuleSet/Sets/AutoSet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\ConfigurationException\UnresolvableAutoRuleSetConfigurationException; use PhpCsFixer\RuleSet\AbstractRuleSetDefinition; use PhpCsFixer\RuleSet\AutomaticRuleSetDefinitionInterface; use PhpCsFixer\RuleSet\RuleSetDefinitionInterface; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. * * @TODO refactor for DRY between Auto*Set classes // keradus */ final class AutoSet extends AbstractRuleSetDefinition implements AutomaticRuleSetDefinitionInterface { public function getName(): string { return '@'.lcfirst(ltrim(parent::getName(), '@')); } public function getRules(): array { $sets = array_filter( $this->getCandidates(), fn (RuleSetDefinitionInterface $set): bool => $this->isSetDiscoverable($set), ); $sets = array_map( static fn (RuleSetDefinitionInterface $set): string => $set->getName(), $sets, ); return array_combine($sets, array_fill(0, \count($sets), true)); } public function getDescription(): string { return 'Default rule set. Applies newest ``PER-CS`` and optimizations for ``PHP``, based on project\'s ``composer.json`` file.'; } public function getRulesCandidates(): array { $sets = array_map( static fn (RuleSetDefinitionInterface $set): string => $set->getName(), $this->getCandidates(), ); return array_combine($sets, array_fill(0, \count($sets), true)); } /** @return list<RuleSetDefinitionInterface> */ private function getCandidates(): array { // order matters return [ new PERCSSet(), new AutoPHPMigrationSet(), ]; } private function isSetDiscoverable(RuleSetDefinitionInterface $set): bool { try { $set->getRules(); return true; } catch (UnresolvableAutoRuleSetConfigurationException $unused) { return false; } } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PERCS20Set.php
src/RuleSet/Sets/PERCS20Set.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractRuleSetDefinition; use PhpCsFixer\RuleSet\DeprecatedRuleSetDefinitionInterface; use PhpCsFixer\RuleSet\RuleSetDefinitionInterface; /** * @internal * * PER Coding Style v2.0. * * @see https://github.com/php-fig/per-coding-style/blob/2.0.0/spec.md * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PERCS20Set extends AbstractRuleSetDefinition implements DeprecatedRuleSetDefinitionInterface { public function getName(): string { return '@PER-CS2.0'; } public function getRules(): array { return $this->getProxiedSet()->getRules(); } public function getDescription(): string { return $this->getProxiedSet()->getDescription(); } public function getSuccessorsNames(): array { return [$this->getProxiedSet()->getName()]; } private function getProxiedSet(): RuleSetDefinitionInterface { return new PERCS2x0Set(); } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHPUnit32MigrationRiskySet.php
src/RuleSet/Sets/PHPUnit32MigrationRiskySet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractMajorMinorDeprecationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHPUnit32MigrationRiskySet extends AbstractMajorMinorDeprecationSetDefinition {}
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/AutoPHPMigrationRiskySet.php
src/RuleSet/Sets/AutoPHPMigrationRiskySet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractRuleSetDefinition; use PhpCsFixer\RuleSet\AutomaticMigrationSetTrait; use PhpCsFixer\RuleSet\AutomaticRuleSetDefinitionInterface; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class AutoPHPMigrationRiskySet extends AbstractRuleSetDefinition implements AutomaticRuleSetDefinitionInterface { use AutomaticMigrationSetTrait; public function getName(): string { return '@'.lcfirst(ltrim(parent::getName(), '@')); } public function getRules(): array { return [ $this->calculateTargetSet($this->getName(), 'PHP', $this->isRisky()) => true, ]; } public function getDescription(): string { return 'Migration rules to improve code towards the minimum ``PHP`` supported by your project (taken from ``composer.json`` file).'; } public function getRulesCandidates(): array { $sets = array_values(self::calculateCandidateSets('PHP', $this->isRisky())); ksort($sets); return array_combine($sets, array_fill(0, \count($sets), true)); } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/PHP83MigrationSet.php
src/RuleSet/Sets/PHP83MigrationSet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets; use PhpCsFixer\RuleSet\AbstractMajorMinorDeprecationSetDefinition; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class PHP83MigrationSet extends AbstractMajorMinorDeprecationSetDefinition {}
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/RuleSet/Sets/Internal/InternalRiskySet.php
src/RuleSet/Sets/Internal/InternalRiskySet.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\RuleSet\Sets\Internal; use PhpCsFixer\RuleSet\InternalRuleSetDefinitionInterface; use PhpCsFixer\RuleSet\RuleSetDefinitionInterface; /** * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class InternalRiskySet implements RuleSetDefinitionInterface, InternalRuleSetDefinitionInterface { public function getDescription(): string { return 'Internal rule set applicable only for PHP CS Fixer repository.'; } public function getName(): string { return '@self/internal'; } /** * Get all rules from rules set. * * @return array<string, array<string, mixed>|bool> */ public function getRules(): array { return [ 'PhpCsFixerInternal/configurable_fixer_template' => true, ]; } public function isRisky(): bool { return true; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/DocBlock/Tag.php
src/DocBlock/Tag.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\DocBlock; use PhpCsFixer\Preg; /** * This represents a tag, as defined by the proposed PSR PHPDoc standard. * * @author Graham Campbell <hello@gjcampbell.co.uk> * @author Jakub Kwaśniewski <jakub@zero-85.pl> * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class Tag { /** * All the tags defined by the proposed PSR PHPDoc standard. */ public const PSR_STANDARD_TAGS = [ 'api', 'author', 'category', 'copyright', 'deprecated', 'example', 'global', 'internal', 'license', 'link', 'method', 'package', 'param', 'property', 'property-read', 'property-write', 'return', 'see', 'since', 'subpackage', 'throws', 'todo', 'uses', 'var', 'version', ]; /** * The line containing the tag. */ private Line $line; /** * The cached tag name. */ private ?string $name = null; /** * Create a new tag instance. */ public function __construct(Line $line) { $this->line = $line; } /** * Get the tag name. * * This may be "param", or "return", etc. */ public function getName(): string { if (null === $this->name) { Preg::matchAll('/@[a-zA-Z0-9_-]+(?=\s|$)/', $this->line->getContent(), $matches); if (isset($matches[0][0])) { $this->name = ltrim($matches[0][0], '@'); } else { $this->name = 'other'; } } return $this->name; } /** * Set the tag name. * * This will also be persisted to the upstream line and annotation. */ public function setName(string $name): void { $current = $this->getName(); if ('other' === $current) { throw new \RuntimeException('Cannot set name on unknown tag.'); } $this->line->setContent(Preg::replace("/@{$current}/", "@{$name}", $this->line->getContent(), 1)); $this->name = $name; } /** * Is the tag a known tag? * * This is defined by if it exists in the proposed PSR PHPDoc standard. */ public function valid(): bool { return \in_array($this->getName(), self::PSR_STANDARD_TAGS, true); } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/DocBlock/Annotation.php
src/DocBlock/Annotation.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\DocBlock; use PhpCsFixer\Preg; use PhpCsFixer\Tokenizer\Analyzer\Analysis\NamespaceAnalysis; use PhpCsFixer\Tokenizer\Analyzer\Analysis\NamespaceUseAnalysis; /** * This represents an entire annotation from a docblock. * * @author Graham Campbell <hello@gjcampbell.co.uk> * @author Dariusz Rumiński <dariusz.ruminski@gmail.com> * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class Annotation implements \Stringable { /** * All the annotation tag names with types. * * @var non-empty-list<string> */ public const TAGS_WITH_TYPES = [ 'extends', 'implements', 'method', 'param', 'param-out', 'phpstan-type', 'phpstan-import-type', 'property', 'property-read', 'property-write', 'psalm-type', 'psalm-import-type', 'return', 'throws', 'type', 'var', ]; /** * The lines that make up the annotation. * * @var non-empty-list<Line> */ private array $lines; /** * The position of the first line of the annotation in the docblock. */ private int $start; /** * The position of the last line of the annotation in the docblock. */ private int $end; /** * The associated tag. */ private ?Tag $tag = null; /** * Lazy loaded, cached types content. */ private ?string $typesContent = null; /** * The cached types. * * @var null|list<string> */ private ?array $types = null; private ?NamespaceAnalysis $namespace = null; /** * @var list<NamespaceUseAnalysis> */ private array $namespaceUses; /** * Create a new line instance. * * @param non-empty-array<int, Line> $lines * @param null|NamespaceAnalysis $namespace * @param list<NamespaceUseAnalysis> $namespaceUses */ public function __construct(array $lines, $namespace = null, array $namespaceUses = []) { $this->lines = array_values($lines); $this->namespace = $namespace; $this->namespaceUses = $namespaceUses; $this->start = array_key_first($lines); $this->end = array_key_last($lines); } /** * Get the string representation of object. */ public function __toString(): string { return $this->getContent(); } /** * Get all the annotation tag names with types. * * @return non-empty-list<string> * * @deprecated Use `Annotation::TAGS_WITH_TYPES` constant instead * * @TODO 4.0 remove me */ public static function getTagsWithTypes(): array { return self::TAGS_WITH_TYPES; } /** * Get the start position of this annotation. */ public function getStart(): int { return $this->start; } /** * Get the end position of this annotation. */ public function getEnd(): int { return $this->end; } /** * Get the associated tag. */ public function getTag(): Tag { if (null === $this->tag) { $this->tag = new Tag($this->lines[0]); } return $this->tag; } /** * @internal */ public function getTypeExpression(): ?TypeExpression { $typesContent = $this->getTypesContent(); return null === $typesContent ? null : new TypeExpression($typesContent, $this->namespace, $this->namespaceUses); } /** * @internal */ public function getVariableName(): ?string { $type = preg_quote($this->getTypesContent() ?? '', '/'); $regex = \sprintf( '/@%s\s+(%s\s*)?(&\s*)?(\.{3}\s*)?(?<variable>\$%s)(?:.*|$)/', $this->tag->getName(), $type, TypeExpression::REGEX_IDENTIFIER, ); if (Preg::match($regex, $this->getContent(), $matches)) { \assert(isset($matches['variable'])); return $matches['variable']; } return null; } /** * Get the types associated with this annotation. * * @return list<string> */ public function getTypes(): array { if (null === $this->types) { $typeExpression = $this->getTypeExpression(); $this->types = null === $typeExpression ? [] : $typeExpression->getTypes(); } return $this->types; } /** * Set the types associated with this annotation. * * @param list<string> $types */ public function setTypes(array $types): void { $origTypesContent = $this->getTypesContent(); $newTypesContent = implode( // Fallback to union type is provided for backward compatibility (previously glue was set to `|` by default even when type was not composite) // @TODO Better handling for cases where type is fixed (original type is not composite, but was made composite during fix) $this->getTypeExpression()->getTypesGlue() ?? '|', $types, ); if ($origTypesContent === $newTypesContent) { return; } $originalTypesLines = Preg::split('/([^\n\r]+\R*)/', $origTypesContent, -1, \PREG_SPLIT_NO_EMPTY | \PREG_SPLIT_DELIM_CAPTURE); $newTypesLines = Preg::split('/([^\n\r]+\R*)/', $newTypesContent, -1, \PREG_SPLIT_NO_EMPTY | \PREG_SPLIT_DELIM_CAPTURE); \assert(\count($originalTypesLines) === \count($newTypesLines)); foreach ($newTypesLines as $index => $line) { \assert(isset($originalTypesLines[$index])); $pattern = '/'.preg_quote($originalTypesLines[$index], '/').'/'; \assert(isset($this->lines[$index])); $this->lines[$index]->setContent(Preg::replace($pattern, $line, $this->lines[$index]->getContent(), 1)); } $this->clearCache(); } /** * Get the normalized types associated with this annotation, so they can easily be compared. * * @return list<string> */ public function getNormalizedTypes(): array { $typeExpression = $this->getTypeExpression(); if (null === $typeExpression) { return []; } $normalizedTypeExpression = $typeExpression ->mapTypes(static fn (TypeExpression $v) => new TypeExpression(strtolower($v->toString()), null, [])) ->sortTypes(static fn (TypeExpression $a, TypeExpression $b) => $a->toString() <=> $b->toString()) ; return $normalizedTypeExpression->getTypes(); } /** * Remove this annotation by removing all its lines. */ public function remove(): void { foreach ($this->lines as $line) { if ($line->isTheStart() && $line->isTheEnd()) { // Single line doc block, remove entirely $line->remove(); } elseif ($line->isTheStart()) { // Multi line doc block, but start is on the same line as the first annotation, keep only the start $content = Preg::replace('#(\s*/\*\*).*#', '$1', $line->getContent()); $line->setContent($content); } elseif ($line->isTheEnd()) { // Multi line doc block, but end is on the same line as the last annotation, keep only the end $content = Preg::replace('#(\s*)\S.*(\*/.*)#', '$1$2', $line->getContent()); $line->setContent($content); } else { // Multi line doc block, neither start nor end on this line, can be removed safely $line->remove(); } } $this->clearCache(); } /** * Get the annotation content. */ public function getContent(): string { return implode('', $this->lines); } public function supportTypes(): bool { return \in_array($this->getTag()->getName(), self::TAGS_WITH_TYPES, true); } /** * Get the current types content. * * Be careful modifying the underlying line as that won't flush the cache. */ private function getTypesContent(): ?string { if (null === $this->typesContent) { $name = $this->getTag()->getName(); if (!$this->supportTypes()) { throw new \RuntimeException('This tag does not support types.'); } if (Preg::match( '{^(?:\h*\*|/\*\*)[\h*]*@'.$name.'\h+'.TypeExpression::REGEX_TYPES.'(?:(?:[*\h\v]|\&?[\.\$\s]).*)?\r?$}is', $this->getContent(), $matches, )) { \assert(isset($matches['types'])); $this->typesContent = $matches['types']; } } return $this->typesContent; } private function clearCache(): void { $this->types = null; $this->typesContent = null; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/DocBlock/ShortDescription.php
src/DocBlock/ShortDescription.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\DocBlock; /** * This class represents a short description (aka summary) of a docblock. * * @readonly * * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class ShortDescription { /** * The docblock containing the short description. */ private DocBlock $doc; public function __construct(DocBlock $doc) { $this->doc = $doc; } /** * Get the line index of the line containing the end of the short * description, if present. */ public function getEnd(): ?int { $reachedContent = false; foreach ($this->doc->getLines() as $index => $line) { // we went past a description, then hit a tag or blank line, so // the last line of the description must be the one before this one if ($reachedContent && ($line->containsATag() || !$line->containsUsefulContent())) { return $index - 1; } // no short description was found if ($line->containsATag()) { return null; } // we've reached content, but need to check the next lines too // in case the short description is multi-line if ($line->containsUsefulContent()) { $reachedContent = true; } } return null; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/DocBlock/Line.php
src/DocBlock/Line.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\DocBlock; use PhpCsFixer\Preg; /** * This represents a line of a docblock. * * @author Graham Campbell <hello@gjcampbell.co.uk> * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class Line implements \Stringable { /** * The content of this line. */ private string $content; /** * Create a new line instance. */ public function __construct(string $content) { $this->content = $content; } /** * Get the string representation of object. */ public function __toString(): string { return $this->content; } /** * Get the content of this line. */ public function getContent(): string { return $this->content; } /** * Does this line contain useful content? * * If the line contains text or tags, then this is true. */ public function containsUsefulContent(): bool { return Preg::match('/\*\s*\S+/', $this->content) && '' !== trim(str_replace(['/', '*'], ' ', $this->content)); } /** * Does the line contain a tag? * * If this is true, then it must be the first line of an annotation. */ public function containsATag(): bool { return Preg::match('/\*\s*@/', $this->content); } /** * Is the line the start of a docblock? */ public function isTheStart(): bool { return str_contains($this->content, '/**'); } /** * Is the line the end of a docblock? */ public function isTheEnd(): bool { return str_contains($this->content, '*/'); } /** * Set the content of this line. */ public function setContent(string $content): void { $this->content = $content; } /** * Remove this line by clearing its contents. * * Note that this method technically brakes the internal state of the * docblock, but is useful when we need to retain the indices of lines * during the execution of an algorithm. */ public function remove(): void { $this->content = ''; } /** * Append a blank docblock line to this line's contents. * * Note that this method technically brakes the internal state of the * docblock, but is useful when we need to retain the indices of lines * during the execution of an algorithm. */ public function addBlank(): void { $matched = Preg::match('/^(\h*\*)[^\r\n]*(\r?\n)$/', $this->content, $matches); if (!$matched) { return; } $this->content .= $matches[1].$matches[2]; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/DocBlock/TypeExpression.php
src/DocBlock/TypeExpression.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\DocBlock; use PhpCsFixer\Preg; use PhpCsFixer\Tokenizer\Analyzer\Analysis\NamespaceAnalysis; use PhpCsFixer\Tokenizer\Analyzer\Analysis\NamespaceUseAnalysis; use PhpCsFixer\Utils; /** * @author Michael Vorisek <https://github.com/mvorisek> * * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class TypeExpression { /** * Regex to match any PHP identifier. * * @internal */ public const REGEX_IDENTIFIER = '(?:(?!(?<!\*)\d)[^\x00-\x2f\x3a-\x40\x5b-\x5e\x60\x7b-\x7f]++)'; /** * Regex to match any PHPDoc type. * * @internal */ public const REGEX_TYPES = '(?<types>(?x) # one or several types separated by `|` or `&` '.self::REGEX_TYPE.' (?: \h*(?<glue>[|&])\h* (?&type) )*+ )'; /** * Based on: * - https://github.com/phpstan/phpdoc-parser/blob/1.26.0/doc/grammars/type.abnf fuzzing grammar * - and https://github.com/phpstan/phpdoc-parser/blob/1.26.0/src/Parser/PhpDocParser.php parser impl. */ private const REGEX_TYPE = '(?<type>(?x) # single type (?:co(ntra)?variant\h+)? (?<nullable>\??\h*) (?: (?<array_shape> (?<array_shape_name>(?i)(?:array|list|object)(?-i)) (?<array_shape_start>\h*\{[\h\v*]*) (?<array_shape_inners> (?<array_shape_inner> (?<array_shape_inner_key>(?:(?&constant)|(?&identifier)|(?&name))\h*\??\h*:\h*|) (?<array_shape_inner_value>(?&types_inner)) ) (?: \h*,[\h\v*]* (?&array_shape_inner) )*+ (?:\h*,|(?!(?&array_shape_unsealed_variadic))) |) (?<array_shape_unsealed> # unsealed array shape, e.g. `...`. `...<string>` (?<array_shape_unsealed_variadic>\h*\.\.\.) (?<array_shape_unsealed_type> (?<array_shape_unsealed_type_start>\h*<\h*) (?<array_shape_unsealed_type_a>(?&types_inner)) (?: (?<array_shape_unsealed_type_comma>\h*,\h*) (?<array_shape_unsealed_type_b>(?&array_shape_unsealed_type_a)) |) \h*> |) |) [\h\v*]*\} ) | (?<callable> # callable syntax, e.g. `callable(string, int...): bool`, `\Closure<T>(T, int): T` (?<callable_name>(?&name)) (?<callable_template> (?<callable_template_start>\h*<\h*) (?<callable_template_inners> (?<callable_template_inner> (?<callable_template_inner_name> (?&identifier) ) (?<callable_template_inner_b> # template bound \h+(?i)(?<callable_template_inner_b_kw>of|as)(?-i)\h+ (?<callable_template_inner_b_types>(?&types_inner)) |) (?<callable_template_inner_d> # template default \h*=\h* (?<callable_template_inner_d_types>(?&types_inner)) |) ) (?: \h*,\h* (?&callable_template_inner) )*+ ) \h*> (?=\h*\() |) (?<callable_start>\h*\(\h*) (?<callable_arguments> (?<callable_argument> (?<callable_argument_type>(?&types_inner)) (?<callable_argument_is_reference>\h*&|) (?<callable_argument_is_variadic>\h*\.\.\.|) (?<callable_argument_name>\h*\$(?&identifier)|) (?<callable_argument_is_optional>\h*=|) ) (?: \h*,\h* (?&callable_argument) )*+ (?:\h*,)? |) \h*\) (?: \h*\:\h* (?<callable_return>(?&type)) )? ) | (?<generic> # generic syntax, e.g.: `array<int, \Foo\Bar>` (?<generic_name>(?&name)) (?<generic_start>\h*<[\h\v*]*) (?<generic_types> (?&types_inner) (?: \h*,[\h\v*]* (?&types_inner) )*+ (?:\h*,)? ) [\h\v*]*> ) | (?<class_constant> # class constants with optional wildcard, e.g.: `Foo::*`, `Foo::CONST_A`, `FOO::CONST_*` (?<class_constant_name>(?&name)) ::\*?(?:(?&identifier)\*?)* ) | (?<constant> # single constant value (case insensitive), e.g.: 1, -1.8E+6, `\'a\'` (?i) # all sorts of numbers: with or without sign, supports literal separator and several numeric systems, # e.g.: 1, +1.1, 1., .1, -1, 123E+8, 123_456_789, 0x7Fb4, 0b0110, 0o777 [+-]?(?: (?:0b[01]++(?:_[01]++)*+) | (?:0o[0-7]++(?:_[0-7]++)*+) | (?:0x[\da-f]++(?:_[\da-f]++)*+) | (?:(?<constant_digits>\d++(?:_\d++)*+)|(?=\.\d)) (?:\.(?&constant_digits)|(?<=\d)\.)?+ (?:e[+-]?(?&constant_digits))?+ ) | \'(?:[^\'\\\]|\\\.)*+\' | "(?:[^"\\\]|\\\.)*+" (?-i) ) | (?<this> # self reference, e.g.: $this, $self, @static (?i) [@$](?:this | self | static) (?-i) ) | (?<name> # full name, e.g.: `int`, `\DateTime`, `\Foo\Bar`, `positive-int` \\\?+ (?<identifier>'.self::REGEX_IDENTIFIER.') (?:[\\\\\-](?&identifier))*+ ) | (?<parenthesized> # parenthesized type, e.g.: `(int)`, `(int|\stdClass)` (?<parenthesized_start> \(\h* ) (?: (?<parenthesized_types> (?&types_inner) ) | (?<conditional> # conditional type, e.g.: `$foo is \Throwable ? false : $foo` (?<conditional_cond_left> (?:\$(?&identifier)) | (?<conditional_cond_left_types>(?&types_inner)) ) (?<conditional_cond_middle> \h+(?i)is(?:\h+not)?(?-i)\h+ ) (?<conditional_cond_right_types>(?&types_inner)) (?<conditional_true_start>\h*\?\h*) (?<conditional_true_types>(?&types_inner)) (?<conditional_false_start>\h*:\h*) (?<conditional_false_types>(?&types_inner)) ) ) \h*\) ) ) (?<array> # array, e.g.: `string[]`, `array<int, string>[][]` (\h*\[\h*\])* ) (?:(?=1)0 (?<types_inner>(?> (?&type) (?: \h*[|&]\h* (?&type) )*+ )) |) )'; private const ALIASES = [ 'boolean' => 'bool', 'callback' => 'callable', 'double' => 'float', 'false' => 'bool', 'integer' => 'int', 'list' => 'array', 'real' => 'float', 'true' => 'bool', ]; private string $value; private bool $isCompositeType; /** @var null|'&'|'|' */ private ?string $typesGlue = null; /** @var list<array{start_index: int, expression: self}> */ private array $innerTypeExpressions = []; private ?NamespaceAnalysis $namespace; /** @var list<NamespaceUseAnalysis> */ private array $namespaceUses; /** * @param list<NamespaceUseAnalysis> $namespaceUses */ public function __construct(string $value, ?NamespaceAnalysis $namespace, array $namespaceUses) { $this->value = $value; $this->namespace = $namespace; $this->namespaceUses = $namespaceUses; $this->parse(); } public function toString(): string { return $this->value; } /** * @return list<string> */ public function getTypes(): array { if ($this->isCompositeType) { return array_map( static fn (array $type) => $type['expression']->toString(), $this->innerTypeExpressions, ); } return [$this->value]; } /** * Determines if type expression is a composite type (union or intersection). */ public function isCompositeType(): bool { return $this->isCompositeType; } public function isUnionType(): bool { return $this->isCompositeType && '|' === $this->typesGlue; } public function isIntersectionType(): bool { return $this->isCompositeType && '&' === $this->typesGlue; } /** * @return null|'&'|'|' */ public function getTypesGlue(): ?string { return $this->typesGlue; } /** * @param \Closure(self): self $callback */ public function mapTypes(\Closure $callback): self { $value = $this->value; $startIndexOffset = 0; foreach ($this->innerTypeExpressions as [ 'start_index' => $startIndexOrig, 'expression' => $inner, ]) { $innerValueOrig = $inner->value; $inner = $inner->mapTypes($callback); if ($inner->value !== $innerValueOrig) { $value = substr_replace( $value, $inner->value, $startIndexOrig + $startIndexOffset, \strlen($innerValueOrig), ); $startIndexOffset += \strlen($inner->value) - \strlen($innerValueOrig); } } $type = $value === $this->value ? $this : $this->inner($value); return $callback($type); } /** * @param \Closure(self): void $callback */ public function walkTypes(\Closure $callback): void { $this->mapTypes(static function (self $type) use ($callback) { $valueOrig = $type->value; $callback($type); \assert($type->value === $valueOrig); return $type; }); } /** * @param \Closure(self, self): (-1|0|1) $compareCallback */ public function sortTypes(\Closure $compareCallback): self { return $this->mapTypes(function (self $type) use ($compareCallback): self { if ($type->isCompositeType) { $innerTypeExpressions = Utils::stableSort( $type->innerTypeExpressions, static fn (array $v): self => $v['expression'], $compareCallback, ); if ($innerTypeExpressions !== $type->innerTypeExpressions) { $value = implode( $type->getTypesGlue(), array_map(static fn (array $v): string => $v['expression']->toString(), $innerTypeExpressions), ); return $this->inner($value); } } return $type; }); } public function getCommonType(): ?string { $mainType = null; foreach ($this->getTypes() as $type) { if ('null' === $type) { continue; } if (str_starts_with($type, '?')) { $type = substr($type, 1); } if (Preg::match('/\[\h*\]$/', $type)) { $type = 'array'; } elseif (Preg::match('/^(.+?)\h*[<{(]/', $type, $matches)) { $type = $matches[1]; } if (isset(self::ALIASES[$type])) { $type = self::ALIASES[$type]; } if (null === $mainType || $type === $mainType) { $mainType = $type; continue; } $mainType = $this->getParentType($type, $mainType); if (null === $mainType) { return null; } } return $mainType; } public function allowsNull(): bool { foreach ($this->getTypes() as $type) { if (\in_array($type, ['null', 'mixed'], true) || str_starts_with($type, '?')) { return true; } } return false; } private function parse(): void { $seenGlues = null; $innerValues = []; $index = 0; while (true) { Preg::match( '{\G'.self::REGEX_TYPE.'(?<glue_raw>\h*(?<glue>[|&])\h*(?!$)|$)}', $this->value, $matches, \PREG_OFFSET_CAPTURE, $index, ); if ([] === $matches) { throw new \Exception('Unable to parse phpdoc type '.var_export($this->value, true)); } if (null === $seenGlues) { if (($matches['glue'][0] ?? '') === '') { break; } $seenGlues = ['|' => false, '&' => false]; } if (($matches['glue'][0] ?? '') !== '') { \assert(isset($seenGlues[$matches['glue'][0]])); $seenGlues[$matches['glue'][0]] = true; } $innerValues[] = [ 'start_index' => $index, 'value' => $matches['type'][0], 'next_glue' => $matches['glue'][0] ?? null, 'next_glue_raw' => $matches['glue_raw'][0] ?? null, ]; $consumedValueLength = \strlen($matches[0][0]); $index += $consumedValueLength; if (\strlen($this->value) <= $index) { \assert(\strlen($this->value) === $index); $seenGlues = array_filter($seenGlues); \assert([] !== $seenGlues); $this->isCompositeType = true; $this->typesGlue = array_key_first($seenGlues); if (1 === \count($seenGlues)) { foreach ($innerValues as $innerValue) { $this->innerTypeExpressions[] = [ 'start_index' => $innerValue['start_index'], 'expression' => $this->inner($innerValue['value']), ]; } } else { for ($i = 0; $i < \count($innerValues); ++$i) { $innerStartIndex = $innerValues[$i]['start_index']; $innerValue = ''; while (true) { $innerValue .= $innerValues[$i]['value']; if (($innerValues[$i]['next_glue'] ?? $this->typesGlue) === $this->typesGlue) { break; } $innerValue .= $innerValues[$i]['next_glue_raw']; ++$i; } $this->innerTypeExpressions[] = [ 'start_index' => $innerStartIndex, 'expression' => $this->inner($innerValue), ]; } } return; } } $this->isCompositeType = false; if ('' !== $matches['nullable'][0]) { $this->innerTypeExpressions[] = [ 'start_index' => \strlen($matches['nullable'][0]), 'expression' => $this->inner(substr($matches['type'][0], \strlen($matches['nullable'][0]))), ]; } elseif ('' !== $matches['array'][0]) { $this->innerTypeExpressions[] = [ 'start_index' => 0, 'expression' => $this->inner(substr($matches['type'][0], 0, -\strlen($matches['array'][0]))), ]; } elseif ('' !== ($matches['generic'][0] ?? '') && 0 === $matches['generic'][1]) { $this->innerTypeExpressions[] = [ 'start_index' => 0, 'expression' => $this->inner($matches['generic_name'][0]), ]; $this->parseCommaSeparatedInnerTypes( \strlen($matches['generic_name'][0]) + \strlen($matches['generic_start'][0]), $matches['generic_types'][0], ); } elseif ('' !== ($matches['callable'][0] ?? '') && 0 === $matches['callable'][1]) { $this->innerTypeExpressions[] = [ 'start_index' => 0, 'expression' => $this->inner($matches['callable_name'][0]), ]; $this->parseCallableTemplateInnerTypes( \strlen($matches['callable_name'][0]) + \strlen($matches['callable_template_start'][0]), $matches['callable_template_inners'][0], ); $this->parseCallableArgumentTypes( \strlen($matches['callable_name'][0]) + \strlen($matches['callable_template'][0]) + \strlen($matches['callable_start'][0]), $matches['callable_arguments'][0], ); if ('' !== ($matches['callable_return'][0] ?? '')) { $this->innerTypeExpressions[] = [ 'start_index' => \strlen($this->value) - \strlen($matches['callable_return'][0]), 'expression' => $this->inner($matches['callable_return'][0]), ]; } } elseif ('' !== ($matches['array_shape'][0] ?? '') && 0 === $matches['array_shape'][1]) { $this->innerTypeExpressions[] = [ 'start_index' => 0, 'expression' => $this->inner($matches['array_shape_name'][0]), ]; $nextIndex = \strlen($matches['array_shape_name'][0]) + \strlen($matches['array_shape_start'][0]); $this->parseArrayShapeInnerTypes( $nextIndex, $matches['array_shape_inners'][0], ); if ('' !== ($matches['array_shape_unsealed_type'][0] ?? '')) { $nextIndex += \strlen($matches['array_shape_inners'][0]) + \strlen($matches['array_shape_unsealed_variadic'][0]) + \strlen($matches['array_shape_unsealed_type_start'][0]); $this->innerTypeExpressions[] = [ 'start_index' => $nextIndex, 'expression' => $this->inner($matches['array_shape_unsealed_type_a'][0]), ]; if ('' !== ($matches['array_shape_unsealed_type_b'][0] ?? '')) { $nextIndex += \strlen($matches['array_shape_unsealed_type_a'][0]) + \strlen($matches['array_shape_unsealed_type_comma'][0]); $this->innerTypeExpressions[] = [ 'start_index' => $nextIndex, 'expression' => $this->inner($matches['array_shape_unsealed_type_b'][0]), ]; } } } elseif ('' !== ($matches['parenthesized'][0] ?? '') && 0 === $matches['parenthesized'][1]) { $index = \strlen($matches['parenthesized_start'][0]); if ('' !== ($matches['conditional'][0] ?? '')) { if ('' !== ($matches['conditional_cond_left_types'][0] ?? '')) { $this->innerTypeExpressions[] = [ 'start_index' => $index, 'expression' => $this->inner($matches['conditional_cond_left_types'][0]), ]; } $index += \strlen($matches['conditional_cond_left'][0]) + \strlen($matches['conditional_cond_middle'][0]); $this->innerTypeExpressions[] = [ 'start_index' => $index, 'expression' => $this->inner($matches['conditional_cond_right_types'][0]), ]; $index += \strlen($matches['conditional_cond_right_types'][0]) + \strlen($matches['conditional_true_start'][0]); $this->innerTypeExpressions[] = [ 'start_index' => $index, 'expression' => $this->inner($matches['conditional_true_types'][0]), ]; $index += \strlen($matches['conditional_true_types'][0]) + \strlen($matches['conditional_false_start'][0]); $this->innerTypeExpressions[] = [ 'start_index' => $index, 'expression' => $this->inner($matches['conditional_false_types'][0]), ]; } else { $this->innerTypeExpressions[] = [ 'start_index' => $index, 'expression' => $this->inner($matches['parenthesized_types'][0]), ]; } } elseif ('' !== $matches['class_constant'][0]) { $this->innerTypeExpressions[] = [ 'start_index' => 0, 'expression' => $this->inner($matches['class_constant_name'][0]), ]; } } private function parseCommaSeparatedInnerTypes(int $startIndex, string $value): void { $index = 0; while (\strlen($value) !== $index) { Preg::match( '{\G'.self::REGEX_TYPES.'(?:\h*,[\h\v*]*|$)}', $value, $matches, 0, $index, ); $this->innerTypeExpressions[] = [ 'start_index' => $startIndex + $index, 'expression' => $this->inner($matches['types']), ]; $index += \strlen($matches[0]); } } private function parseCallableTemplateInnerTypes(int $startIndex, string $value): void { $index = 0; while (\strlen($value) !== $index) { Preg::match( '{\G(?:(?=1)0'.self::REGEX_TYPES.'|(?<_callable_template_inner>(?&callable_template_inner))(?:\h*,\h*|$))}', $value, $prematches, 0, $index, ); $consumedValue = $prematches['_callable_template_inner']; $consumedValueLength = \strlen($consumedValue); $consumedCommaLength = \strlen($prematches[0]) - $consumedValueLength; $addedPrefix = 'Closure<'; Preg::match( '{^'.self::REGEX_TYPES.'$}', $addedPrefix.$consumedValue.'>(): void', $matches, \PREG_OFFSET_CAPTURE, ); if ('' !== $matches['callable_template_inner_b'][0]) { $this->innerTypeExpressions[] = [ 'start_index' => $startIndex + $index + $matches['callable_template_inner_b_types'][1] - \strlen($addedPrefix), 'expression' => $this->inner($matches['callable_template_inner_b_types'][0]), ]; } if ('' !== $matches['callable_template_inner_d'][0]) { $this->innerTypeExpressions[] = [ 'start_index' => $startIndex + $index + $matches['callable_template_inner_d_types'][1] - \strlen($addedPrefix), 'expression' => $this->inner($matches['callable_template_inner_d_types'][0]), ]; } $index += $consumedValueLength + $consumedCommaLength; } } private function parseCallableArgumentTypes(int $startIndex, string $value): void { $index = 0; while (\strlen($value) !== $index) { Preg::match( '{\G(?:(?=1)0'.self::REGEX_TYPES.'|(?<_callable_argument>(?&callable_argument))(?:\h*,\h*|$))}', $value, $prematches, 0, $index, ); $consumedValue = $prematches['_callable_argument']; $consumedValueLength = \strlen($consumedValue); $consumedCommaLength = \strlen($prematches[0]) - $consumedValueLength; $addedPrefix = 'Closure('; Preg::match( '{^'.self::REGEX_TYPES.'$}', $addedPrefix.$consumedValue.'): void', $matches, \PREG_OFFSET_CAPTURE, ); $this->innerTypeExpressions[] = [ 'start_index' => $startIndex + $index, 'expression' => $this->inner($matches['callable_argument_type'][0]), ]; $index += $consumedValueLength + $consumedCommaLength; } } private function parseArrayShapeInnerTypes(int $startIndex, string $value): void { $index = 0; while (\strlen($value) !== $index) { Preg::match( '{\G(?:(?=1)0'.self::REGEX_TYPES.'|(?<_array_shape_inner>(?&array_shape_inner))(?:\h*,[\h\v*]*|$))}', $value, $prematches, 0, $index, ); $consumedValue = $prematches['_array_shape_inner']; $consumedValueLength = \strlen($consumedValue); $consumedCommaLength = \strlen($prematches[0]) - $consumedValueLength; $addedPrefix = 'array{'; Preg::match( '{^'.self::REGEX_TYPES.'$}', $addedPrefix.$consumedValue.'}', $matches, \PREG_OFFSET_CAPTURE, ); $this->innerTypeExpressions[] = [ 'start_index' => $startIndex + $index + $matches['array_shape_inner_value'][1] - \strlen($addedPrefix), 'expression' => $this->inner($matches['array_shape_inner_value'][0]), ]; $index += $consumedValueLength + $consumedCommaLength; } } private function inner(string $value): self { return new self($value, $this->namespace, $this->namespaceUses); } private function getParentType(string $type1, string $type2): ?string { $types = [ $this->normalize($type1), $this->normalize($type2), ]; natcasesort($types); $types = implode('|', $types); $parents = [ 'array|Traversable' => 'iterable', 'array|iterable' => 'iterable', 'iterable|Traversable' => 'iterable', 'self|static' => 'self', ]; return $parents[$types] ?? null; } private function normalize(string $type): string { if (isset(self::ALIASES[$type])) { return self::ALIASES[$type]; } if (\in_array($type, [ 'array', 'bool', 'callable', 'false', 'float', 'int', 'iterable', 'mixed', 'never', 'null', 'object', 'resource', 'string', 'true', 'void', ], true)) { return $type; } if (Preg::match('/\[\]$/', $type)) { return 'array'; } if (Preg::match('/^(.+?)</', $type, $matches)) { return $matches[1]; } if (str_starts_with($type, '\\')) { return substr($type, 1); } foreach ($this->namespaceUses as $namespaceUse) { if ($namespaceUse->getShortName() === $type) { return $namespaceUse->getFullName(); } } if (null === $this->namespace || $this->namespace->isGlobalNamespace()) { return $type; } return "{$this->namespace->getFullName()}\\{$type}"; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/DocBlock/TagComparator.php
src/DocBlock/TagComparator.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\DocBlock; /** * This class is responsible for comparing tags to see if they should be kept * together, or kept apart. * * @author Graham Campbell <hello@gjcampbell.co.uk> * @author Jakub Kwaśniewski <jakub@zero-85.pl> * * @deprecated * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class TagComparator { /** * Groups of tags that should be allowed to immediately follow each other. * * @var non-empty-list<non-empty-list<string>> * * @internal */ public const DEFAULT_GROUPS = [ ['deprecated', 'link', 'see', 'since'], ['author', 'copyright', 'license'], ['category', 'package', 'subpackage'], ['property', 'property-read', 'property-write'], ]; /** * Should the given tags be kept together, or kept apart? * * @param list<list<string>> $groups */ public static function shouldBeTogether(Tag $first, Tag $second, array $groups = self::DEFAULT_GROUPS): bool { @trigger_error('Method '.__METHOD__.' is deprecated and will be removed in version 4.0.', \E_USER_DEPRECATED); $firstName = $first->getName(); $secondName = $second->getName(); if ($firstName === $secondName) { return true; } foreach ($groups as $group) { if (\in_array($firstName, $group, true) && \in_array($secondName, $group, true)) { return true; } } return false; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/DocBlock/DocBlock.php
src/DocBlock/DocBlock.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\DocBlock; use PhpCsFixer\Preg; use PhpCsFixer\Tokenizer\Analyzer\Analysis\NamespaceAnalysis; use PhpCsFixer\Tokenizer\Analyzer\Analysis\NamespaceUseAnalysis; /** * This class represents a docblock. * * It internally splits it up into "lines" that we can manipulate. * * @author Graham Campbell <hello@gjcampbell.co.uk> * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class DocBlock implements \Stringable { /** * @var list<Line> */ private array $lines = []; /** * @var null|list<Annotation> */ private ?array $annotations = null; private ?NamespaceAnalysis $namespace; /** * @var list<NamespaceUseAnalysis> */ private array $namespaceUses; /** * @param list<NamespaceUseAnalysis> $namespaceUses */ public function __construct(string $content, ?NamespaceAnalysis $namespace = null, array $namespaceUses = []) { foreach (Preg::split('/([^\n\r]+\R*)/', $content, -1, \PREG_SPLIT_NO_EMPTY | \PREG_SPLIT_DELIM_CAPTURE) as $line) { $this->lines[] = new Line($line); } $this->namespace = $namespace; $this->namespaceUses = $namespaceUses; } public function __toString(): string { return $this->getContent(); } /** * Get this docblock's lines. * * @return list<Line> */ public function getLines(): array { return $this->lines; } /** * Get a single line. */ public function getLine(int $pos): ?Line { return $this->lines[$pos] ?? null; } /** * Get this docblock's annotations. * * @return list<Annotation> */ public function getAnnotations(): array { if (null !== $this->annotations) { return $this->annotations; } $this->annotations = []; $total = \count($this->lines); for ($index = 0; $index < $total; ++$index) { if ($this->lines[$index]->containsATag()) { // get all the lines that make up the annotation $lines = \array_slice($this->lines, $index, $this->findAnnotationLength($index), true); \assert([] !== $lines); $annotation = new Annotation($lines, $this->namespace, $this->namespaceUses); // move the index to the end of the annotation to avoid // checking it again because we know the lines inside the // current annotation cannot be part of another annotation $index = $annotation->getEnd(); // add the current annotation to the list of annotations $this->annotations[] = $annotation; } } return $this->annotations; } public function isMultiLine(): bool { return 1 !== \count($this->lines); } /** * Take a one line doc block, and turn it into a multi line doc block. */ public function makeMultiLine(string $indent, string $lineEnd): void { if ($this->isMultiLine()) { return; } $lineContent = $this->getSingleLineDocBlockEntry($this->lines[0]); if ('' === $lineContent) { $this->lines = [ new Line('/**'.$lineEnd), new Line($indent.' *'.$lineEnd), new Line($indent.' */'), ]; return; } $this->lines = [ new Line('/**'.$lineEnd), new Line($indent.' * '.$lineContent.$lineEnd), new Line($indent.' */'), ]; } public function makeSingleLine(): void { if (!$this->isMultiLine()) { return; } $usefulLines = array_filter( $this->lines, static fn (Line $line): bool => $line->containsUsefulContent(), ); if (1 < \count($usefulLines)) { return; } $lineContent = ''; if (\count($usefulLines) > 0) { $lineContent = $this->getSingleLineDocBlockEntry(array_shift($usefulLines)); } $this->lines = [new Line('/** '.$lineContent.' */')]; } public function getAnnotation(int $pos): ?Annotation { $annotations = $this->getAnnotations(); return $annotations[$pos] ?? null; } /** * Get specific types of annotations only. * * @param list<string>|string $types * * @return list<Annotation> */ public function getAnnotationsOfType($types): array { $typesToSearchFor = (array) $types; $annotations = []; foreach ($this->getAnnotations() as $annotation) { $tagName = $annotation->getTag()->getName(); if (\in_array($tagName, $typesToSearchFor, true)) { $annotations[] = $annotation; } } return $annotations; } /** * Get the actual content of this docblock. */ public function getContent(): string { return implode('', $this->lines); } private function findAnnotationLength(int $start): int { $index = $start; while (($line = $this->getLine(++$index)) !== null) { if ($line->containsATag()) { // we've 100% reached the end of the description if we get here break; } if (!$line->containsUsefulContent()) { // if next line is also non-useful, or contains a tag, then we're done here $next = $this->getLine($index + 1); if (null === $next || !$next->containsUsefulContent() || $next->containsATag()) { break; } // otherwise, continue, the annotation must have contained a blank line in its description } } return $index - $start; } private function getSingleLineDocBlockEntry(Line $line): string { $lineString = $line->getContent(); if ('' === $lineString) { return $lineString; } $lineString = str_replace('*/', '', $lineString); $lineString = trim($lineString); if (str_starts_with($lineString, '/**')) { $lineString = substr($lineString, 3); } elseif (str_starts_with($lineString, '*')) { $lineString = substr($lineString, 1); } return trim($lineString); } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/Error/ErrorsManager.php
src/Error/ErrorsManager.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\Error; /** * Manager of errors that occur during fixing. * * @author Dariusz Rumiński <dariusz.ruminski@gmail.com> * * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class ErrorsManager { /** * @var list<Error> */ private array $errors = []; /** * Returns errors reported during linting before fixing. * * @return list<Error> */ public function getInvalidErrors(): array { return array_values(array_filter($this->errors, static fn (Error $error): bool => Error::TYPE_INVALID === $error->getType())); } /** * Returns errors reported during fixing. * * @return list<Error> */ public function getExceptionErrors(): array { return array_values(array_filter($this->errors, static fn (Error $error): bool => Error::TYPE_EXCEPTION === $error->getType())); } /** * Returns errors reported during linting after fixing. * * @return list<Error> */ public function getLintErrors(): array { return array_values(array_filter($this->errors, static fn (Error $error): bool => Error::TYPE_LINT === $error->getType())); } /** * @return list<Error> */ public function getAllErrors(): array { return $this->errors; } /** * Returns errors reported for specified path. * * @return list<Error> */ public function forPath(string $path): array { return array_values(array_filter($this->errors, static fn (Error $error): bool => $path === $error->getFilePath())); } /** * Returns true if no errors were reported. */ public function isEmpty(): bool { return [] === $this->errors; } public function report(Error $error): void { $this->errors[] = $error; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/Error/SourceExceptionFactory.php
src/Error/SourceExceptionFactory.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\Error; /** * @readonly * * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class SourceExceptionFactory { /** * @param array{class: class-string<\Throwable>, message: string, code: int, file: string, line: int} $error */ public static function fromArray(array $error): \Throwable { $exceptionClass = $error['class']; try { $exception = new $exceptionClass($error['message'], $error['code']); if ( $exception->getMessage() !== $error['message'] || $exception->getCode() !== $error['code'] ) { throw new \RuntimeException('Failed to create exception from array. Message and code are not the same.'); } } catch (\Throwable $e) { $exception = new \RuntimeException( \sprintf('[%s] %s', $exceptionClass, $error['message']), $error['code'], ); } try { $exceptionReflection = new \ReflectionClass($exception); foreach (['file', 'line'] as $property) { $propertyReflection = $exceptionReflection->getProperty($property); if (\PHP_VERSION_ID < 8_01_00) { $propertyReflection->setAccessible(true); } $propertyReflection->setValue($exception, $error[$property]); if (\PHP_VERSION_ID < 8_01_00) { $propertyReflection->setAccessible(false); } } } catch (\Throwable $reflectionException) { // Ignore if we were not able to set file/line properties. In most cases it should be fine, // we just need to make sure nothing is broken when we recreate errors from raw data passed from worker. } return $exception; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/Error/Error.php
src/Error/Error.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\Error; /** * An abstraction for errors that can occur before and during fixing. * * @author Andreas Möller <am@localheinz.com> * * @readonly * * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class Error implements \JsonSerializable { /** * Error which has occurred in linting phase, before applying any fixers. */ public const TYPE_INVALID = 1; /** * Error which has occurred during fixing phase. */ public const TYPE_EXCEPTION = 2; /** * Error which has occurred in linting phase, after applying any fixers. */ public const TYPE_LINT = 3; /** @var self::TYPE_* */ private int $type; private string $filePath; private ?\Throwable $source; /** * @var list<string> */ private array $appliedFixers; private ?string $diff; /** * @param self::TYPE_* $type * @param list<string> $appliedFixers */ public function __construct(int $type, string $filePath, ?\Throwable $source = null, array $appliedFixers = [], ?string $diff = null) { $this->type = $type; $this->filePath = $filePath; $this->source = $source; $this->appliedFixers = $appliedFixers; $this->diff = $diff; } public function getFilePath(): string { return $this->filePath; } public function getSource(): ?\Throwable { return $this->source; } public function getType(): int { return $this->type; } /** * @return list<string> */ public function getAppliedFixers(): array { return $this->appliedFixers; } public function getDiff(): ?string { return $this->diff; } /** * @return array{ * type: self::TYPE_*, * filePath: string, * source: null|array{class: class-string, message: string, code: int, file: string, line: int}, * appliedFixers: list<string>, * diff: null|string * } */ public function jsonSerialize(): array { return [ 'type' => $this->type, 'filePath' => $this->filePath, 'source' => null !== $this->source ? [ 'class' => \get_class($this->source), 'message' => $this->source->getMessage(), 'code' => $this->source->getCode(), 'file' => $this->source->getFile(), 'line' => $this->source->getLine(), ] : null, 'appliedFixers' => $this->appliedFixers, 'diff' => $this->diff, ]; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/FixerConfiguration/DeprecatedFixerOption.php
src/FixerConfiguration/DeprecatedFixerOption.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\FixerConfiguration; /** * @readonly * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class DeprecatedFixerOption implements DeprecatedFixerOptionInterface { private FixerOptionInterface $option; private string $deprecationMessage; public function __construct(FixerOptionInterface $option, string $deprecationMessage) { $this->option = $option; $this->deprecationMessage = $deprecationMessage; } public function getName(): string { return $this->option->getName(); } public function getDescription(): string { return $this->option->getDescription(); } public function hasDefault(): bool { return $this->option->hasDefault(); } /** * @return mixed */ public function getDefault() { return $this->option->getDefault(); } public function getAllowedTypes(): ?array { return $this->option->getAllowedTypes(); } public function getAllowedValues(): ?array { return $this->option->getAllowedValues(); } public function getNormalizer(): ?\Closure { return $this->option->getNormalizer(); } public function getDeprecationMessage(): string { return $this->deprecationMessage; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/FixerConfiguration/AllowedValueSubset.php
src/FixerConfiguration/AllowedValueSubset.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\FixerConfiguration; /** * @readonly * * @internal * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class AllowedValueSubset { /** * @var non-empty-list<string> */ private array $allowedValues; /** * @param non-empty-list<string> $allowedValues */ public function __construct(array $allowedValues) { sort($allowedValues, \SORT_FLAG_CASE | \SORT_STRING); $this->allowedValues = $allowedValues; } /** * Checks whether the given values are a subset of the allowed ones. * * @param mixed $values the value to validate */ public function __invoke($values): bool { if (!\is_array($values)) { return false; } foreach ($values as $value) { if (!\in_array($value, $this->allowedValues, true)) { return false; } } return true; } /** * @return non-empty-list<string> */ public function getAllowedValues(): array { return $this->allowedValues; } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/FixerConfiguration/FixerOptionInterface.php
src/FixerConfiguration/FixerOptionInterface.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\FixerConfiguration; /** * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ interface FixerOptionInterface { public function getName(): string; public function getDescription(): string; public function hasDefault(): bool; /** * @return mixed * * @throws \LogicException when no default value is defined */ public function getDefault(); /** * @return null|list<string> */ public function getAllowedTypes(): ?array; /** * @return null|non-empty-list<null|(callable(mixed): bool)|scalar> */ public function getAllowedValues(): ?array; public function getNormalizer(): ?\Closure; }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/FixerConfiguration/DeprecatedFixerOptionInterface.php
src/FixerConfiguration/DeprecatedFixerOptionInterface.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\FixerConfiguration; /** * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ interface DeprecatedFixerOptionInterface extends FixerOptionInterface { public function getDeprecationMessage(): string; }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false
PHP-CS-Fixer/PHP-CS-Fixer
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/63b024eaaf8a48445494964bd21a6c38c788f40f/src/FixerConfiguration/FixerOption.php
src/FixerConfiguration/FixerOption.php
<?php declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien Potencier <fabien@symfony.com> * Dariusz Rumiński <dariusz.ruminski@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\FixerConfiguration; /** * @readonly * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. */ final class FixerOption implements FixerOptionInterface { private string $name; private string $description; private bool $isRequired; /** * @var mixed */ private $default; /** * @var null|list<string> */ private ?array $allowedTypes; /** * @var null|non-empty-list<null|(callable(mixed): bool)|scalar> */ private ?array $allowedValues; private ?\Closure $normalizer; /** * @param mixed $default * @param null|list<string> $allowedTypes * @param null|non-empty-list<null|(callable(mixed): bool)|scalar> $allowedValues */ public function __construct( string $name, string $description, bool $isRequired = true, $default = null, ?array $allowedTypes = null, ?array $allowedValues = null, ?\Closure $normalizer = null ) { if ($isRequired && null !== $default) { throw new \LogicException('Required options cannot have a default value.'); } if (null !== $allowedValues) { foreach ($allowedValues as &$allowedValue) { if ($allowedValue instanceof \Closure) { $allowedValue = $this->unbind($allowedValue); } } } $this->name = $name; $this->description = $description; $this->isRequired = $isRequired; $this->default = $default; $this->allowedTypes = $allowedTypes; $this->allowedValues = $allowedValues; if (null !== $normalizer) { $this->normalizer = $this->unbind($normalizer); } else { $this->normalizer = null; } } public function getName(): string { return $this->name; } public function getDescription(): string { return $this->description; } public function hasDefault(): bool { return !$this->isRequired; } /** * @return mixed */ public function getDefault() { if (!$this->hasDefault()) { throw new \LogicException('No default value defined.'); } return $this->default; } public function getAllowedTypes(): ?array { return $this->allowedTypes; } public function getAllowedValues(): ?array { return $this->allowedValues; } public function getNormalizer(): ?\Closure { return $this->normalizer; } /** * Unbinds the given closure to avoid memory leaks. * * The closures provided to this class were probably defined in a fixer * class and thus bound to it by default. The configuration will then be * stored in {@see AbstractFixer::$configurationDefinition}, leading to the * following cyclic reference: * * fixer -> configuration definition -> options -> closures -> fixer * * This cyclic reference prevent the garbage collector to free memory as * all elements are still referenced. * * See {@see https://bugs.php.net/bug.php?id=69639 Bug #69639} for details. */ private function unbind(\Closure $closure): \Closure { return $closure->bindTo(null); } }
php
MIT
63b024eaaf8a48445494964bd21a6c38c788f40f
2026-01-04T15:02:54.911792Z
false