Skip to content

Commit

Permalink
Fix: Conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz committed Mar 30, 2022
1 parent 04947c4 commit 96df1df
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
15 changes: 3 additions & 12 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="4.16.1@aa7e400908833b10c0333861f86cd48c510b60eb">
<files psalm-version="4.22.0@fc2c6ab4d5fa5d644d8617089f012f3bb84b8703">
<file src="src/Command/NormalizeCommand.php">
<MixedArgument occurrences="9">
<code>$composerFile</code>
<code>$composerFile</code>
<code>$composerFile</code>
<code>$composerFile</code>
<code>$composerFile</code>
<code>$composerFile</code>
<code>$composerFile</code>
<code>$composerFile</code>
<code>$composerFile</code>
</MixedArgument>
<MixedAssignment occurrences="1">
<code>$composerFile</code>
</MixedAssignment>
<RedundantCondition occurrences="1"/>
<TypeDoesNotContainType occurrences="1"/>
</file>
<file src="test/Integration/Command/NormalizeCommand/AbstractTestCase.php">
<MixedArrayAccess occurrences="1">
Expand Down
7 changes: 6 additions & 1 deletion src/Command/NormalizeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
namespace Ergebnis\Composer\Normalize\Command;

use Composer\Command;
use Composer\Composer;
use Composer\Console\Application;
use Composer\Factory;
use Composer\IO;
Expand Down Expand Up @@ -132,7 +133,7 @@ protected function execute(

$composerFile = $input->getArgument('file');

if (null === $composerFile) {
if (!\is_string($composerFile)) {
$composerFile = Factory::getComposerFile();
}

Expand All @@ -141,6 +142,10 @@ protected function execute(
$composerFile,
);

if (!$composer instanceof Composer) {
throw Exception\ShouldNotHappen::create();
}

try {
$indentFromExtra = self::indentFromExtra($composer->getPackage()->getExtra());
} catch (\RuntimeException $exception) {
Expand Down

0 comments on commit 96df1df

Please sign in to comment.