Skip to content
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

bug: Fix type error when using paths intersection mode #6734

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/Console/Command/FixCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
}

$progressType = $resolver->getProgress();
$finder = $resolver->getFinder();
$finder = new \ArrayIterator(iterator_to_array($resolver->getFinder()));

if (null !== $stdErr && $resolver->configFinderIsOverridden()) {
$stdErr->writeln(
Expand All @@ -283,7 +283,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
if ('none' === $progressType || null === $stdErr) {
$progressOutput = new NullOutput();
} else {
$finder = new \ArrayIterator(iterator_to_array($finder));
$progressOutput = new ProcessOutput(
$stdErr,
$this->eventDispatcher,
Expand Down
16 changes: 15 additions & 1 deletion tests/Console/Command/FixCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use PhpCsFixer\Console\Command\FixCommand;
use PhpCsFixer\Tests\TestCase;
use PhpCsFixer\ToolInfo;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Tester\CommandTester;

Expand All @@ -29,6 +30,19 @@
*/
final class FixCommandTest extends TestCase
{
public function testIntersectionPathMode(): void
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome to have the test for this!

{
$cmdTester = $this->doTestExecute([
'--path-mode' => 'intersection',
keradus marked this conversation as resolved.
Show resolved Hide resolved
'--show-progress' => 'none',
]);

static::assertSame(
Command::SUCCESS,
$cmdTester->getStatusCode()
);
}

public function testEmptyRulesValue(): void
{
$this->expectException(
Expand Down Expand Up @@ -93,7 +107,7 @@ private function getDefaultArguments(): array
return [
'path' => [__FILE__],
'--path-mode' => 'override',
'--allow-risky' => true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

'--allow-risky' => 'yes',
'--dry-run' => true,
'--using-cache' => 'no',
'--show-progress' => 'none',
Expand Down