From 6f89355eb8ee8329e24e78d0cfa0dbe800144ee1 Mon Sep 17 00:00:00 2001 From: Yevhen Sidelnyk Date: Mon, 1 Dec 2025 19:21:40 +0200 Subject: [PATCH 1/2] ci(phpstan): bump level to max --- phpstan.dist.neon | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/phpstan.dist.neon b/phpstan.dist.neon index fa27fb8..df1489f 100644 --- a/phpstan.dist.neon +++ b/phpstan.dist.neon @@ -1,12 +1,14 @@ includes: - vendor/phpstan/phpstan-strict-rules/rules.neon + - vendor/tomasvotruba/type-coverage/config/extension.neon - vendor/phpstan/phpstan-phpunit/extension.neon - vendor/phpstan/phpstan-phpunit/rules.neon - - vendor/tomasvotruba/type-coverage/config/extension.neon parameters: - level: 9 - phpVersion: 80127 + level: max + phpVersion: + min: 80100 + max: 80599 editorUrl: 'phpstorm://open?file=%%file%%&line=%%line%%' paths: - src From 16930b455a18bd08dc17d14c7f5927fc73c915ed Mon Sep 17 00:00:00 2001 From: Yevhen Sidelnyk Date: Mon, 1 Dec 2025 19:31:44 +0200 Subject: [PATCH 2/2] refactor: relocate tests into src/ --- .gitattributes | 9 +++++---- ecs.php | 2 +- phpstan.dist.neon | 1 - phpunit.xml.dist | 5 +++-- rector.php | 2 +- {tests/Bundle => src/Bundle/Tests}/BundleTestCase.php | 4 ++-- .../Bundle/Tests}/Compiler/TestServicesCompilerPass.php | 2 +- .../Unwrapper/Tests/ExceptionUnwrapperServiceTest.php | 8 +++++--- .../Unwrapper/Tests}/ExceptionUnwrapperUnitTest.php | 2 +- 9 files changed, 19 insertions(+), 16 deletions(-) rename {tests/Bundle => src/Bundle/Tests}/BundleTestCase.php (87%) rename {tests/Bundle => src/Bundle/Tests}/Compiler/TestServicesCompilerPass.php (87%) rename tests/Bundle/DependencyInjectionIntegrationTest.php => src/Unwrapper/Tests/ExceptionUnwrapperServiceTest.php (85%) rename {tests/Unwrapper => src/Unwrapper/Tests}/ExceptionUnwrapperUnitTest.php (98%) diff --git a/.gitattributes b/.gitattributes index b6b520c..452f980 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,8 +1,9 @@ +/**/.gitignore export-ignore +/**/.gitattributes export-ignore +/**/Tests export-ignore +/**/*Test.php export-ignore /.github export-ignore -/.gitattributes export-ignore -/.gitignore export-ignore -/tests export-ignore -/ecs.php export-ignore /phpstan.dist.neon export-ignore /phpunit.xml.dist export-ignore +/ecs.php export-ignore /rector.php export-ignore diff --git a/ecs.php b/ecs.php index 9cfd420..ed387e9 100644 --- a/ecs.php +++ b/ecs.php @@ -8,6 +8,6 @@ return static function (ECSConfig $ecsConfig): void { $ecsConfig->sets([PhdSetList::ecs()->getPath()]); - $ecsConfig->paths([__DIR__.'/src', __DIR__.'/tests']); + $ecsConfig->paths([__DIR__.'/src']); $ecsConfig->skip([__DIR__.'/vendor']); }; diff --git a/phpstan.dist.neon b/phpstan.dist.neon index df1489f..0acbf20 100644 --- a/phpstan.dist.neon +++ b/phpstan.dist.neon @@ -12,7 +12,6 @@ parameters: editorUrl: 'phpstorm://open?file=%%file%%&line=%%line%%' paths: - src - - tests fileExtensions: - 'php' type_coverage: diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 35cd868..8b79665 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -10,10 +10,10 @@ failOnWarning="true"> - tests + src - tests + src @@ -22,6 +22,7 @@ src + src/*/Tests src/*/*/Tests src/*/*/*/Tests src diff --git a/rector.php b/rector.php index 7c6dd2a..7d8dff0 100644 --- a/rector.php +++ b/rector.php @@ -7,7 +7,7 @@ use Rector\ValueObject\PhpVersion; return static function (RectorConfig $rectorConfig): void { - $rectorConfig->paths([__DIR__.'/src', __DIR__.'/tests']); + $rectorConfig->paths([__DIR__.'/src']); $rectorConfig->sets([PhdSetList::rector()->getPath()]); $rectorConfig->phpVersion(PhpVersion::PHP_81); diff --git a/tests/Bundle/BundleTestCase.php b/src/Bundle/Tests/BundleTestCase.php similarity index 87% rename from tests/Bundle/BundleTestCase.php rename to src/Bundle/Tests/BundleTestCase.php index 64e71d0..6685a4f 100644 --- a/tests/Bundle/BundleTestCase.php +++ b/src/Bundle/Tests/BundleTestCase.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace PhPhD\ExceptionToolkit\Tests\Bundle; +namespace PhPhD\ExceptionToolkit\Bundle\Tests; use Nyholm\BundleTest\TestKernel; use PhPhD\ExceptionToolkit\Bundle\PhdExceptionToolkitBundle; -use PhPhD\ExceptionToolkit\Tests\Bundle\Compiler\TestServicesCompilerPass; +use PhPhD\ExceptionToolkit\Bundle\Tests\Compiler\TestServicesCompilerPass; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; use Symfony\Component\HttpKernel\KernelInterface; diff --git a/tests/Bundle/Compiler/TestServicesCompilerPass.php b/src/Bundle/Tests/Compiler/TestServicesCompilerPass.php similarity index 87% rename from tests/Bundle/Compiler/TestServicesCompilerPass.php rename to src/Bundle/Tests/Compiler/TestServicesCompilerPass.php index 12fcd55..b023d23 100644 --- a/tests/Bundle/Compiler/TestServicesCompilerPass.php +++ b/src/Bundle/Tests/Compiler/TestServicesCompilerPass.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace PhPhD\ExceptionToolkit\Tests\Bundle\Compiler; +namespace PhPhD\ExceptionToolkit\Bundle\Tests\Compiler; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; diff --git a/tests/Bundle/DependencyInjectionIntegrationTest.php b/src/Unwrapper/Tests/ExceptionUnwrapperServiceTest.php similarity index 85% rename from tests/Bundle/DependencyInjectionIntegrationTest.php rename to src/Unwrapper/Tests/ExceptionUnwrapperServiceTest.php index 7943315..34884f7 100644 --- a/tests/Bundle/DependencyInjectionIntegrationTest.php +++ b/src/Unwrapper/Tests/ExceptionUnwrapperServiceTest.php @@ -2,9 +2,11 @@ declare(strict_types=1); -namespace PhPhD\ExceptionToolkit\Tests\Bundle; +namespace PhPhD\ExceptionToolkit\Unwrapper\Tests; +use PhPhD\ExceptionToolkit\Bundle\Tests\BundleTestCase; use PhPhD\ExceptionToolkit\Unwrapper\Amp\AmpExceptionUnwrapper; +use PhPhD\ExceptionToolkit\Unwrapper\ExceptionUnwrapper; use PhPhD\ExceptionToolkit\Unwrapper\Messenger\MessengerExceptionUnwrapper; use Symfony\Component\VarExporter\LazyObjectInterface; @@ -14,7 +16,7 @@ * * @internal */ -final class DependencyInjectionIntegrationTest extends BundleTestCase +final class ExceptionUnwrapperServiceTest extends BundleTestCase { public function testServiceDefinitions(): void { @@ -30,7 +32,7 @@ private function checkExceptionUnwrapper(): void private function checkTopmostUnwrapper(): void { - $exceptionUnwrapper = self::getContainer()->get('phd_exception_toolkit.exception_unwrapper'); + $exceptionUnwrapper = self::getContainer()->get(ExceptionUnwrapper::class); self::assertInstanceOf(LazyObjectInterface::class, $exceptionUnwrapper); self::assertFalse($exceptionUnwrapper->isLazyObjectInitialized()); $topmostUnwrapper = $exceptionUnwrapper->initializeLazyObject(); diff --git a/tests/Unwrapper/ExceptionUnwrapperUnitTest.php b/src/Unwrapper/Tests/ExceptionUnwrapperUnitTest.php similarity index 98% rename from tests/Unwrapper/ExceptionUnwrapperUnitTest.php rename to src/Unwrapper/Tests/ExceptionUnwrapperUnitTest.php index 2a0ceab..e7f9610 100644 --- a/tests/Unwrapper/ExceptionUnwrapperUnitTest.php +++ b/src/Unwrapper/Tests/ExceptionUnwrapperUnitTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace PhPhD\ExceptionToolkit\Tests\Unwrapper; +namespace PhPhD\ExceptionToolkit\Unwrapper\Tests; use Amp\CompositeException; use Exception;