From b166ef4b58e95226109c698db4c8865f29c0af84 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Tue, 7 Apr 2020 14:56:39 +0200 Subject: [PATCH] Fix more phpstan errors --- phpstan/config.neon | 14 +++----------- src/Composer/DependencyResolver/PoolBuilder.php | 4 ++-- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/phpstan/config.neon b/phpstan/config.neon index 7a489a9b0..9066fb63b 100644 --- a/phpstan/config.neon +++ b/phpstan/config.neon @@ -16,17 +16,6 @@ parameters: # ion cube is not installed - '~^Function ioncube_loader_\w+ not found\.$~' - # rar is not installed - - '~^Call to static method open\(\) on an unknown class RarArchive\.$~' - # imagick is not installed - - '~^Instantiated class Imagick not found\.$~' - # windows specific constants - - - message: '~^Constant PHP_WINDOWS_VERSION_MAJOR not found\.$~' - path: '*/src/Composer/Downloader/PathDownloader.php' - - - message: '~^Constant PHP_WINDOWS_VERSION_MINOR not found\.$~' - path: '*/src/Composer/Downloader/PathDownloader.php' # variables from global scope - '~^Undefined variable: \$vendorDir$~' @@ -35,6 +24,9 @@ parameters: # variable defined in eval - '~^Undefined variable: \$res$~' + # erroneous detection of missing const, see https://github.com/phpstan/phpstan/issues/2960 + - '~^Access to undefined constant ZipArchive::LIBZIP_VERSION.$~' + # we don't have different constructors for parent/child - '~^Unsafe usage of new static\(\)\.$~' diff --git a/src/Composer/DependencyResolver/PoolBuilder.php b/src/Composer/DependencyResolver/PoolBuilder.php index 420e75786..4df8b2b83 100644 --- a/src/Composer/DependencyResolver/PoolBuilder.php +++ b/src/Composer/DependencyResolver/PoolBuilder.php @@ -279,9 +279,9 @@ class PoolBuilder $loadNames[$replace] = null; // TODO should we try to merge constraints here? $this->nameConstraints[$replace] = null; - } elseif (!$request->getUpdateAllowTransitiveRootDependencies() && $this->isRootRequire($request, $replace) && !isset($this->updateAllowWarned[$require])) { + } elseif (!$request->getUpdateAllowTransitiveRootDependencies() && $this->isRootRequire($request, $replace) && !isset($this->updateAllowWarned[$replace])) { $this->updateAllowWarned[$replace] = true; - $this->io->writeError('Dependency "'.$require.'" is also a root requirement. Package has not been listed as an update argument, so keeping locked at old version. Use --with-all-dependencies to include root dependencies.'); + $this->io->writeError('Dependency "'.$replace.'" is also a root requirement. Package has not been listed as an update argument, so keeping locked at old version. Use --with-all-dependencies to include root dependencies.'); } } }