New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Always stop when "PHP_CS_FIXER_FUTURE_MODE" is used #5601
Conversation
* | ||
* @param string $className | ||
*/ | ||
public function testThereIsNoTriggerErrorUsedDirectly($className) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
tests/UtilsTest.php
Outdated
@@ -289,6 +289,27 @@ public function provideCalculateBitmaskCases() | |||
]; | |||
} | |||
|
|||
/** | |||
* @group legacy | |||
* @expectedDeprecation The message |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we use expectDeprecationMessage
method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really, this method is actually expectExceptionMessage
call: https://github.com/sebastianbergmann/phpunit/blob/9.5.4/src/Framework/TestCase.php#L646
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't deprecation an exception under the hood?
also, the annotation is simply calling the method, isn't it ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't deprecation an exception under the hood?
yes, in the other test, but here - without PHP_CS_FIXER_FUTURE_MODE
on - it's only user deprecation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you try expectDeprecation
method of Sf phpunit bridge? https://symfony.com/doc/current/components/phpunit_bridge.html#id1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems I can.
Thank you @kubawerlos. |
Deprecations are not always stopping application when
PHP_CS_FIXER_FUTURE_MODE
is on.We can see that in first commit where rules with deprecation configuration was added the build have passed - and we run fixer with
PHP_CS_FIXER_FUTURE_MODE
flag: https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/v2.18.5/.github/workflows/ci.yml#L146The second commit is moving all
trigger_error
calls toUtils::triggerDeprecation
and there we decide basing onPHP_CS_FIXER_FUTURE_MODE
if throw an exception.3rd and 4th commits are restoring config and makes fabbot happy, respectively.