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

@@ -41,9 +41,6 @@ class GlobalFunctionsTest extends TestCase
$this->assertInstanceOf('Psr\Log\LoggerInterface', logger());
}
/**
* @throws WrongUsageException
*/
public function testArch2Gnu(): void
{
$this->assertEquals('x86_64', arch2gnu('x86_64'));
@@ -61,9 +58,6 @@ class GlobalFunctionsTest extends TestCase
$this->assertEquals("'hello'", quote('hello', "'"));
}
/**
* @throws RuntimeException
*/
public function testFPassthru(): void
{
if (PHP_OS_FAMILY === 'Windows') {

View File

@@ -5,8 +5,6 @@ declare(strict_types=1);
namespace SPC\Tests\store;
use PHPUnit\Framework\TestCase;
use SPC\exception\FileSystemException;
use SPC\exception\WrongUsageException;
use SPC\store\Config;
use SPC\store\FileSystem;
@@ -15,9 +13,6 @@ use SPC\store\FileSystem;
*/
class ConfigTest extends TestCase
{
/**
* @throws FileSystemException
*/
public static function setUpBeforeClass(): void
{
$testdir = WORKING_DIR . '/.configtest';
@@ -30,26 +25,16 @@ class ConfigTest extends TestCase
FileSystem::loadConfigArray('source', $testdir);
}
/**
* @throws FileSystemException
*/
public static function tearDownAfterClass(): void
{
FileSystem::removeDir(WORKING_DIR . '/.configtest');
}
/**
* @throws FileSystemException
*/
public function testGetExts()
{
$this->assertTrue(is_assoc_array(Config::getExts()));
}
/**
* @throws FileSystemException
* @throws WrongUsageException
*/
public function testGetLib()
{
$this->assertIsArray(Config::getLib('zlib'));
@@ -60,35 +45,22 @@ class ConfigTest extends TestCase
};
}
/**
* @throws WrongUsageException
* @throws FileSystemException
*/
public function testGetExt()
{
$this->assertIsArray(Config::getExt('bcmath'));
$this->assertEquals('builtin', Config::getExt('bcmath', 'type'));
}
/**
* @throws FileSystemException
*/
public function testGetSources()
{
$this->assertTrue(is_assoc_array(Config::getSources()));
}
/**
* @throws FileSystemException
*/
public function testGetSource()
{
$this->assertIsArray(Config::getSource('php-src'));
}
/**
* @throws FileSystemException
*/
public function testGetLibs()
{
$this->assertTrue(is_assoc_array(Config::getLibs()));

View File

@@ -30,9 +30,6 @@ class FileSystemTest extends TestCase
}
}
/**
* @throws FileSystemException
*/
public function testReplaceFileRegex()
{
$file = WORKING_DIR . '/.txt1';
@@ -54,9 +51,6 @@ class FileSystemTest extends TestCase
}
}
/**
* @throws FileSystemException
*/
public function testReadFile()
{
$file = WORKING_DIR . '/.testread';
@@ -66,9 +60,6 @@ class FileSystemTest extends TestCase
@unlink($file);
}
/**
* @throws FileSystemException
*/
public function testReplaceFileUser()
{
$file = WORKING_DIR . '/.txt1';
@@ -88,10 +79,6 @@ class FileSystemTest extends TestCase
$this->assertEquals('', FileSystem::extname('/tmp/asd.'));
}
/**
* @throws \ReflectionException
* @throws FileSystemException
*/
public function testGetClassesPsr4()
{
$classes = FileSystem::getClassesPsr4(ROOT_DIR . '/src/SPC/builder/extension', 'SPC\builder\extension');
@@ -109,9 +96,6 @@ class FileSystemTest extends TestCase
}
}
/**
* @throws FileSystemException
*/
public function testCreateDir()
{
FileSystem::createDir(WORKING_DIR . '/.testdir');
@@ -119,9 +103,6 @@ class FileSystemTest extends TestCase
rmdir(WORKING_DIR . '/.testdir');
}
/**
* @throws FileSystemException
*/
public function testReplaceFileStr()
{
$file = WORKING_DIR . '/.txt1';
@@ -133,9 +114,6 @@ class FileSystemTest extends TestCase
unlink($file);
}
/**
* @throws FileSystemException
*/
public function testResetDir()
{
// prepare fake git dir to test
@@ -146,10 +124,6 @@ class FileSystemTest extends TestCase
FileSystem::removeDir(WORKING_DIR . '/.fake_down_test');
}
/**
* @throws FileSystemException
* @throws RuntimeException
*/
public function testCopyDir()
{
// prepare fake git dir to test
@@ -162,9 +136,6 @@ class FileSystemTest extends TestCase
FileSystem::removeDir(WORKING_DIR . '/.fake_down_test2');
}
/**
* @throws FileSystemException
*/
public function testRemoveDir()
{
FileSystem::createDir(WORKING_DIR . '/.fake_down_test');
@@ -173,9 +144,6 @@ class FileSystemTest extends TestCase
$this->assertDirectoryDoesNotExist(WORKING_DIR . '/.fake_down_test');
}
/**
* @throws FileSystemException
*/
public function testLoadConfigArray()
{
$arr = FileSystem::loadConfigArray('lib');
@@ -200,9 +168,6 @@ class FileSystemTest extends TestCase
$this->assertContains('lib.json', $files);
}
/**
* @throws FileSystemException
*/
public function testWriteFile()
{
FileSystem::writeFile(WORKING_DIR . '/.txt', 'txt');

View File

@@ -308,9 +308,6 @@ class ConfigValidatorTest extends TestCase
}
}
/**
* @throws ValidationException
*/
public function testValidateExts(): void
{
// Test valid extensions

View File

@@ -6,7 +6,6 @@ namespace SPC\Tests\util;
use PHPUnit\Framework\TestCase;
use SPC\builder\BuilderProvider;
use SPC\exception\FileSystemException;
use SPC\store\FileSystem;
use SPC\util\SPCConfigUtil;
use Symfony\Component\Console\Input\ArgvInput;
@@ -16,9 +15,6 @@ use Symfony\Component\Console\Input\ArgvInput;
*/
class SPCConfigUtilTest extends TestCase
{
/**
* @throws FileSystemException
*/
public static function setUpBeforeClass(): void
{
if (PHP_OS_FAMILY === 'Windows') {
@@ -35,9 +31,6 @@ class SPCConfigUtilTest extends TestCase
FileSystem::loadConfigArray('source', $testdir);
}
/**
* @throws FileSystemException
*/
public static function tearDownAfterClass(): void
{
FileSystem::removeDir(WORKING_DIR . '/.configtest');