mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-06 08:15:39 +08:00
Do some code quality check and fix #126
This commit is contained in:
@@ -6,6 +6,7 @@ namespace SPC\store\source;
|
||||
|
||||
use JetBrains\PhpStorm\ArrayShape;
|
||||
use SPC\exception\DownloaderException;
|
||||
use SPC\exception\FileSystemException;
|
||||
use SPC\exception\RuntimeException;
|
||||
use SPC\store\Downloader;
|
||||
|
||||
@@ -16,8 +17,9 @@ class PhpSource extends CustomSourceBase
|
||||
/**
|
||||
* @throws DownloaderException
|
||||
* @throws RuntimeException
|
||||
* @throws FileSystemException
|
||||
*/
|
||||
public function fetch()
|
||||
public function fetch(): void
|
||||
{
|
||||
$major = defined('SPC_BUILD_PHP_VERSION') ? SPC_BUILD_PHP_VERSION : '8.1';
|
||||
Downloader::downloadSource('php-src', self::getLatestPHPInfo($major));
|
||||
|
||||
@@ -4,20 +4,31 @@ declare(strict_types=1);
|
||||
|
||||
namespace SPC\store\source;
|
||||
|
||||
use SPC\exception\DownloaderException;
|
||||
use SPC\exception\FileSystemException;
|
||||
use SPC\exception\RuntimeException;
|
||||
use SPC\store\Downloader;
|
||||
|
||||
class PostgreSQLSource extends CustomSourceBase
|
||||
{
|
||||
public const NAME = 'postgresql';
|
||||
|
||||
public function fetch()
|
||||
/**
|
||||
* @throws DownloaderException
|
||||
* @throws RuntimeException
|
||||
* @throws FileSystemException
|
||||
*/
|
||||
public function fetch(): void
|
||||
{
|
||||
Downloader::downloadSource('postgresql', self::getLatestInfo());
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws DownloaderException
|
||||
*/
|
||||
public function getLatestInfo(): array
|
||||
{
|
||||
[$url, $filename, $version] = Downloader::getFromFileList('postgresql', [
|
||||
[, $filename, $version] = Downloader::getFromFileList('postgresql', [
|
||||
'url' => 'https://www.postgresql.org/ftp/source/',
|
||||
'regex' => '/href="(?<file>v(?<version>[^"]+)\/)"/',
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user