Fix bin/publish: copy docs.dist from project root

Fix bin/publish: use correct .env path for rspade_system
Fix bin/publish script: prevent grep exit code 1 from terminating script

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2025-10-21 02:08:33 +00:00
commit f6fac6c4bc
79758 changed files with 10547827 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
<?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;
use PhpCsFixer\Preg;
/**
* @internal
*/
abstract class AbstractMigrationSetDescription extends AbstractRuleSetDescription
{
public function getDescription(): string
{
$name = $this->getName();
if (Preg::match('#^@PHPUnit(\d+)(\d)Migration.*$#', $name, $matches)) {
return \sprintf('Rules to improve tests code for PHPUnit %d.%d compatibility.', $matches[1], $matches[2]);
}
if (Preg::match('#^@PHP([\d]{2})Migration.*$#', $name, $matches)) {
return \sprintf('Rules to improve code for PHP %d.%d compatibility.', $matches[1][0], $matches[1][1]);
}
throw new \RuntimeException(\sprintf('Cannot generate description for "%s" "%s".', static::class, $name));
}
}

View File

@@ -0,0 +1,35 @@
<?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;
/**
* @internal
*/
abstract class AbstractRuleSetDescription implements RuleSetDescriptionInterface
{
public function __construct() {}
public function getName(): string
{
$name = substr(static::class, 1 + strrpos(static::class, '\\'), -3);
return '@'.str_replace('Risky', ':risky', $name);
}
public function isRisky(): bool
{
return str_contains(static::class, 'Risky');
}
}

View File

@@ -0,0 +1,28 @@
<?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;
/**
* @author Greg Korba <greg@codito.dev>
*/
interface DeprecatedRuleSetDescriptionInterface extends RuleSetDescriptionInterface
{
/**
* Returns names of rule sets to use instead, if any.
*
* @return list<string>
*/
public function getSuccessorsNames(): array;
}

View File

@@ -0,0 +1,159 @@
<?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;
use PhpCsFixer\ConfigurationException\InvalidFixerConfigurationException;
use PhpCsFixer\Utils;
/**
* Set of rules to be used by fixer.
*
* @author Dariusz Rumiński <dariusz.ruminski@gmail.com>
*
* @readonly
*
* @internal
*/
final class RuleSet implements RuleSetInterface
{
/**
* Group of rules generated from input set.
*
* The key is name of rule, value is configuration array or true.
* The key must not point to any set.
*
* @var array<string, array<string, mixed>|true>
*/
private array $rules;
public function __construct(array $set = [])
{
foreach ($set as $name => $value) {
if ('' === $name) {
throw new \InvalidArgumentException('Rule/set name must not be empty.');
}
if (\is_int($name)) {
throw new \InvalidArgumentException(\sprintf('Missing value for "%s" rule/set.', $value));
}
if (!\is_bool($value) && !\is_array($value)) {
$message = str_starts_with($name, '@') ? 'Set must be enabled (true) or disabled (false). Other values are not allowed.' : 'Rule must be enabled (true), disabled (false) or configured (non-empty, assoc array). Other values are not allowed.';
if (null === $value) {
$message .= ' To disable the '.(str_starts_with($name, '@') ? 'set' : 'rule').', use "FALSE" instead of "NULL".';
}
throw new InvalidFixerConfigurationException($name, $message);
}
}
$this->rules = $this->resolveSet($set);
}
public function hasRule(string $rule): bool
{
return \array_key_exists($rule, $this->rules);
}
public function getRuleConfiguration(string $rule): ?array
{
if (!$this->hasRule($rule)) {
throw new \InvalidArgumentException(\sprintf('Rule "%s" is not in the set.', $rule));
}
if (true === $this->rules[$rule]) {
return null;
}
return $this->rules[$rule];
}
public function getRules(): array
{
return $this->rules;
}
/**
* Resolve input set into group of rules.
*
* @param array<string, array<string, mixed>|bool> $rules
*
* @return array<string, array<string, mixed>|true>
*/
private function resolveSet(array $rules): array
{
$resolvedRules = [];
// expand sets
foreach ($rules as $name => $value) {
if (str_starts_with($name, '@')) {
if (!\is_bool($value)) {
throw new \UnexpectedValueException(\sprintf('Nested rule set "%s" configuration must be a boolean.', $name));
}
$set = $this->resolveSubset($name, $value);
$resolvedRules = array_merge($resolvedRules, $set);
} else {
$resolvedRules[$name] = $value;
}
}
// filter out all resolvedRules that are off
$resolvedRules = array_filter(
$resolvedRules,
static fn ($value): bool => false !== $value
);
return $resolvedRules;
}
/**
* Resolve set rules as part of another set.
*
* If set value is false then disable all fixers in set,
* if not then get value from set item.
*
* @return array<string, array<string, mixed>|bool>
*/
private function resolveSubset(string $setName, bool $setValue): array
{
$ruleSet = RuleSets::getSetDefinition($setName);
if ($ruleSet instanceof DeprecatedRuleSetDescriptionInterface) {
$messageEnd = [] === $ruleSet->getSuccessorsNames()
? 'No replacement available'
: \sprintf('Use %s instead', Utils::naturalLanguageJoin($ruleSet->getSuccessorsNames()));
Utils::triggerDeprecation(new \RuntimeException("Rule set \"{$setName}\" is deprecated. {$messageEnd}."));
}
$rules = $ruleSet->getRules();
foreach ($rules as $name => $value) {
if (str_starts_with($name, '@')) {
$set = $this->resolveSubset($name, $setValue);
unset($rules[$name]);
$rules = array_merge($rules, $set);
} elseif (!$setValue) {
$rules[$name] = false;
} else {
$rules[$name] = $value;
}
}
return $rules;
}
}

View File

@@ -0,0 +1,34 @@
<?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;
/**
* @internal
*/
interface RuleSetDescriptionInterface
{
public function getDescription(): string;
public function getName(): string;
/**
* Get all rules from rules set.
*
* @return array<string, array<string, mixed>|bool>
*/
public function getRules(): array;
public function isRisky(): bool;
}

View File

@@ -0,0 +1,49 @@
<?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;
/**
* Set of rules to be used by fixer.
*
* Example of set: ["@PSR2" => true, "@PSR1" => false, "strict" => true].
*
* @author Dariusz Rumiński <dariusz.ruminski@gmail.com>
*/
interface RuleSetInterface
{
/**
* @param array<string, array<string, mixed>|bool> $set
*/
public function __construct(array $set = []);
/**
* Get configuration for given rule.
*
* @return null|array<string, mixed>
*/
public function getRuleConfiguration(string $rule): ?array;
/**
* Get all rules from rules set.
*
* @return array<string, array<string, mixed>|true>
*/
public function getRules(): array;
/**
* Check given rule is in rules set.
*/
public function hasRule(string $rule): bool;
}

View File

@@ -0,0 +1,72 @@
<?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;
use Symfony\Component\Finder\Finder;
/**
* Set of rule sets to be used by fixer.
*
* @internal
*/
final class RuleSets
{
/**
* @var null|array<string, RuleSetDescriptionInterface>
*/
private static ?array $setDefinitions = null;
/**
* @return array<string, RuleSetDescriptionInterface>
*/
public static function getSetDefinitions(): array
{
if (null === self::$setDefinitions) {
self::$setDefinitions = [];
foreach (Finder::create()->files()->in(__DIR__.'/Sets') as $file) {
$class = 'PhpCsFixer\RuleSet\Sets\\'.$file->getBasename('.php');
/** @var RuleSetDescriptionInterface */
$set = new $class();
self::$setDefinitions[$set->getName()] = $set;
}
uksort(self::$setDefinitions, static fn (string $x, string $y): int => strnatcmp($x, $y));
}
return self::$setDefinitions;
}
/**
* @return list<string>
*/
public static function getSetDefinitionNames(): array
{
return array_keys(self::getSetDefinitions());
}
public static function getSetDefinition(string $name): RuleSetDescriptionInterface
{
$definitions = self::getSetDefinitions();
if (!isset($definitions[$name])) {
throw new \InvalidArgumentException(\sprintf('Set "%s" does not exist.', $name));
}
return $definitions[$name];
}
}

View File

@@ -0,0 +1,42 @@
<?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\AbstractRuleSetDescription;
/**
* @internal
*/
final class DoctrineAnnotationSet extends AbstractRuleSetDescription
{
public function getRules(): array
{
return [
'doctrine_annotation_array_assignment' => [
'operator' => ':',
],
'doctrine_annotation_braces' => true,
'doctrine_annotation_indentation' => true,
'doctrine_annotation_spaces' => [
'before_array_assignments_colon' => false,
],
];
}
public function getDescription(): string
{
return 'Rules covering Doctrine annotations with configuration based on examples found in `Doctrine Annotation documentation <https://www.doctrine-project.org/projects/doctrine-annotations/en/latest/annotations.html>`_ and `Symfony documentation <https://symfony.com/doc/master/bundles/SensioFrameworkExtraBundle/annotations/routing.html>`_.';
}
}

View File

@@ -0,0 +1,44 @@
<?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\AbstractRuleSetDescription;
/**
* @internal
*
* PER Coding Style v1.0.
*
* @see https://github.com/php-fig/per-coding-style/blob/1.0.0/spec.md
*/
final class PERCS1x0RiskySet extends AbstractRuleSetDescription
{
public function getName(): string
{
return '@PER-CS1.0: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/>`_.';
}
}

View File

@@ -0,0 +1,44 @@
<?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\AbstractRuleSetDescription;
/**
* @internal
*
* PER Coding Style v1.0.
*
* @see https://github.com/php-fig/per-coding-style/blob/1.0.0/spec.md
*/
final class PERCS1x0Set extends AbstractRuleSetDescription
{
public function getName(): string
{
return '@PER-CS1.0';
}
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/>`_.';
}
}

View File

@@ -0,0 +1,44 @@
<?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\AbstractRuleSetDescription;
/**
* @internal
*
* PER Coding Style v2.0.
*
* @see https://github.com/php-fig/per-coding-style/blob/2.0.0/spec.md
*/
final class PERCS2x0RiskySet extends AbstractRuleSetDescription
{
public function getName(): string
{
return '@PER-CS2.0:risky';
}
public function getRules(): array
{
return [
'@PER-CS1.0:risky' => true,
];
}
public function getDescription(): string
{
return 'Rules that follow `PER Coding Style 2.0 <https://www.php-fig.org/per/coding-style/>`_.';
}
}

View File

@@ -0,0 +1,112 @@
<?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\AbstractRuleSetDescription;
/**
* @internal
*
* PER Coding Style v2.0.
*
* @see https://github.com/php-fig/per-coding-style/blob/2.0.0/spec.md
*/
final class PERCS2x0Set extends AbstractRuleSetDescription
{
public function getName(): string
{
return '@PER-CS2.0';
}
public function getRules(): array
{
return [
'@PER-CS1.0' => true,
'array_indentation' => true,
'array_syntax' => true,
'cast_spaces' => true,
'concat_space' => ['spacing' => 'one'],
'function_declaration' => [
'closure_fn_spacing' => 'none',
],
'method_argument_space' => true,
'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/>`_.';
}
}

View File

@@ -0,0 +1,44 @@
<?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\AbstractRuleSetDescription;
/**
* @internal
*
* PER Coding Style v3.0.
*
* @see https://github.com/php-fig/per-coding-style/blob/3.0.0/spec.md
*/
final class PERCS3x0RiskySet extends AbstractRuleSetDescription
{
public function getName(): string
{
return '@PER-CS3.0:risky';
}
public function getRules(): array
{
return [
'@PER-CS2.0:risky' => true,
];
}
public function getDescription(): string
{
return 'Rules that follow `PER Coding Style 3.0 <https://www.php-fig.org/per/coding-style/>`_.';
}
}

View File

@@ -0,0 +1,52 @@
<?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\AbstractRuleSetDescription;
/**
* @internal
*
* PER Coding Style v3.0.
*
* @see https://github.com/php-fig/per-coding-style/blob/3.0.0/spec.md
*/
final class PERCS3x0Set extends AbstractRuleSetDescription
{
public function getName(): string
{
return '@PER-CS3.0';
}
public function getRules(): array
{
return [
'@PER-CS2.0' => 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/>`_.';
}
}

View File

@@ -0,0 +1,40 @@
<?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\AbstractRuleSetDescription;
/**
* @internal
*/
final class PERCSRiskySet extends AbstractRuleSetDescription
{
public function getName(): string
{
return '@PER-CS:risky';
}
public function getRules(): array
{
return [
'@PER-CS3.0:risky' => true,
];
}
public function getDescription(): string
{
return 'Alias for the latest revision of PER-CS risky rules. Use it if you always want to be in sync with newest PER-CS standard.';
}
}

View File

@@ -0,0 +1,40 @@
<?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\AbstractRuleSetDescription;
/**
* @internal
*/
final class PERCSSet extends AbstractRuleSetDescription
{
public function getName(): string
{
return '@PER-CS';
}
public function getRules(): array
{
return [
'@PER-CS3.0' => true,
];
}
public function getDescription(): string
{
return 'Alias for the latest revision of PER-CS rules. Use it if you always want to be in sync with newest PER-CS standard.';
}
}

View File

@@ -0,0 +1,52 @@
<?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\AbstractRuleSetDescription;
use PhpCsFixer\RuleSet\DeprecatedRuleSetDescriptionInterface;
/**
* @internal
*
* @deprecated use `@PER-CS:risky` instead
*
* @TODO 4.0 remove me
*
* Last updated to PER Coding Style v2.0.
*/
final class PERRiskySet extends AbstractRuleSetDescription implements DeprecatedRuleSetDescriptionInterface
{
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'];
}
}

View File

@@ -0,0 +1,47 @@
<?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\AbstractRuleSetDescription;
use PhpCsFixer\RuleSet\DeprecatedRuleSetDescriptionInterface;
/**
* @internal
*
* @deprecated use `@PER-CS` instead
*
* @TODO 4.0 remove me
*
* Last updated to PER Coding Style v2.0.
*/
final class PERSet extends AbstractRuleSetDescription implements DeprecatedRuleSetDescriptionInterface
{
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-CS2.0`` instead if you want to stick with stable ruleset.';
}
public function getSuccessorsNames(): array
{
return ['@PER-CS'];
}
}

View File

@@ -0,0 +1,30 @@
<?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\AbstractMigrationSetDescription;
/**
* @internal
*/
final class PHP54MigrationSet extends AbstractMigrationSetDescription
{
public function getRules(): array
{
return [
'array_syntax' => true,
];
}
}

View File

@@ -0,0 +1,30 @@
<?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\AbstractMigrationSetDescription;
/**
* @internal
*/
final class PHP56MigrationRiskySet extends AbstractMigrationSetDescription
{
public function getRules(): array
{
return [
'pow_to_exponentiation' => true,
];
}
}

View File

@@ -0,0 +1,39 @@
<?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\AbstractMigrationSetDescription;
/**
* @internal
*/
final class PHP70MigrationRiskySet extends AbstractMigrationSetDescription
{
public function getRules(): array
{
return [
'@PHP56Migration: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',
],
],
];
}
}

View File

@@ -0,0 +1,31 @@
<?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\AbstractMigrationSetDescription;
/**
* @internal
*/
final class PHP70MigrationSet extends AbstractMigrationSetDescription
{
public function getRules(): array
{
return [
'@PHP54Migration' => true,
'ternary_to_null_coalescing' => true,
];
}
}

View File

@@ -0,0 +1,31 @@
<?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\AbstractMigrationSetDescription;
/**
* @internal
*/
final class PHP71MigrationRiskySet extends AbstractMigrationSetDescription
{
public function getRules(): array
{
return [
'@PHP70Migration:risky' => true,
'void_return' => true,
];
}
}

View File

@@ -0,0 +1,32 @@
<?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\AbstractMigrationSetDescription;
/**
* @internal
*/
final class PHP71MigrationSet extends AbstractMigrationSetDescription
{
public function getRules(): array
{
return [
'@PHP70Migration' => true,
'list_syntax' => true,
'visibility_required' => true,
];
}
}

View File

@@ -0,0 +1,34 @@
<?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\AbstractMigrationSetDescription;
/**
* @internal
*/
final class PHP73MigrationSet extends AbstractMigrationSetDescription
{
public function getRules(): array
{
return [
'@PHP71Migration' => true,
'heredoc_indentation' => true,
'method_argument_space' => ['after_heredoc' => true],
'no_whitespace_before_comma_in_array' => ['after_heredoc' => true],
'trailing_comma_in_multiline' => ['after_heredoc' => true],
];
}
}

View File

@@ -0,0 +1,33 @@
<?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\AbstractMigrationSetDescription;
/**
* @internal
*/
final class PHP74MigrationRiskySet extends AbstractMigrationSetDescription
{
public function getRules(): array
{
return [
'@PHP71Migration:risky' => true,
'implode_call' => true,
'no_alias_functions' => true,
'use_arrow_functions' => true,
];
}
}

View File

@@ -0,0 +1,33 @@
<?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\AbstractMigrationSetDescription;
/**
* @internal
*/
final class PHP74MigrationSet extends AbstractMigrationSetDescription
{
public function getRules(): array
{
return [
'@PHP73Migration' => true,
'assign_null_coalescing_to_coalesce_equal' => true,
'normalize_index_brace' => true,
'short_scalar_cast' => true,
];
}
}

View File

@@ -0,0 +1,40 @@
<?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\AbstractMigrationSetDescription;
/**
* @internal
*/
final class PHP80MigrationRiskySet extends AbstractMigrationSetDescription
{
public function getRules(): array
{
return [
'@PHP74Migration: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,
];
}
}

View File

@@ -0,0 +1,32 @@
<?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\AbstractMigrationSetDescription;
/**
* @internal
*/
final class PHP80MigrationSet extends AbstractMigrationSetDescription
{
public function getRules(): array
{
return [
'@PHP74Migration' => true,
'clean_namespace' => true,
'no_unset_cast' => true,
];
}
}

View File

@@ -0,0 +1,31 @@
<?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\AbstractMigrationSetDescription;
/**
* @internal
*/
final class PHP81MigrationSet extends AbstractMigrationSetDescription
{
public function getRules(): array
{
return [
'@PHP80Migration' => true,
'octal_notation' => true,
];
}
}

View File

@@ -0,0 +1,31 @@
<?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\AbstractMigrationSetDescription;
/**
* @internal
*/
final class PHP82MigrationRiskySet extends AbstractMigrationSetDescription
{
public function getRules(): array
{
return [
'@PHP80Migration:risky' => true,
'phpdoc_readonly_class_comment_to_keyword' => true,
];
}
}

View File

@@ -0,0 +1,31 @@
<?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\AbstractMigrationSetDescription;
/**
* @internal
*/
final class PHP82MigrationSet extends AbstractMigrationSetDescription
{
public function getRules(): array
{
return [
'@PHP81Migration' => true,
'simple_to_complex_string_variable' => true,
];
}
}

View File

@@ -0,0 +1,30 @@
<?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\AbstractMigrationSetDescription;
/**
* @internal
*/
final class PHP83MigrationSet extends AbstractMigrationSetDescription
{
public function getRules(): array
{
return [
'@PHP82Migration' => true,
];
}
}

View File

@@ -0,0 +1,32 @@
<?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\AbstractMigrationSetDescription;
/**
* @internal
*/
final class PHP84MigrationSet extends AbstractMigrationSetDescription
{
public function getRules(): array
{
return [
'@PHP83Migration' => true,
'new_expression_parentheses' => true,
'nullable_type_declaration_for_default_null_value' => true,
];
}
}

View File

@@ -0,0 +1,31 @@
<?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\AbstractMigrationSetDescription;
/**
* @internal
*/
final class PHPUnit100MigrationRiskySet extends AbstractMigrationSetDescription
{
public function getRules(): array
{
return [
'@PHPUnit91Migration:risky' => true,
'php_unit_data_provider_static' => ['force' => true],
];
}
}

View File

@@ -0,0 +1,33 @@
<?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\AbstractMigrationSetDescription;
/**
* @internal
*/
final class PHPUnit30MigrationRiskySet extends AbstractMigrationSetDescription
{
public function getRules(): array
{
return [
'php_unit_dedicate_assert' => [
'target' => PhpUnitTargetVersion::VERSION_3_0,
],
];
}
}

View File

@@ -0,0 +1,34 @@
<?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\AbstractMigrationSetDescription;
/**
* @internal
*/
final class PHPUnit32MigrationRiskySet extends AbstractMigrationSetDescription
{
public function getRules(): array
{
return [
'@PHPUnit30Migration:risky' => true,
'php_unit_no_expectation_annotation' => [
'target' => PhpUnitTargetVersion::VERSION_3_2,
],
];
}
}

View File

@@ -0,0 +1,34 @@
<?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\AbstractMigrationSetDescription;
/**
* @internal
*/
final class PHPUnit35MigrationRiskySet extends AbstractMigrationSetDescription
{
public function getRules(): array
{
return [
'@PHPUnit32Migration:risky' => true,
'php_unit_dedicate_assert' => [
'target' => PhpUnitTargetVersion::VERSION_3_5,
],
];
}
}

View File

@@ -0,0 +1,34 @@
<?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\AbstractMigrationSetDescription;
/**
* @internal
*/
final class PHPUnit43MigrationRiskySet extends AbstractMigrationSetDescription
{
public function getRules(): array
{
return [
'@PHPUnit35Migration:risky' => true,
'php_unit_no_expectation_annotation' => [
'target' => PhpUnitTargetVersion::VERSION_4_3,
],
];
}
}

View File

@@ -0,0 +1,34 @@
<?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\AbstractMigrationSetDescription;
/**
* @internal
*/
final class PHPUnit48MigrationRiskySet extends AbstractMigrationSetDescription
{
public function getRules(): array
{
return [
'@PHPUnit43Migration:risky' => true,
'php_unit_namespaced' => [
'target' => PhpUnitTargetVersion::VERSION_4_8,
],
];
}
}

View File

@@ -0,0 +1,34 @@
<?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\AbstractMigrationSetDescription;
/**
* @internal
*/
final class PHPUnit50MigrationRiskySet extends AbstractMigrationSetDescription
{
public function getRules(): array
{
return [
'@PHPUnit48Migration:risky' => true,
'php_unit_dedicate_assert' => [
'target' => PhpUnitTargetVersion::VERSION_5_0,
],
];
}
}

View File

@@ -0,0 +1,34 @@
<?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\AbstractMigrationSetDescription;
/**
* @internal
*/
final class PHPUnit52MigrationRiskySet extends AbstractMigrationSetDescription
{
public function getRules(): array
{
return [
'@PHPUnit50Migration:risky' => true,
'php_unit_expectation' => [
'target' => PhpUnitTargetVersion::VERSION_5_2,
],
];
}
}

View File

@@ -0,0 +1,34 @@
<?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\AbstractMigrationSetDescription;
/**
* @internal
*/
final class PHPUnit54MigrationRiskySet extends AbstractMigrationSetDescription
{
public function getRules(): array
{
return [
'@PHPUnit52Migration:risky' => true,
'php_unit_mock' => [
'target' => PhpUnitTargetVersion::VERSION_5_4,
],
];
}
}

View File

@@ -0,0 +1,34 @@
<?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\AbstractMigrationSetDescription;
/**
* @internal
*/
final class PHPUnit55MigrationRiskySet extends AbstractMigrationSetDescription
{
public function getRules(): array
{
return [
'@PHPUnit54Migration:risky' => true,
'php_unit_mock' => [
'target' => PhpUnitTargetVersion::VERSION_5_5,
],
];
}
}

View File

@@ -0,0 +1,37 @@
<?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\AbstractMigrationSetDescription;
/**
* @internal
*/
final class PHPUnit56MigrationRiskySet extends AbstractMigrationSetDescription
{
public function getRules(): array
{
return [
'@PHPUnit55Migration:risky' => true,
'php_unit_dedicate_assert' => [
'target' => PhpUnitTargetVersion::VERSION_5_6,
],
'php_unit_expectation' => [
'target' => PhpUnitTargetVersion::VERSION_5_6,
],
];
}
}

View File

@@ -0,0 +1,34 @@
<?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\AbstractMigrationSetDescription;
/**
* @internal
*/
final class PHPUnit57MigrationRiskySet extends AbstractMigrationSetDescription
{
public function getRules(): array
{
return [
'@PHPUnit56Migration:risky' => true,
'php_unit_namespaced' => [
'target' => PhpUnitTargetVersion::VERSION_5_7,
],
];
}
}

View File

@@ -0,0 +1,34 @@
<?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\AbstractMigrationSetDescription;
/**
* @internal
*/
final class PHPUnit60MigrationRiskySet extends AbstractMigrationSetDescription
{
public function getRules(): array
{
return [
'@PHPUnit57Migration:risky' => true,
'php_unit_namespaced' => [
'target' => PhpUnitTargetVersion::VERSION_6_0,
],
];
}
}

View File

@@ -0,0 +1,34 @@
<?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\AbstractMigrationSetDescription;
/**
* @internal
*/
final class PHPUnit75MigrationRiskySet extends AbstractMigrationSetDescription
{
public function getRules(): array
{
return [
'@PHPUnit60Migration:risky' => true,
'php_unit_dedicate_assert_internal_type' => [
'target' => PhpUnitTargetVersion::VERSION_7_5,
],
];
}
}

View File

@@ -0,0 +1,35 @@
<?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\AbstractMigrationSetDescription;
/**
* @internal
*/
final class PHPUnit84MigrationRiskySet extends AbstractMigrationSetDescription
{
public function getRules(): array
{
return [
'@PHPUnit60Migration:risky' => true,
'@PHPUnit75Migration:risky' => true,
'php_unit_expectation' => [
'target' => PhpUnitTargetVersion::VERSION_8_4,
],
];
}
}

View File

@@ -0,0 +1,31 @@
<?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\AbstractMigrationSetDescription;
/**
* @internal
*/
final class PHPUnit91MigrationRiskySet extends AbstractMigrationSetDescription
{
public function getRules(): array
{
return [
'@PHPUnit84Migration:risky' => true,
'php_unit_assert_new_names' => true,
];
}
}

View File

@@ -0,0 +1,36 @@
<?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\AbstractRuleSetDescription;
/**
* @internal
*/
final class PSR12RiskySet extends AbstractRuleSetDescription
{
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.';
}
}

View File

@@ -0,0 +1,123 @@
<?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\AbstractRuleSetDescription;
/**
* @internal
*/
final class PSR12Set extends AbstractRuleSetDescription
{
public function getRules(): array
{
return [
'@PSR2' => true,
'binary_operator_spaces' => [
'default' => 'at_least_single_space',
],
'blank_line_after_opening_tag' => true,
'blank_line_between_import_groups' => true,
'blank_lines_before_namespace' => true,
'braces_position' => [
'allow_single_line_empty_anonymous_classes' => true,
],
'class_definition' => [
'inline_constructor_arguments' => false, // handled by method_argument_space fixer
'space_before_parenthesis' => true, // defined in PSR12 ¶8. Anonymous Classes
],
'compact_nullable_type_declaration' => true,
'declare_equal_normalize' => true,
'lowercase_cast' => true,
'lowercase_static_reference' => true,
'new_with_parentheses' => true,
'no_blank_lines_after_class_opening' => true,
'no_extra_blank_lines' => [
'tokens' => [
'use', // defined in PSR12 ¶3. Declare Statements, Namespace, and Import Statements
],
],
'no_leading_import_slash' => true,
'no_whitespace_in_blank_line' => true,
'ordered_class_elements' => [
'order' => [
'use_trait',
],
],
'ordered_imports' => [
'imports_order' => [
'class',
'function',
'const',
],
'sort_algorithm' => 'none',
],
'return_type_declaration' => true,
'short_scalar_cast' => true,
'single_import_per_statement' => ['group_to_single_imports' => false],
'single_space_around_construct' => [
'constructs_followed_by_a_single_space' => [
'abstract',
'as',
'case',
'catch',
'class',
'const_import',
'do',
'else',
'elseif',
'final',
'finally',
'for',
'foreach',
'function',
'function_import',
'if',
'insteadof',
'interface',
'namespace',
'new',
'private',
'protected',
'public',
'static',
'switch',
'trait',
'try',
'use',
'use_lambda',
'while',
],
'constructs_preceded_by_a_single_space' => [
'as',
'else',
'elseif',
'use_lambda',
],
],
'single_trait_insert_per_statement' => true,
'ternary_operator_spaces' => true,
'unary_operator_spaces' => [
'only_dec_inc' => true,
],
'visibility_required' => true,
];
}
public function getDescription(): string
{
return 'Rules that follow `PSR-12 <https://www.php-fig.org/psr/psr-12/>`_ standard.';
}
}

View File

@@ -0,0 +1,36 @@
<?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\AbstractRuleSetDescription;
/**
* @internal
*/
final class PSR1Set extends AbstractRuleSetDescription
{
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.';
}
}

View File

@@ -0,0 +1,104 @@
<?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\AbstractRuleSetDescription;
/**
* @internal
*/
final class PSR2Set extends AbstractRuleSetDescription
{
public function getRules(): array
{
return [
'@PSR1' => true,
'blank_line_after_namespace' => true,
'braces_position' => true,
'class_definition' => true,
'constant_case' => true,
'control_structure_braces' => true,
'control_structure_continuation_position' => true,
'elseif' => true,
'function_declaration' => true,
'indentation_type' => true,
'line_ending' => true,
'lowercase_keywords' => true,
'method_argument_space' => [
'attribute_placement' => 'ignore',
'on_multiline' => 'ensure_fully_multiline',
],
'no_break_comment' => true,
'no_closing_tag' => true,
'no_multiple_statements_per_line' => true,
'no_space_around_double_colon' => true,
'no_spaces_after_function_name' => true,
'no_trailing_whitespace' => true,
'no_trailing_whitespace_in_comment' => true,
'single_blank_line_at_eof' => true,
'single_class_element_per_statement' => [
'elements' => [
'property',
],
],
'single_import_per_statement' => true,
'single_line_after_imports' => true,
'single_space_around_construct' => [
'constructs_followed_by_a_single_space' => [
'abstract',
'as',
'case',
'catch',
'class',
'do',
'else',
'elseif',
'final',
'for',
'foreach',
'function',
'if',
'interface',
'namespace',
'private',
'protected',
'public',
'static',
'switch',
'trait',
'try',
'use_lambda',
'while',
],
'constructs_preceded_by_a_single_space' => [
'as',
'else',
'elseif',
'use_lambda',
],
],
'spaces_inside_parentheses' => true,
'statement_indentation' => true,
'switch_case_semicolon_to_colon' => true,
'switch_case_space' => true,
'visibility_required' => ['elements' => ['method', 'property']],
];
}
public function getDescription(): string
{
return 'Rules that follow `PSR-2 <https://www.php-fig.org/psr/psr-2/>`_ standard.';
}
}

View File

@@ -0,0 +1,68 @@
<?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\AbstractRuleSetDescription;
/**
* @internal
*/
final class PhpCsFixerRiskySet extends AbstractRuleSetDescription
{
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 'Rule set as used by the PHP CS Fixer development team, highly opinionated.';
}
}

View File

@@ -0,0 +1,133 @@
<?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\AbstractRuleSetDescription;
/**
* @internal
*/
final class PhpCsFixerSet extends AbstractRuleSetDescription
{
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_mixed' => true,
'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' => true,
'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 'Rule set as used by the PHP CS Fixer development team, highly opinionated.';
}
}

View File

@@ -0,0 +1,79 @@
<?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\AbstractRuleSetDescription;
/**
* @internal
*/
final class SymfonyRiskySet extends AbstractRuleSetDescription
{
public function getRules(): array
{
return [
'@PHP56Migration: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 / PSR
'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>`_.';
}
}

View File

@@ -0,0 +1,236 @@
<?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\AbstractRuleSetDescription;
/**
* @internal
*/
final class SymfonySet extends AbstractRuleSetDescription
{
public function getRules(): array
{
return [
'@PER-CS3.0' => 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' => true, // overrides @PER-CS2.0
'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' => true,
'phpdoc_no_package' => true,
'phpdoc_no_useless_inheritdoc' => true,
'phpdoc_order' => [
'order' => [
'param',
'return',
'throws',
],
],
'phpdoc_return_self_reference' => true,
'phpdoc_scalar' => true,
'phpdoc_separation' => [
'groups' => [
['Annotation', 'NamedArgumentConstructor', 'Target'],
...PhpdocSeparationFixer::OPTION_GROUPS_DEFAULT,
],
],
'phpdoc_single_line_var_spacing' => true,
'phpdoc_summary' => true,
'phpdoc_tag_type' => [
'tags' => [
'inheritDoc' => 'inline',
],
],
'phpdoc_to_comment' => true,
'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' => true,
'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>`_.';
}
}