Hi,
As the title says, the fixer is introducing deprecations from PhpUnit. i did check this issue #2501 which is closed already. There was a comment also about this same problem but i guess it did not received proper attention. Thats why i am creating a new issue here.
Thanks in advance,
Regards,
David
When reporting an issue (bug) please provide the following information:
$ php -v):=> PHP 7.2.12-1+ubuntu16.04.1+deb.sury.org+1 (cli)
$ php-cs-fixer -V):=> PHP CS Fixer 2.13.1 Yogi's BBQ by Fabien Potencier and Dariusz Ruminski (54814c6)
=> php php-cs-fixer.phar fix --quiet --dry-run --config=.php-cs-fixer
<?php
return PhpCsFixer\Config::create()
->setUsingCache(true)->setCacheFile(__DIR__.'/.ci/build/cache/.php_cs.cache')
->setRiskyAllowed(true)->setRules([
'@Symfony' => true,
'@Symfony:risky' => true,
'@PHP71Migration' => true,
'@PHP71Migration:risky' => true,
'header_comment' => ['header' => ''],
'declare_strict_types' => true,
'array_syntax' => array('syntax' => 'short'),
'yoda_style' => false,
'binary_operator_spaces' => array('operators' => ['=>' => null]),
'strict_comparison' => true,
'strict_param' => true,
'dir_constant' => true,
'php_unit_strict' => true,
'php_unit_no_expectation_annotation' => true,
'php_unit_ordered_covers' => true,
'is_null' => true,
'function_to_constant' => true,
'ordered_imports' => true,
'not_operator_with_successor_space' => true,
'combine_consecutive_issets' => true,
'combine_consecutive_unsets' => true,
'escape_implicit_backslashes' => true,
'no_superfluous_elseif' => true,
'no_useless_else' => true,
'static_lambda' => true,
'compact_nullable_typehint' => true,
'combine_consecutive_issets' => true,
'combine_consecutive_unsets' => true,
])
->setFinder(PhpCsFixer\Finder::create()->in([
__DIR__ . '/packages/*/src',
__DIR__ . '/packages/*/test',
__DIR__ . '/packages/*/database/migrations',
]));
/**
* @expectedException \Assert\InvalidArgumentException
*/
public function testFixer(): void
{
Assertion::notNull(null);
}
public function testFixer(): void
{
$this->setExpectedException(\Assert\InvalidArgumentException::class);
Assertion::notNull(null);
}
public function testFixer(): void
{
$this->expectException(\Assert\InvalidArgumentException::class);
Assertion::notNull(null);
}
it's using setExpectedException as it doesn't know which PHPUnit you are willing to use
add php_unit_expectation to your ruleset:
Usages of
->setExpectedException*methods MUST be replaced by->expectException*methods.
Most helpful comment
it's using
setExpectedExceptionas it doesn't know which PHPUnit you are willing to useadd
php_unit_expectationto your ruleset: