Fix phpstan errors

main
Jordi Boggiano 2 years ago
parent 6be6ce7d9f
commit 62d5f4f295
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC

@ -2740,11 +2740,6 @@ parameters:
count: 1
path: ../src/Composer/DependencyResolver/GenericRule.php
-
message: "#^Cannot access offset 0 on array\\{int, Composer\\\\DependencyResolver\\\\Rule\\}\\|false\\.$#"
count: 1
path: ../src/Composer/DependencyResolver/LockTransaction.php
-
message: "#^Only booleans are allowed in &&, DateTime\\|null given on the left side\\.$#"
count: 1
@ -3050,16 +3045,6 @@ parameters:
count: 1
path: ../src/Composer/DependencyResolver/RuleWatchGraph.php
-
message: "#^Cannot access offset 0 on array\\{int, Composer\\\\DependencyResolver\\\\Rule\\}\\|false\\.$#"
count: 1
path: ../src/Composer/DependencyResolver/Solver.php
-
message: "#^Cannot access offset 1 on array\\{int, Composer\\\\DependencyResolver\\\\Rule\\}\\|false\\.$#"
count: 1
path: ../src/Composer/DependencyResolver/Solver.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 2
@ -3526,7 +3511,17 @@ parameters:
path: ../src/Composer/Downloader/HgDownloader.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
message: "#^Call to function in_array\\(\\) with arguments 20, array\\{0\\: 10\\|20, 1\\?\\: 20\\} and true will always evaluate to true\\.$#"
count: 1
path: ../src/Composer/Downloader/PathDownloader.php
-
message: "#^Call to function in_array\\(\\) with arguments 20, non\\-empty\\-array\\<int, 10\\|20\\> and true will always evaluate to true\\.$#"
count: 1
path: ../src/Composer/Downloader/PathDownloader.php
-
message: "#^Else branch is unreachable because previous condition is always true\\.$#"
count: 1
path: ../src/Composer/Downloader/PathDownloader.php
@ -5540,11 +5535,6 @@ parameters:
count: 1
path: ../src/Composer/Repository/FilterRepository.php
-
message: "#^Parameter \\#1 \\$pattern of static method Composer\\\\Pcre\\\\Preg\\:\\:isMatch\\(\\) expects string, string\\|null given\\.$#"
count: 1
path: ../src/Composer/Repository/FilterRepository.php
-
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 7
@ -5580,11 +5570,6 @@ parameters:
count: 2
path: ../src/Composer/Repository/PathRepository.php
-
message: "#^Offset 'versions' does not exist on array\\{symlink\\?\\: bool, relative\\?\\: bool, versions\\?\\: array\\<string, string\\>\\}\\.$#"
count: 1
path: ../src/Composer/Repository/PathRepository.php
-
message: "#^Only booleans are allowed in &&, string\\|false given on the right side\\.$#"
count: 1
@ -6997,7 +6982,7 @@ parameters:
-
message: "#^Offset 'options' does not exist on array\\{url\\: string, options\\?\\: array, copyTo\\?\\: string\\|null\\}\\.$#"
count: 5
count: 3
path: ../src/Composer/Util/HttpDownloader.php
-

@ -126,7 +126,7 @@ class PathDownloader extends FileDownloader implements VcsCapableDownloaderInter
}
}
} catch (IOException $e) {
if (in_array(self::STRATEGY_MIRROR, $allowedStrategies)) {
if (in_array(self::STRATEGY_MIRROR, $allowedStrategies, true)) {
if ($output) {
$this->io->writeError('');
$this->io->writeError(' <error>Symlink failed, fallback to use mirroring!</error>');
@ -272,7 +272,7 @@ class PathDownloader extends FileDownloader implements VcsCapableDownloaderInter
// Check we can use junctions safely if we are on Windows
if (Platform::isWindows() && self::STRATEGY_SYMLINK === $currentStrategy && !$this->safeJunctions()) {
if (!in_array(self::STRATEGY_MIRROR, $allowedStrategies)) {
if (!in_array(self::STRATEGY_MIRROR, $allowedStrategies, true)) {
throw new \RuntimeException('You are on an old Windows / old PHP combo which does not allow Composer to use junctions/symlinks and this path repository has symlink:true in its options so copying is not allowed');
}
$currentStrategy = self::STRATEGY_MIRROR;

@ -12,11 +12,13 @@
namespace Composer\Test;
use Composer\Autoload\ClassLoader;
use Composer\InstalledVersions;
use Composer\Semver\VersionParser;
class InstalledVersionsTest extends TestCase
{
/** @var array<ClassLoader> */
private static $previousRegisteredLoaders;
/**

Loading…
Cancel
Save