From 49eb14b6e4f022319234c6bafb4a2eff3145dc43 Mon Sep 17 00:00:00 2001 From: Tom Klingenberg Date: Tue, 12 Apr 2022 02:05:29 +0200 Subject: [PATCH] implicit "--no-check-lock" (10715, --no-check-lock; 3/?) ... squelch ... and there is no InputOption::VALUE_NEGATABLE [1]. issue: 10715 [1]: https://symfony.com/blog/new-in-symfony-5-3-negatable-command-options --- phpstan/baseline.neon | 10 ++++++++++ src/Composer/Command/ValidateCommand.php | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/phpstan/baseline.neon b/phpstan/baseline.neon index e8bb60c5cb57..bcf41c4b19f2 100644 --- a/phpstan/baseline.neon +++ b/phpstan/baseline.neon @@ -2375,6 +2375,11 @@ parameters: count: 2 path: ../src/Composer/Command/ValidateCommand.php + - + message: "#^Only booleans are allowed in &&, mixed given on the right side\\.$#" + count: 1 + path: ../src/Composer/Command/ValidateCommand.php + - message: "#^Only booleans are allowed in a negated boolean, array\\ given\\.$#" count: 1 @@ -2410,6 +2415,11 @@ parameters: count: 1 path: ../src/Composer/Command/ValidateCommand.php + - + message: "#^Only booleans are allowed in \\|\\|, mixed given on the right side\\.$#" + count: 1 + path: ../src/Composer/Command/ValidateCommand.php + - message: "#^Parameter \\#1 \\$function of function call_user_func expects callable\\(\\)\\: mixed, array\\{Composer\\\\Package\\\\RootPackageInterface, 'getDevRequires'\\|'getRequires'\\} given\\.$#" count: 1 diff --git a/src/Composer/Command/ValidateCommand.php b/src/Composer/Command/ValidateCommand.php index 3eb6b0b540a5..c9650c560f03 100644 --- a/src/Composer/Command/ValidateCommand.php +++ b/src/Composer/Command/ValidateCommand.php @@ -96,8 +96,8 @@ protected function execute(InputInterface $input, OutputInterface $output) $lockErrors = array(); $composer = Factory::create($io, $file, $input->hasParameterOption('--no-plugins')); - $checkLock = $checkLock && (bool)$composer->getConfig()->get('lock'); // config.lock = false ~= implicit --no-check-lock - $checkLock = $checkLock || $input->getOption('check-lock'); // --check-lock overrides + // config.lock = false ~= implicit --no-check-lock; --check-lock overrides + $checkLock = ($checkLock && $composer->getConfig()->get('lock')) || $input->getOption('check-lock'); $locker = $composer->getLocker(); if ($locker->isLocked() && !$locker->isFresh()) { $lockErrors[] = '- The lock file is not up to date with the latest changes in composer.json, it is recommended that you run `composer update` or `composer update `.';