mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-06 00:05:42 +08:00
Upgrade phpstan to v2
This commit is contained in:
@@ -312,7 +312,7 @@ class ArtifactDownloader
|
||||
FileSystem::createDir(DOWNLOAD_PATH);
|
||||
}
|
||||
logger()->info('Downloading' . implode(', ', array_map(fn ($x) => " '{$x->getName()}'", $this->artifacts)) . " with concurrency {$this->parallel} ...");
|
||||
// Download artifacts parallely
|
||||
// Download artifacts parallelly
|
||||
if ($this->parallel > 1) {
|
||||
$this->downloadWithConcurrency();
|
||||
} else {
|
||||
|
||||
@@ -247,6 +247,7 @@ class ArtifactExtractor
|
||||
$artifact->emitAfterBinaryExtract($target_path, $platform);
|
||||
logger()->debug("Emitted after-binary-extract hooks for [{$name}]");
|
||||
|
||||
/* @phpstan-ignore-next-line */
|
||||
if ($hash !== null && $cache_info['cache_type'] !== 'file') {
|
||||
FileSystem::writeFile("{$target_path}/.spc-hash", $hash);
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ class PackageLoader
|
||||
}
|
||||
}
|
||||
|
||||
$pkg = self::$packages[$attribute_instance->name];
|
||||
$pkg = self::$packages[$attribute_instance->name] ?? null;
|
||||
|
||||
// Use the package instance if it's a Package subclass, otherwise create a new instance
|
||||
$instance_class = is_a($class_name, Package::class, true) ? $pkg : $refClass->newInstance();
|
||||
@@ -184,7 +184,7 @@ class PackageLoader
|
||||
if (!in_array($package_type, $pkg_type_attr, true)) {
|
||||
throw new RegistryException("Package [{$attribute_instance->name}] type mismatch: config type is [{$package_type}], but attribute type is [" . implode('|', $pkg_type_attr) . '].');
|
||||
}
|
||||
if ($pkg !== null && !PackageConfig::isPackageExists($pkg->getName())) {
|
||||
if ($pkg instanceof Package && !PackageConfig::isPackageExists($pkg->getName())) {
|
||||
throw new RegistryException("Package [{$pkg->getName()}] config not found for class {$class}");
|
||||
}
|
||||
|
||||
@@ -355,7 +355,7 @@ class PackageLoader
|
||||
$stage = $method_instance->stage;
|
||||
$stage = match (true) {
|
||||
is_string($stage) => $stage,
|
||||
is_array($stage) && count($stage) === 2 => $stage[1],
|
||||
count($stage) === 2 => $stage[1],
|
||||
default => throw new RegistryException('Invalid stage definition in BeforeStage attribute.'),
|
||||
};
|
||||
if ($method_instance->package_name === '' && $pkg === null) {
|
||||
|
||||
@@ -75,7 +75,7 @@ class LicenseDumper
|
||||
*
|
||||
* @param Artifact $artifact Artifact instance
|
||||
* @param string $target_dir Target directory
|
||||
* @param array<string, array> &$license_summary Summary data to populate
|
||||
* @param array &$license_summary Summary data to populate
|
||||
* @return bool True if dumped
|
||||
* @throws SPCInternalException
|
||||
*/
|
||||
|
||||
@@ -44,7 +44,7 @@ abstract class UnixUtil
|
||||
continue;
|
||||
}
|
||||
$name = preg_replace('/@.*$/', '', $name);
|
||||
if ($name !== '' && $name !== false) {
|
||||
if (!empty($name)) {
|
||||
$defined[] = $name;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user