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
Add missing "use function" declarations #1450
Conversation
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.
LGTM otherwise
@@ -38,30 +38,30 @@ use Infection\Console\Application; | |||
use Infection\Container; | |||
use function Safe\getcwd; | |||
|
|||
if (in_array(PHP_SAPI, ['cli', 'phpdbg', 'embed'], true) === false) { | |||
echo PHP_EOL . 'Infection may only be invoked from a command line, got "' . PHP_SAPI . '"' . PHP_EOL; | |||
if (\in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true) === false) { |
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.
All of those could be use statements instead as well
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.
CS Fixer plainly refuses to make them so.
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.
I confirm - when I use import here and run make cs
, it removes import and adds \
1)) /home/maksrafalko/apps/infection/bin/infection (native_function_invocation, no_unused_imports)
On the other side, it works correctly for for example SourceDirGuesser.php
- when I remove import there, fixer adds it back and doesn't add \
:
1) /home/maksrafalko/apps/infection/src/Config/Guesser/SourceDirGuesser.php (native_function_invocation, global_namespace_import, ordered_imports)
it looks like a bug in PHP-CS-Fixer
@@ -36,11 +36,11 @@ declare(strict_types=1); | |||
use PhpCsFixer\Config; | |||
use PhpCsFixer\Finder; | |||
|
|||
$header = trim(sprintf( | |||
$header = \trim(\sprintf( |
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.
same here
set_error_handler(static function ($errno, $errstr): void { | ||
var_dump($errno, $errstr); | ||
}, E_ALL); | ||
\set_error_handler(static function ($errno, $errstr): void { |
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.
same here
@@ -33,13 +33,13 @@ | |||
|
|||
declare(strict_types=1); | |||
|
|||
if (!function_exists('xdebug_set_filter')) { | |||
if (!\function_exists('xdebug_set_filter')) { | |||
return; |
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.
same here
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.
It seems like that's the cost of having this ruleset work in other places. It just won't make them imported here and there.
@@ -38,30 +38,30 @@ use Infection\Console\Application; | |||
use Infection\Container; | |||
use function Safe\getcwd; | |||
|
|||
if (in_array(PHP_SAPI, ['cli', 'phpdbg', 'embed'], true) === false) { | |||
echo PHP_EOL . 'Infection may only be invoked from a command line, got "' . PHP_SAPI . '"' . PHP_EOL; | |||
if (\in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true) === false) { |
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.
I confirm - when I use import here and run make cs
, it removes import and adds \
1)) /home/maksrafalko/apps/infection/bin/infection (native_function_invocation, no_unused_imports)
On the other side, it works correctly for for example SourceDirGuesser.php
- when I remove import there, fixer adds it back and doesn't add \
:
1) /home/maksrafalko/apps/infection/src/Config/Guesser/SourceDirGuesser.php (native_function_invocation, global_namespace_import, ordered_imports)
it looks like a bug in PHP-CS-Fixer
TravisCI is still broken. It shows we have 0 credits of 0 for the current month :| Still didn't get a reply from them, so I temporarily disabled TravisCI from protected branches so you can merge. |
I think it's a bout time to un-require Travis CI for protected branches. |
@maks-rafalko thank you! |
It seems like this is the end of Travis CI we knew and loved. |
RIP Travis. |
This PR: