From 96df1dfcb684374e2ef24b2db4ee9513d14da059 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=B6ller?= Date: Wed, 30 Mar 2022 14:48:21 +0200 Subject: [PATCH] Fix: Conditions --- psalm-baseline.xml | 15 +++------------ src/Command/NormalizeCommand.php | 7 ++++++- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 36aff9e0..972c2c4d 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,20 +1,11 @@ - + - - $composerFile - $composerFile - $composerFile - $composerFile - $composerFile - $composerFile - $composerFile - $composerFile - $composerFile - $composerFile + + diff --git a/src/Command/NormalizeCommand.php b/src/Command/NormalizeCommand.php index 507abbd6..f216e6b6 100644 --- a/src/Command/NormalizeCommand.php +++ b/src/Command/NormalizeCommand.php @@ -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; @@ -132,7 +133,7 @@ protected function execute( $composerFile = $input->getArgument('file'); - if (null === $composerFile) { + if (!\is_string($composerFile)) { $composerFile = Factory::getComposerFile(); } @@ -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) {