Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d64e32c

Browse files
committed
Merge remote-tracking branch 'ktomk/patch-validate-no-check-lock' into 2.2
2 parents 0a8dfe6 + 939c998 commit d64e32c

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

phpstan/baseline.neon

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2365,6 +2365,11 @@ parameters:
23652365
count: 2
23662366
path: ../src/Composer/Command/ValidateCommand.php
23672367

2368+
-
2369+
message: "#^Only booleans are allowed in &&, mixed given on the right side\\.$#"
2370+
count: 1
2371+
path: ../src/Composer/Command/ValidateCommand.php
2372+
23682373
-
23692374
message: "#^Only booleans are allowed in a negated boolean, array\\<Composer\\\\Package\\\\BasePackage\\> given\\.$#"
23702375
count: 1
@@ -2400,6 +2405,11 @@ parameters:
24002405
count: 1
24012406
path: ../src/Composer/Command/ValidateCommand.php
24022407

2408+
-
2409+
message: "#^Only booleans are allowed in \\|\\|, mixed given on the right side\\.$#"
2410+
count: 1
2411+
path: ../src/Composer/Command/ValidateCommand.php
2412+
24032413
-
24042414
message: "#^Parameter \\#1 \\$function of function call_user_func expects callable\\(\\)\\: mixed, array\\{Composer\\\\Package\\\\RootPackageInterface, 'getDevRequires'\\|'getRequires'\\} given\\.$#"
24052415
count: 1

src/Composer/Command/ValidateCommand.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ protected function configure()
4545
->setDescription('Validates a composer.json and composer.lock.')
4646
->setDefinition(array(
4747
new InputOption('no-check-all', null, InputOption::VALUE_NONE, 'Do not validate requires for overly strict/loose constraints'),
48+
new InputOption('check-lock', null, InputOption::VALUE_NONE, 'Check if lock file is up to date (even config.lock is false, overrides --no-check-lock)'),
4849
new InputOption('no-check-lock', null, InputOption::VALUE_NONE, 'Do not check if lock file is up to date'),
4950
new InputOption('no-check-publish', null, InputOption::VALUE_NONE, 'Do not check for publish errors'),
5051
new InputOption('no-check-version', null, InputOption::VALUE_NONE, 'Do not report a warning if the version field is present'),
@@ -95,6 +96,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
9596

9697
$lockErrors = array();
9798
$composer = Factory::create($io, $file, $input->hasParameterOption('--no-plugins'));
99+
// config.lock = false ~= implicit --no-check-lock; --check-lock overrides
100+
$checkLock = ($checkLock && $composer->getConfig()->get('lock')) || $input->getOption('check-lock');
98101
$locker = $composer->getLocker();
99102
if ($locker->isLocked() && !$locker->isFresh()) {
100103
$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 <package name>`.';

0 commit comments

Comments
 (0)