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

@@ -5,8 +5,6 @@ declare(strict_types=1);
namespace SPC\command;
use SPC\builder\BuilderProvider;
use SPC\exception\ExceptionHandler;
use SPC\exception\RuntimeException;
use SPC\store\Config;
use SPC\util\DependencyUtil;
use Symfony\Component\Console\Attribute\AsCommand;
@@ -33,9 +31,6 @@ class BuildLibsCommand extends BuildCommand
parent::initialize($input, $output);
}
/**
* @throws RuntimeException
*/
public function handle(): int
{
// 从参数中获取要编译的 libraries并转换为数组

View File

@@ -34,9 +34,6 @@ class DeleteDownloadCommand extends BaseCommand
parent::initialize($input, $output);
}
/**
* @throws FileSystemException
*/
public function handle(): int
{
try {

View File

@@ -47,10 +47,6 @@ class DownloadCommand extends BaseCommand
$this->addOption('no-alt', null, null, 'Do not download alternative sources');
}
/**
* @throws FileSystemException
* @throws WrongUsageException
*/
public function initialize(InputInterface $input, OutputInterface $output): void
{
// mode: --all
@@ -89,10 +85,6 @@ class DownloadCommand extends BaseCommand
parent::initialize($input, $output);
}
/**
* @throws FileSystemException
* @throws RuntimeException
*/
public function handle(): int
{
try {
@@ -268,10 +260,6 @@ class DownloadCommand extends BaseCommand
}
}
/**
* @throws RuntimeException
* @throws WrongUsageException
*/
private function downloadFromZip(string $path): int
{
if (!file_exists($path)) {
@@ -316,10 +304,8 @@ class DownloadCommand extends BaseCommand
/**
* Calculate the sources by extensions
*
* @param array $extensions extension list
* @param bool $include_suggests include suggested libs and extensions (default: true)
* @throws FileSystemException
* @throws WrongUsageException
* @param array $extensions extension list
* @param bool $include_suggests include suggested libs and extensions (default: true)
*/
private function calculateSourcesByExt(array $extensions, bool $include_suggests = true): array
{
@@ -342,10 +328,8 @@ class DownloadCommand extends BaseCommand
/**
* Calculate the sources by libraries
*
* @param array $libs library list
* @param bool $include_suggests include suggested libs (default: true)
* @throws FileSystemException
* @throws WrongUsageException
* @param array $libs library list
* @param bool $include_suggests include suggested libs (default: true)
*/
private function calculateSourcesByLib(array $libs, bool $include_suggests = true): array
{
@@ -373,9 +357,6 @@ class DownloadCommand extends BaseCommand
return null;
}
/**
* @throws RuntimeException
*/
private function _clean(): int
{
logger()->warning('You are doing some operations that not recoverable: removing directories below');

View File

@@ -4,9 +4,6 @@ declare(strict_types=1);
namespace SPC\command;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException;
use SPC\util\DependencyUtil;
use SPC\util\LicenseDumper;
use Symfony\Component\Console\Attribute\AsCommand;
@@ -27,11 +24,6 @@ class DumpLicenseCommand extends BaseCommand
$this->addOption('dump-dir', null, InputOption::VALUE_REQUIRED, 'Change dump directory', BUILD_ROOT_PATH . '/license');
}
/**
* @throws WrongUsageException
* @throws FileSystemException
* @throws RuntimeException
*/
public function handle(): int
{
$dumper = new LicenseDumper();

View File

@@ -5,9 +5,6 @@ declare(strict_types=1);
namespace SPC\command;
use SPC\builder\traits\UnixSystemUtilTrait;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException;
use SPC\store\SourceManager;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Input\InputArgument;
@@ -23,11 +20,6 @@ class ExtractCommand extends BaseCommand
$this->addOption('source-only', null, null, 'Only check the source exist, do not check the lib and ext');
}
/**
* @throws WrongUsageException
* @throws FileSystemException
* @throws RuntimeException
*/
public function handle(): int
{
$sources = array_map('trim', array_filter(explode(',', $this->getArgument('sources'))));

View File

@@ -28,9 +28,6 @@ class InstallPkgCommand extends BaseCommand
$this->addOption('skip-extract', null, null, 'Skip package extraction, just download the package archive');
}
/**
* @throws FileSystemException
*/
public function handle(): int
{
try {

View File

@@ -4,7 +4,6 @@ declare(strict_types=1);
namespace SPC\command;
use SPC\exception\RuntimeException;
use SPC\util\SPCConfigUtil;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Input\InputArgument;
@@ -28,9 +27,6 @@ class SPCConfigCommand extends BaseCommand
$this->addOption('no-php', null, null, 'Do not link to PHP library');
}
/**
* @throws RuntimeException
*/
public function handle(): int
{
// transform string to array

View File

@@ -5,8 +5,6 @@ declare(strict_types=1);
namespace SPC\command\dev;
use SPC\command\BaseCommand;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException;
use SPC\store\Config;
use SPC\util\DependencyUtil;
@@ -30,11 +28,6 @@ class AllExtCommand extends BaseCommand
);
}
/**
* @throws FileSystemException
* @throws WrongUsageException
* @throws RuntimeException
*/
public function handle(): int
{
$extensions = array_map('trim', array_filter(explode(',', $this->getArgument('extensions') ?? '')));

View File

@@ -146,11 +146,6 @@ class PackLibCommand extends BuildCommand
}
}
/**
* @throws WrongUsageException
* @throws RuntimeException
* @throws FileSystemException
*/
private function sanityCheckLib(LibraryBase $lib): void
{
logger()->info('Sanity check for library ' . $lib->getName());

View File

@@ -5,8 +5,6 @@ declare(strict_types=1);
namespace SPC\command\dev;
use SPC\command\BaseCommand;
use SPC\exception\FileSystemException;
use SPC\exception\ValidationException;
use SPC\store\FileSystem;
use SPC\util\ConfigValidator;
use Symfony\Component\Console\Attribute\AsCommand;
@@ -23,10 +21,6 @@ class SortConfigCommand extends BaseCommand
$this->addArgument('config-name', InputArgument::REQUIRED, 'Your config to be sorted, you can sort "lib", "source" and "ext".');
}
/**
* @throws ValidationException
* @throws FileSystemException
*/
public function handle(): int
{
switch ($name = $this->getArgument('config-name')) {