You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Utils.php line 174:
Your are using something deprecated, see previous exception. Aborting execution because `PHP_CS_FIXER_FUTURE_MODE` environment variable is set
In RuleSet.php line 133:
Rule set "@PER" is deprecated. Use "@PER-CS" instead.
Example
php-cs-fixer describe braces
Describing rulesets is fine. This works fine: php-cs-fixer describe @PSR2
I should also note that running php-cs-fixer fix ... commands are fine too.
Runtime version
PHP CS Fixer 3.48.0 (9167592) Small Changes by Fabien Potencier, Dariusz Ruminski and contributors.
Used command
(click to expand)
$ tools/php-cs-fixer -vvv describe braces
PHP CS Fixer 3.48.0 (9167592) Small Changes by Fabien Potencier, Dariusz Ruminski and contributors.
PHP runtime: 8.3.1
Description of the `braces` rule.
Fixer class: PhpCsFixer\Fixer\Basic\BracesFixer.
DEPRECATED: use `single_space_around_construct`, `control_structure_braces`, `control_structure_continuation_position`, `declare_parentheses`, `no_multiple_statements_per_line`, `curly_braces_position`, `statement_indentation` and `no_extra_blank_lines` instead.
The body of each structure MUST be enclosed by braces. Braces should be properly placed. Body of braces should be properly indented.
Fixer is configurable using following options:
* allow_single_line_anonymous_class_with_empty_body (bool): whether single line anonymous class with empty body notation should be allowed; defaults to false
* allow_single_line_closure (bool): whether single line lambda notation should be allowed; defaults to false
* position_after_anonymous_constructs ('next' and 'same'): whether the opening brace should be placed on "next" or "same" line after anonymous constructs (anonymous classes and lambda functions); defaults to 'same'
* position_after_control_structures ('next' and 'same'): whether the opening brace should be placed on "next" or "same" line after control structures; defaults to 'same'
* position_after_functions_and_oop_constructs ('next' and 'same'): whether the opening brace should be placed on "next" or "same" line after classy constructs (non-anonymous classes, interfaces, traits, methods and non-lambda functions); defaults to 'next'
Fixing examples:
* Example #1. Fixing with the default configuration.
---------- begin diff ----------
--- Original
+++ New
@@ -1,25 +1,27 @@
<?php
-class Foo {
- public function bar($baz) {
- if ($baz = 900) echo "Hello!";
+class Foo
+{
+ public function bar($baz)
+ {
+ if ($baz = 900) {
+ echo "Hello!";
+ }
- if ($baz = 9000)
+ if ($baz = 9000) {
echo "Wait!";
+ }
- if ($baz == true)
- {
+ if ($baz == true) {
echo "Why?";
- }
- else
- {
+ } else {
echo "Ha?";
}
- if (is_array($baz))
- foreach ($baz as $b)
- {
+ if (is_array($baz)) {
+ foreach ($baz as $b) {
echo $b;
}
+ }
}
}
----------- end diff -----------
* Example #2. Fixing with configuration: ['allow_single_line_closure' => true].
---------- begin diff ----------
--- Original
+++ New
@@ -1,4 +1,5 @@
<?php
$positive = function ($item) { return $item >= 0; };
$negative = function ($item) {
- return $item < 0; };
+ return $item < 0;
+};
----------- end diff -----------
* Example #3. Fixing with configuration: ['position_after_functions_and_oop_constructs' => 'same'].
---------- begin diff ----------
--- Original
+++ New
@@ -1,27 +1,25 @@
<?php
-class Foo
-{
- public function bar($baz)
- {
- if ($baz = 900) echo "Hello!";
+class Foo {
+ public function bar($baz) {
+ if ($baz = 900) {
+ echo "Hello!";
+ }
- if ($baz = 9000)
+ if ($baz = 9000) {
echo "Wait!";
+ }
- if ($baz == true)
- {
+ if ($baz == true) {
echo "Why?";
- }
- else
- {
+ } else {
echo "Ha?";
}
- if (is_array($baz))
- foreach ($baz as $b)
- {
+ if (is_array($baz)) {
+ foreach ($baz as $b) {
echo $b;
}
+ }
}
}
----------- end diff -----------
In Utils.php line 174:
[RuntimeException]
Your are using something deprecated, see previous exception. Aborting execution because `PHP_CS_FIXER_FUTURE_MODE` environment variable is set
.
Exception trace:
at phar:///home/code/.phive/phars/php-cs-fixer-3.48.0.phar/src/Utils.php:174
PhpCsFixer\Utils::triggerDeprecation() at phar:///home/code/.phive/phars/php-cs-fixer-3.48.0.phar/src/RuleSet/RuleSet.php:133
PhpCsFixer\RuleSet\RuleSet->resolveSubset() at phar:///home/code/.phive/phars/php-cs-fixer-3.48.0.phar/src/RuleSet/RuleSet.php:103
PhpCsFixer\RuleSet\RuleSet->resolveSet() at phar:///home/code/.phive/phars/php-cs-fixer-3.48.0.phar/src/RuleSet/RuleSet.php:61
PhpCsFixer\RuleSet\RuleSet->__construct() at phar:///home/code/.phive/phars/php-cs-fixer-3.48.0.phar/src/Documentation/FixerDocumentGenerator.php:285
PhpCsFixer\Documentation\FixerDocumentGenerator::getSetsOfRule() at phar:///home/code/.phive/phars/php-cs-fixer-3.48.0.phar/src/Console/Command/DescribeCommand.php:320
PhpCsFixer\Console\Command\DescribeCommand->describeRule() at phar:///home/code/.phive/phars/php-cs-fixer-3.48.0.phar/src/Console/Command/DescribeCommand.php:122
PhpCsFixer\Console\Command\DescribeCommand->execute() at phar:///home/code/.phive/phars/php-cs-fixer-3.48.0.phar/vendor/symfony/console/Command/Command.php:298
Symfony\Component\Console\Command\Command->run() at phar:///home/code/.phive/phars/php-cs-fixer-3.48.0.phar/vendor/symfony/console/Application.php:1040
Symfony\Component\Console\Application->doRunCommand() at phar:///home/code/.phive/phars/php-cs-fixer-3.48.0.phar/vendor/symfony/console/Application.php:301
Symfony\Component\Console\Application->doRun() at phar:///home/code/.phive/phars/php-cs-fixer-3.48.0.phar/src/Console/Application.php:93
PhpCsFixer\Console\Application->doRun() at phar:///home/code/.phive/phars/php-cs-fixer-3.48.0.phar/vendor/symfony/console/Application.php:171
Symfony\Component\Console\Application->run() at /home/code/.phive/phars/php-cs-fixer-3.48.0.phar:102
In RuleSet.php line 133:
[RuntimeException]
Rule set "@PER" is deprecated. Use "@PER-CS" instead.
Exception trace:
at phar:///home/code/.phive/phars/php-cs-fixer-3.48.0.phar/src/RuleSet/RuleSet.php:133
PhpCsFixer\RuleSet\RuleSet->resolveSubset() at phar:///home/code/.phive/phars/php-cs-fixer-3.48.0.phar/src/RuleSet/RuleSet.php:103
PhpCsFixer\RuleSet\RuleSet->resolveSet() at phar:///home/code/.phive/phars/php-cs-fixer-3.48.0.phar/src/RuleSet/RuleSet.php:61
PhpCsFixer\RuleSet\RuleSet->__construct() at phar:///home/code/.phive/phars/php-cs-fixer-3.48.0.phar/src/Documentation/FixerDocumentGenerator.php:285
PhpCsFixer\Documentation\FixerDocumentGenerator::getSetsOfRule() at phar:///home/code/.phive/phars/php-cs-fixer-3.48.0.phar/src/Console/Command/DescribeCommand.php:320
PhpCsFixer\Console\Command\DescribeCommand->describeRule() at phar:///home/code/.phive/phars/php-cs-fixer-3.48.0.phar/src/Console/Command/DescribeCommand.php:122
PhpCsFixer\Console\Command\DescribeCommand->execute() at phar:///home/code/.phive/phars/php-cs-fixer-3.48.0.phar/vendor/symfony/console/Command/Command.php:298
Symfony\Component\Console\Command\Command->run() at phar:///home/code/.phive/phars/php-cs-fixer-3.48.0.phar/vendor/symfony/console/Application.php:1040
Symfony\Component\Console\Application->doRunCommand() at phar:///home/code/.phive/phars/php-cs-fixer-3.48.0.phar/vendor/symfony/console/Application.php:301
Symfony\Component\Console\Application->doRun() at phar:///home/code/.phive/phars/php-cs-fixer-3.48.0.phar/src/Console/Application.php:93
PhpCsFixer\Console\Application->doRun() at phar:///home/code/.phive/phars/php-cs-fixer-3.48.0.phar/vendor/symfony/console/Application.php:171
Symfony\Component\Console\Application->run() at /home/code/.phive/phars/php-cs-fixer-3.48.0.phar:102
describe [--config CONFIG] [--] <name>
Configuration file
The project config does not use @PER, I tried explicitly setting only the @PER-CS one and no joy:
I'm also using PHP_CS_FIXER_FUTURE_MODE=1. Setting to PHP_CS_FIXER_FUTURE_MODE=0 removes some warnings and instead prints:
Detected deprecations in use:
- Rule set "@PER" is deprecated. Use "@PER-CS" instead.
- Rule set "@PER:risky" is deprecated. Use "@PER-CS:risky" instead.
But again, @PER is not used.
The text was updated successfully, but these errors were encountered:
Thank you for your report @gerardroche 🙂. You see this deprecation (which causes exception in the future mode) because of FixerDocumentGenerator::getSetsOfRule() that you can see in the stack trace - when rule is described, each ruleset is checked for the existence of that rule in it, so we can list rulesets that rule is part of. Some of the rulesets are deprecated, that's why deprecation was there. It will be fixed when @kubawerlos rebases his branch (auto-merge enabled) and, obviously, when it's released 😉.
Bug report
Running
php-cs-fixer describe {rule}
emits unexpected deprecation notices:Example
Describing rulesets is fine. This works fine:
php-cs-fixer describe @PSR2
I should also note that running
php-cs-fixer fix ...
commands are fine too.Runtime version
Used command
(click to expand)
Configuration file
The project config does not use
@PER
, I tried explicitly setting only the@PER-CS
one and no joy:I'm also using
PHP_CS_FIXER_FUTURE_MODE=1
. Setting toPHP_CS_FIXER_FUTURE_MODE=0
removes some warnings and instead prints:But again,
@PER
is not used.The text was updated successfully, but these errors were encountered: