Remove all @throws PHPDoc, it's almost useless for SPC anymore

This commit is contained in:
crazywhalecc
2025-08-06 20:17:26 +08:00
committed by Jerry Ma
parent fa10142f13
commit 0c9a30256e
120 changed files with 169 additions and 1203 deletions

View File

@@ -4,7 +4,6 @@ declare(strict_types=1);
namespace SPC\store;
use SPC\exception\FileSystemException;
use SPC\exception\WrongUsageException;
class Config
@@ -22,10 +21,8 @@ class Config
/**
* Get pre-built configuration by name
*
* @param string $name The name of the pre-built configuration
* @return mixed The pre-built configuration or null if not found
* @throws WrongUsageException
* @throws FileSystemException
* @param string $name The name of the pre-built configuration
* @return mixed The pre-built configuration or null if not found
*/
public static function getPreBuilt(string $name): mixed
{
@@ -53,9 +50,8 @@ class Config
/**
* Get source configuration by name
*
* @param string $name The name of the source
* @return null|array The source configuration or null if not found
* @throws FileSystemException
* @param string $name The name of the source
* @return null|array The source configuration or null if not found
*/
public static function getSource(string $name): ?array
{
@@ -68,9 +64,8 @@ class Config
/**
* Get package configuration by name
*
* @param string $name The name of the package
* @return null|array The package configuration or null if not found
* @throws FileSystemException
* @param string $name The name of the package
* @return null|array The package configuration or null if not found
*/
public static function getPkg(string $name): ?array
{
@@ -84,12 +79,10 @@ class Config
* Get library configuration by name and optional key
* Supports platform-specific configurations for different operating systems
*
* @param string $name The name of the library
* @param null|string $key The configuration key (static-libs, headers, lib-depends, lib-suggests, frameworks, bin)
* @param mixed $default Default value if key not found
* @return mixed The library configuration or default value
* @throws FileSystemException
* @throws WrongUsageException
* @param string $name The name of the library
* @param null|string $key The configuration key (static-libs, headers, lib-depends, lib-suggests, frameworks, bin)
* @param mixed $default Default value if key not found
* @return mixed The library configuration or default value
*/
public static function getLib(string $name, ?string $key = null, mixed $default = null)
{
@@ -124,8 +117,7 @@ class Config
/**
* Get all library configurations
*
* @return array All library configurations
* @throws FileSystemException
* @return array All library configurations
*/
public static function getLibs(): array
{
@@ -138,10 +130,8 @@ class Config
/**
* Get extension target configuration by name
*
* @param string $name The name of the extension
* @return null|array The extension target configuration or default ['static', 'shared']
* @throws WrongUsageException
* @throws FileSystemException
* @param string $name The name of the extension
* @return null|array The extension target configuration or default ['static', 'shared']
*/
public static function getExtTarget(string $name): ?array
{
@@ -158,12 +148,10 @@ class Config
* Get extension configuration by name and optional key
* Supports platform-specific configurations for different operating systems
*
* @param string $name The name of the extension
* @param null|string $key The configuration key (lib-depends, lib-suggests, ext-depends, ext-suggests, arg-type)
* @param mixed $default Default value if key not found
* @return mixed The extension configuration or default value
* @throws FileSystemException
* @throws WrongUsageException
* @param string $name The name of the extension
* @param null|string $key The configuration key (lib-depends, lib-suggests, ext-depends, ext-suggests, arg-type)
* @param mixed $default Default value if key not found
* @return mixed The extension configuration or default value
*/
public static function getExt(string $name, ?string $key = null, mixed $default = null)
{
@@ -198,8 +186,7 @@ class Config
/**
* Get all extension configurations
*
* @return array All extension configurations
* @throws FileSystemException
* @return array All extension configurations
*/
public static function getExts(): array
{
@@ -212,8 +199,7 @@ class Config
/**
* Get all source configurations
*
* @return array All source configurations
* @throws FileSystemException
* @return array All source configurations
*/
public static function getSources(): array
{

View File

@@ -20,11 +20,9 @@ class Downloader
/**
* Get latest version from BitBucket tag
*
* @param string $name Source name
* @param array $source Source meta info: [repo]
* @return array<int, string> [url, filename]
* @throws DownloaderException
* @throws RuntimeException
* @param string $name Source name
* @param array $source Source meta info: [repo]
* @return array<int, string> [url, filename]
*/
public static function getLatestBitbucketTag(string $name, array $source): array
{
@@ -56,11 +54,10 @@ class Downloader
/**
* Get latest version from GitHub tarball
*
* @param string $name Source name
* @param array $source Source meta info: [repo]
* @param string $type Type of tarball, default is 'releases'
* @return array<int, string> [url, filename]
* @throws DownloaderException
* @param string $name Source name
* @param array $source Source meta info: [repo]
* @param string $type Type of tarball, default is 'releases'
* @return array<int, string> [url, filename]
*/
public static function getLatestGithubTarball(string $name, array $source, string $type = 'releases'): array
{
@@ -107,11 +104,10 @@ class Downloader
/**
* Get latest version from GitHub release (uploaded archive)
*
* @param string $name Source name
* @param array $source Source meta info: [repo, match]
* @param bool $match_result Whether to return matched result by `match` param (default: true)
* @return array<int, string> When $match_result = true, and we matched, [url, filename]. Otherwise, [{asset object}. ...]
* @throws DownloaderException
* @param string $name Source name
* @param array $source Source meta info: [repo, match]
* @param bool $match_result Whether to return matched result by `match` param (default: true)
* @return array<int, string> When $match_result = true, and we matched, [url, filename]. Otherwise, [{asset object}. ...]
*/
public static function getLatestGithubRelease(string $name, array $source, bool $match_result = true): array
{
@@ -150,10 +146,9 @@ class Downloader
/**
* Get latest version from file list (regex based crawler)
*
* @param string $name Source name
* @param array $source Source meta info: [filelist]
* @return array<int, string> [url, filename]
* @throws DownloaderException
* @param string $name Source name
* @param array $source Source meta info: [filelist]
* @return array<int, string> [url, filename]
*/
public static function getFromFileList(string $name, array $source): array
{
@@ -189,15 +184,13 @@ class Downloader
/**
* Download file from URL
*
* @param string $name Download name
* @param string $url Download URL
* @param string $filename Target filename
* @param null|string $move_path Optional move path after download
* @param int $download_as Download type constant
* @param array $headers Optional HTTP headers
* @param array $hooks Optional curl hooks
* @throws DownloaderException
* @throws RuntimeException
* @param string $name Download name
* @param string $url Download URL
* @param string $filename Target filename
* @param null|string $move_path Optional move path after download
* @param int $download_as Download type constant
* @param array $headers Optional HTTP headers
* @param array $hooks Optional curl hooks
*/
public static function downloadFile(string $name, string $url, string $filename, ?string $move_path = null, int $download_as = SPC_DOWNLOAD_SOURCE, array $headers = [], array $hooks = []): void
{
@@ -221,15 +214,13 @@ class Downloader
/**
* Download Git repository
*
* @param string $name Repository name
* @param string $url Git repository URL
* @param string $branch Branch to checkout
* @param null|array $submodules Optional submodules to initialize
* @param null|string $move_path Optional move path after download
* @param int $retries Number of retry attempts
* @param int $lock_as Lock type constant
* @throws DownloaderException
* @throws RuntimeException
* @param string $name Repository name
* @param string $url Git repository URL
* @param string $branch Branch to checkout
* @param null|array $submodules Optional submodules to initialize
* @param null|string $move_path Optional move path after download
* @param int $retries Number of retry attempts
* @param int $lock_as Lock type constant
*/
public static function downloadGit(string $name, string $url, string $branch, ?array $submodules = null, ?string $move_path = null, int $retries = 0, int $lock_as = SPC_DOWNLOAD_SOURCE): void
{
@@ -306,10 +297,7 @@ class Downloader
* prefer-stable: ?bool,
* extract-files: ?array<string, string>
* } $pkg Package config
* @param bool $force Download all the time even if it exists
* @throws DownloaderException
* @throws FileSystemException
* @throws WrongUsageException
* @param bool $force Download all the time even if it exists
*/
public static function downloadPackage(string $name, ?array $pkg = null, bool $force = false): void
{
@@ -428,11 +416,8 @@ class Downloader
* text: ?string
* }
* } $source source meta info: [type, path, rev, url, filename, regex, license]
* @param bool $force Whether to force download (default: false)
* @param int $download_as Lock source type (default: SPC_LOCK_SOURCE)
* @throws DownloaderException
* @throws FileSystemException
* @throws WrongUsageException
* @param bool $force Whether to force download (default: false)
* @param int $download_as Lock source type (default: SPC_LOCK_SOURCE)
*/
public static function downloadSource(string $name, ?array $source = null, bool $force = false, int $download_as = SPC_DOWNLOAD_SOURCE): void
{
@@ -532,14 +517,12 @@ class Downloader
/**
* Use curl command to get http response
*
* @param string $url Target URL
* @param string $method HTTP method (GET, POST, etc.)
* @param array $headers HTTP headers
* @param array $hooks Curl hooks
* @param int $retries Number of retry attempts
* @return string Response body
* @throws DownloaderException
* @throws RuntimeException
* @param string $url Target URL
* @param string $method HTTP method (GET, POST, etc.)
* @param array $headers HTTP headers
* @param array $hooks Curl hooks
* @param int $retries Number of retry attempts
* @return string Response body
*/
public static function curlExec(string $url, string $method = 'GET', array $headers = [], array $hooks = [], int $retries = 0): string
{
@@ -591,15 +574,12 @@ class Downloader
/**
* Use curl to download sources from url
*
* @param string $url Download URL
* @param string $path Target file path
* @param string $method HTTP method
* @param array $headers HTTP headers
* @param array $hooks Curl hooks
* @param int $retries Number of retry attempts
* @throws DownloaderException
* @throws RuntimeException
* @throws WrongUsageException
* @param string $url Download URL
* @param string $path Target file path
* @param string $method HTTP method
* @param array $headers HTTP headers
* @param array $hooks Curl hooks
* @param int $retries Number of retry attempts
*/
public static function curlDown(string $url, string $path, string $method = 'GET', array $headers = [], array $hooks = [], int $retries = 0): void
{
@@ -705,10 +685,6 @@ class Downloader
return intval(getenv('SPC_DOWNLOAD_RETRIES') ?: 0);
}
/**
* @throws FileSystemException
* @throws WrongUsageException
*/
private static function isAlreadyDownloaded(string $name, bool $force, int $download_as = SPC_DOWNLOAD_SOURCE): bool
{
// If the lock file exists, skip downloading for source mode

View File

@@ -14,10 +14,9 @@ class FileSystem
/**
* Load configuration array from JSON file
*
* @param string $config The configuration name (ext, lib, source, pkg, pre-built)
* @param null|string $config_dir Optional custom config directory
* @return array The loaded configuration array
* @throws FileSystemException
* @param string $config The configuration name (ext, lib, source, pkg, pre-built)
* @param null|string $config_dir Optional custom config directory
* @return array The loaded configuration array
*/
public static function loadConfigArray(string $config, ?string $config_dir = null): array
{
@@ -44,9 +43,8 @@ class FileSystem
/**
* Read file contents and throw exception on failure
*
* @param string $filename The file path to read
* @return string The file contents
* @throws FileSystemException
* @param string $filename The file path to read
* @return string The file contents
*/
public static function readFile(string $filename): string
{
@@ -61,11 +59,10 @@ class FileSystem
/**
* Replace string content in file
*
* @param string $filename The file path
* @param mixed $search The search string
* @param mixed $replace The replacement string
* @return false|int Number of replacements or false on failure
* @throws FileSystemException
* @param string $filename The file path
* @param mixed $search The search string
* @param mixed $replace The replacement string
* @return false|int Number of replacements or false on failure
*/
public static function replaceFileStr(string $filename, mixed $search = null, mixed $replace = null): false|int
{
@@ -75,11 +72,10 @@ class FileSystem
/**
* Replace content in file using regex
*
* @param string $filename The file path
* @param mixed $search The regex pattern
* @param mixed $replace The replacement string
* @return false|int Number of replacements or false on failure
* @throws FileSystemException
* @param string $filename The file path
* @param mixed $search The regex pattern
* @param mixed $replace The replacement string
* @return false|int Number of replacements or false on failure
*/
public static function replaceFileRegex(string $filename, mixed $search = null, mixed $replace = null): false|int
{
@@ -89,10 +85,9 @@ class FileSystem
/**
* Replace content in file using custom callback
*
* @param string $filename The file path
* @param mixed $callback The callback function
* @return false|int Number of replacements or false on failure
* @throws FileSystemException
* @param string $filename The file path
* @param mixed $callback The callback function
* @return false|int Number of replacements or false on failure
*/
public static function replaceFileUser(string $filename, mixed $callback = null): false|int
{
@@ -147,9 +142,8 @@ class FileSystem
/**
* Copy directory recursively
*
* @param string $from Source directory path
* @param string $to Destination directory path
* @throws RuntimeException
* @param string $from Source directory path
* @param string $to Destination directory path
*/
public static function copyDir(string $from, string $to): void
{
@@ -170,12 +164,10 @@ class FileSystem
/**
* Extract package archive to specified directory
*
* @param string $name Package name
* @param string $source_type Archive type (tar.gz, zip, etc.)
* @param string $filename Archive filename
* @param null|string $extract_path Optional extraction path
* @throws RuntimeException
* @throws FileSystemException
* @param string $name Package name
* @param string $source_type Archive type (tar.gz, zip, etc.)
* @param string $filename Archive filename
* @param null|string $extract_path Optional extraction path
*/
public static function extractPackage(string $name, string $source_type, string $filename, ?string $extract_path = null): void
{
@@ -208,12 +200,10 @@ class FileSystem
/**
* Extract source archive to source directory
*
* @param string $name Source name
* @param string $source_type Archive type (tar.gz, zip, etc.)
* @param string $filename Archive filename
* @param null|string $move_path Optional move path
* @throws FileSystemException
* @throws RuntimeException
* @param string $name Source name
* @param string $source_type Archive type (tar.gz, zip, etc.)
* @param string $filename Archive filename
* @param null|string $move_path Optional move path
*/
public static function extractSource(string $name, string $source_type, string $filename, ?string $move_path = null): void
{
@@ -412,8 +402,7 @@ class FileSystem
/**
* Create directory recursively
*
* @param string $path Directory path to create
* @throws FileSystemException
* @param string $path Directory path to create
*/
public static function createDir(string $path): void
{
@@ -425,11 +414,10 @@ class FileSystem
/**
* Write content to file
*
* @param string $path File path
* @param mixed $content Content to write
* @param mixed ...$args Additional arguments passed to file_put_contents
* @return bool|int|string Result of file writing operation
* @throws FileSystemException
* @param string $path File path
* @param mixed $content Content to write
* @param mixed ...$args Additional arguments passed to file_put_contents
* @return bool|int|string Result of file writing operation
*/
public static function writeFile(string $path, mixed $content, ...$args): bool|int|string
{
@@ -443,8 +431,7 @@ class FileSystem
/**
* Reset directory by removing and recreating it
*
* @param string $dir_name Directory name
* @throws FileSystemException
* @param string $dir_name Directory name
*/
public static function resetDir(string $dir_name): void
{
@@ -540,11 +527,10 @@ class FileSystem
/**
* Replace line in file that contains specific string
*
* @param string $file File path
* @param string $find String to find in line
* @param string $line New line content
* @return false|int Number of replacements or false on failure
* @throws FileSystemException
* @param string $file File path
* @param string $find String to find in line
* @param string $line New line content
* @return false|int Number of replacements or false on failure
*/
public static function replaceFileLineContainsString(string $file, string $find, string $line): false|int
{
@@ -560,10 +546,6 @@ class FileSystem
return file_put_contents($file, implode('', $lines));
}
/**
* @throws RuntimeException
* @throws FileSystemException
*/
private static function extractArchive(string $filename, string $target): void
{
// Create base dir
@@ -600,9 +582,6 @@ class FileSystem
}
}
/**
* @throws FileSystemException
*/
private static function replaceFile(string $filename, int $replace_type = REPLACE_FILE_STR, mixed $callback_or_search = null, mixed $to_replace = null): false|int
{
logger()->debug('Replacing file with type[' . $replace_type . ']: ' . $filename);

View File

@@ -60,10 +60,8 @@ class LockFile
/**
* Put a lock entry into the lock file.
*
* @param string $lock_name Lock name to set or remove
* @param null|array $lock_content lock content to set, or null to remove the lock entry
* @throws FileSystemException
* @throws WrongUsageException
* @param string $lock_name Lock name to set or remove
* @param null|array $lock_content lock content to set, or null to remove the lock entry
*/
public static function put(string $lock_name, ?array $lock_content): void
{
@@ -84,9 +82,8 @@ class LockFile
/**
* Get the full path of a lock file or directory based on the lock options.
*
* @param array $lock_options lock item options, must contain 'source_type', 'filename' or 'dirname'
* @return string the absolute path to the lock file or directory
* @throws WrongUsageException
* @param array $lock_options lock item options, must contain 'source_type', 'filename' or 'dirname'
* @return string the absolute path to the lock file or directory
*/
public static function getLockFullPath(array $lock_options): string
{
@@ -122,9 +119,8 @@ class LockFile
/**
* Get the hash of the lock source based on the lock options.
*
* @param array $lock_options Lock options
* @return string Hash of the lock source
* @throws RuntimeException
* @param array $lock_options Lock options
* @return string Hash of the lock source
*/
public static function getLockSourceHash(array $lock_options): string
{
@@ -141,10 +137,8 @@ class LockFile
}
/**
* @param array $lock_options Lock options
* @param string $destination Target directory
* @throws FileSystemException
* @throws RuntimeException
* @param array $lock_options Lock options
* @param string $destination Target directory
*/
public static function putLockSourceHash(array $lock_options, string $destination): void
{
@@ -167,9 +161,6 @@ class LockFile
* move_path: ?string,
* lock_as: int
* } $data Source data
* @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
*/
public static function lockSource(string $name, array $data): void
{
@@ -200,9 +191,7 @@ class LockFile
/**
* Remove the lock file or directory if it exists.
*
* @param array $lock_options lock item options, must contain 'source_type', 'filename' or 'dirname'
* @throws WrongUsageException
* @throws FileSystemException
* @param array $lock_options lock item options, must contain 'source_type', 'filename' or 'dirname'
*/
private static function removeLockFileIfExists(array $lock_options): void
{

View File

@@ -4,17 +4,10 @@ declare(strict_types=1);
namespace SPC\store;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException;
class SourceManager
{
/**
* @throws WrongUsageException
* @throws FileSystemException
* @throws RuntimeException
*/
public static function initSource(?array $sources = null, ?array $libs = null, ?array $exts = null, bool $source_only = false): void
{
$sources_extracted = [];

View File

@@ -34,14 +34,6 @@ class SourcePatcher
FileSystem::addSourceExtractHook('gmssl', [__CLASS__, 'patchGMSSL']);
}
/**
* Source patcher runner before buildconf
*
* @param BuilderBase $builder Builder
* @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
*/
public static function patchBeforeBuildconf(BuilderBase $builder): void
{
foreach ($builder->getExts() as $ext) {
@@ -111,8 +103,7 @@ class SourcePatcher
/**
* Source patcher runner before configure
*
* @param BuilderBase $builder Builder
* @throws FileSystemException
* @param BuilderBase $builder Builder
*/
public static function patchBeforeConfigure(BuilderBase $builder): void
{
@@ -138,10 +129,6 @@ class SourcePatcher
}
}
/**
* @throws RuntimeException
* @throws FileSystemException
*/
public static function patchMicro(?array $items = null): bool
{
if (!file_exists(SOURCE_PATH . '/php-src/sapi/micro/php_micro.c')) {
@@ -198,10 +185,9 @@ class SourcePatcher
/**
* Use existing patch file for patching
*
* @param string $patch_name Patch file name in src/globals/patch/ or absolute path
* @param string $cwd Working directory for patch command
* @param bool $reverse Reverse patches (default: False)
* @throws RuntimeException
* @param string $patch_name Patch file name in src/globals/patch/ or absolute path
* @param string $cwd Working directory for patch command
* @param bool $reverse Reverse patches (default: False)
*/
public static function patchFile(string $patch_name, string $cwd, bool $reverse = false): bool
{
@@ -247,9 +233,6 @@ class SourcePatcher
return true;
}
/**
* @throws FileSystemException
*/
public static function patchOpenssl11Darwin(): bool
{
if (PHP_OS_FAMILY === 'Darwin' && !file_exists(SOURCE_PATH . '/openssl/VERSION.dat') && file_exists(SOURCE_PATH . '/openssl/test/v3ext.c')) {
@@ -259,9 +242,6 @@ class SourcePatcher
return false;
}
/**
* @throws FileSystemException
*/
public static function patchSwoole(): bool
{
// swoole hook needs pdo/pdo.h
@@ -288,9 +268,6 @@ class SourcePatcher
return true;
}
/**
* @throws FileSystemException
*/
public static function patchBeforeMake(BuilderBase $builder): void
{
if ($builder instanceof UnixBuilderBase) {
@@ -343,9 +320,6 @@ class SourcePatcher
}
}
/**
* @throws FileSystemException
*/
public static function patchHardcodedINI(array $ini = []): bool
{
$cli_c = SOURCE_PATH . '/php-src/sapi/cli/php_cli.c';
@@ -403,9 +377,6 @@ class SourcePatcher
return $result;
}
/**
* @throws FileSystemException
*/
public static function patchMicroPhar(int $version_id): void
{
FileSystem::backupFile(SOURCE_PATH . '/php-src/ext/phar/phar.c');
@@ -431,9 +402,6 @@ class SourcePatcher
}
}
/**
* @throws RuntimeException
*/
public static function unpatchMicroPhar(): void
{
FileSystem::restoreBackupFile(SOURCE_PATH . '/php-src/ext/phar/phar.c');
@@ -441,8 +409,6 @@ class SourcePatcher
/**
* Fix the compilation issue of sqlsrv and pdo_sqlsrv on Windows (/sdl check is too strict and will cause Zend compilation to fail)
*
* @throws FileSystemException
*/
public static function patchSQLSRVWin32(string $source_name): bool
{
@@ -542,9 +508,6 @@ class SourcePatcher
/**
* Patch cli SAPI Makefile for Windows.
*
* @throws FileSystemException
* @throws RuntimeException
*/
public static function patchWindowsCLITarget(): void
{
@@ -568,9 +531,6 @@ class SourcePatcher
FileSystem::writeFile(SOURCE_PATH . '/php-src/Makefile', implode("\r\n", $lines));
}
/**
* @throws RuntimeException
*/
public static function patchPhpLibxml212(): bool
{
$file = file_get_contents(SOURCE_PATH . '/php-src/main/php_version.h');
@@ -595,9 +555,6 @@ class SourcePatcher
return false;
}
/**
* @throws FileSystemException
*/
public static function patchGDWin32(): bool
{
$file = file_get_contents(SOURCE_PATH . '/php-src/main/php_version.h');
@@ -617,8 +574,6 @@ class SourcePatcher
/**
* Add additional `static-php-cli.version` ini value for PHP source.
*
* @throws FileSystemException
*/
public static function patchSPCVersionToPHP(string $version = 'unknown'): void
{
@@ -631,9 +586,6 @@ class SourcePatcher
}
}
/**
* @throws FileSystemException
*/
public static function patchMicroWin32(): void
{
// patch micro win32

View File

@@ -145,9 +145,6 @@ class Zig extends CustomPackage
];
}
/**
* @throws WrongUsageException
*/
private static function getPath(): string
{
$arch = arch2gnu(php_uname('m'));

View File

@@ -6,19 +6,12 @@ namespace SPC\store\source;
use JetBrains\PhpStorm\ArrayShape;
use SPC\exception\DownloaderException;
use SPC\exception\FileSystemException;
use SPC\exception\WrongUsageException;
use SPC\store\Downloader;
class PhpSource extends CustomSourceBase
{
public const NAME = 'php-src';
/**
* @throws DownloaderException
* @throws FileSystemException
* @throws WrongUsageException
*/
public function fetch(bool $force = false, ?array $config = null, int $lock_as = SPC_DOWNLOAD_SOURCE): void
{
$major = defined('SPC_BUILD_PHP_VERSION') ? SPC_BUILD_PHP_VERSION : '8.4';
@@ -33,8 +26,6 @@ class PhpSource extends CustomSourceBase
/**
* 获取 PHP x.y 的具体版本号,例如通过 8.1 来获取 8.1.10
*
* @throws DownloaderException
*/
#[ArrayShape(['type' => 'string', 'path' => 'string', 'rev' => 'string', 'url' => 'string'])]
public function getLatestPHPInfo(string $major_version): array

View File

@@ -4,26 +4,17 @@ declare(strict_types=1);
namespace SPC\store\source;
use SPC\exception\DownloaderException;
use SPC\exception\FileSystemException;
use SPC\store\Downloader;
class PostgreSQLSource extends CustomSourceBase
{
public const NAME = 'postgresql';
/**
* @throws DownloaderException
* @throws FileSystemException
*/
public function fetch(bool $force = false, ?array $config = null, int $lock_as = SPC_DOWNLOAD_SOURCE): void
{
Downloader::downloadSource('postgresql', self::getLatestInfo(), $force);
}
/**
* @throws DownloaderException
*/
public function getLatestInfo(): array
{
[, $filename, $version] = Downloader::getFromFileList('postgresql', [