diff --git a/composer.json b/composer.json index 9fe723618..5b0ca0b28 100644 --- a/composer.json +++ b/composer.json @@ -52,7 +52,7 @@ "opis/json-schema": "^2.3.0", "phpdocumentor/reflection-docblock": "^5.2", "phpdocumentor/type-resolver": "^1.7", - "phpstan/phpdoc-parser": "^1.23", + "phpstan/phpdoc-parser": "^1.25", "psr/http-message": "^1.0.0|^2.0.0", "symfony/filesystem": "^6.3.0", "symfony/finder": "^6.3.0", diff --git a/dev/Larastan/ReturnTypes/ContainerArrayAccessDynamicMethodReturnTypeExtension.php b/dev/Larastan/ReturnTypes/ContainerArrayAccessDynamicMethodReturnTypeExtension.php index e489c8e5e..7fe6a8709 100644 --- a/dev/Larastan/ReturnTypes/ContainerArrayAccessDynamicMethodReturnTypeExtension.php +++ b/dev/Larastan/ReturnTypes/ContainerArrayAccessDynamicMethodReturnTypeExtension.php @@ -3,6 +3,7 @@ namespace Larastan\Larastan\ReturnTypes; use Illuminate\Contracts\Container\Container; +use LastDragon_ru\LaraASP\Dev\PhpStan\Container\Extension; use Override; use PhpParser\Node\Expr\MethodCall; use PHPStan\Analyser\Scope; @@ -15,7 +16,7 @@ * * @internal * - * @see ContainerExtension + * @see Extension */ class ContainerArrayAccessDynamicMethodReturnTypeExtension implements DynamicMethodReturnTypeExtension { public function __construct( diff --git a/dev/Larastan/ReturnTypes/ContainerMakeDynamicReturnTypeExtension.php b/dev/Larastan/ReturnTypes/ContainerMakeDynamicReturnTypeExtension.php index 5d50ac988..1a1d90772 100644 --- a/dev/Larastan/ReturnTypes/ContainerMakeDynamicReturnTypeExtension.php +++ b/dev/Larastan/ReturnTypes/ContainerMakeDynamicReturnTypeExtension.php @@ -3,7 +3,7 @@ namespace Larastan\Larastan\ReturnTypes; use Illuminate\Contracts\Container\Container; -use LastDragon_ru\LaraASP\Dev\PhpStan\Extensions\Container\ContainerExtension; +use LastDragon_ru\LaraASP\Dev\PhpStan\Container\Extension; use Override; use PhpParser\Node\Expr\MethodCall; use PHPStan\Analyser\Scope; @@ -14,9 +14,8 @@ /** * Original class uses {@see Container::make()} it is slow and unwanted * + * @see Extension * @internal - * - * @see ContainerExtension */ class ContainerMakeDynamicReturnTypeExtension implements DynamicMethodReturnTypeExtension { #[Override] diff --git a/dev/PhpStan/ClassMustBeFinal/Rule.php b/dev/PhpStan/ClassMustBeFinal/Rule.php new file mode 100644 index 000000000..7c8bed879 --- /dev/null +++ b/dev/PhpStan/ClassMustBeFinal/Rule.php @@ -0,0 +1,70 @@ + + */ +class Rule implements RuleContract { + public function __construct( + /** + * @var array + */ + protected readonly array $classes, + ) { + // empty + } + + #[Override] + public function getNodeType(): string { + return InClassNode::class; + } + + /** + * @inheritDoc + */ + #[Override] + public function processNode(Node $node, Scope $scope): array { + // Skip? + $origin = $node->getOriginalNode(); + + if (!($origin instanceof Class_) || $origin->isFinal() || $origin->isAbstract() || $origin->isAnonymous()) { + return []; + } + + // Must be final? + $reflection = $node->getClassReflection(); + $mustBeFinal = false; + + foreach ($this->classes as $class) { + if ($reflection->is($class) || $reflection->implementsInterface($class)) { + $mustBeFinal = true; + break; + } + } + + if ($mustBeFinal) { + return [ + RuleErrorBuilder::message( + sprintf('Class `%s` must be `final`.', $reflection->getName()), + )->build(), + ]; + } + + // Nope + return []; + } +} diff --git a/dev/PhpStan/ClassMustBeFinal/RuleTest.php b/dev/PhpStan/ClassMustBeFinal/RuleTest.php new file mode 100644 index 000000000..49e3ffa4a --- /dev/null +++ b/dev/PhpStan/ClassMustBeFinal/RuleTest.php @@ -0,0 +1,60 @@ + + */ +#[CoversClass(Rule::class)] +final class RuleTest extends RuleTestCase { + #[Override] + protected function getRule(): RuleContract { + return new Rule([ + RuleTest_MustBeFinalMarker::class, + ]); + } + + public function testRule(): void { + $this->analyse([__FILE__], [ + [ + sprintf('Class `%s` must be `final`.', RuleTest_MustBeFinal::class), + 50, + ], + ]); + } +} + +// @phpcs:disable PSR1.Classes.ClassDeclaration.MultipleClasses +// @phpcs:disable Squiz.Classes.ValidClassName.NotCamelCaps + +/** + * @internal + * @noinspection PhpMultipleClassesDeclarationsInOneFile + */ +interface RuleTest_MustBeFinalMarker { + // empty +} + +/** + * @internal + * @noinspection PhpMultipleClassesDeclarationsInOneFile + */ +class RuleTest_MustBeFinal implements RuleTest_MustBeFinalMarker { + // empty +} + +/** + * @internal + * @noinspection PhpMultipleClassesDeclarationsInOneFile + */ +final class RuleTest_AlreadyFinal implements RuleTest_MustBeFinalMarker { + // empty +} diff --git a/dev/PhpStan/ClassMustBeFinal/extension.neon b/dev/PhpStan/ClassMustBeFinal/extension.neon new file mode 100644 index 000000000..a2911ba39 --- /dev/null +++ b/dev/PhpStan/ClassMustBeFinal/extension.neon @@ -0,0 +1,15 @@ +parameters: + classMustBeFinal: [] + +parametersSchema: + classMustBeFinal: structure({ + classes: listOf(string()) + }) + +services: + - + class: LastDragon_ru\LaraASP\Dev\PhpStan\ClassMustBeFinal\Rule + arguments: + classes: %classMustBeFinal.classes% + tags: + - phpstan.rules.rule diff --git a/dev/PhpStan/ClassMustBeInternal/Rule.php b/dev/PhpStan/ClassMustBeInternal/Rule.php new file mode 100644 index 000000000..01d46d624 --- /dev/null +++ b/dev/PhpStan/ClassMustBeInternal/Rule.php @@ -0,0 +1,113 @@ + + */ +class Rule implements RuleContract { + public function __construct( + /** + * @var array + */ + protected readonly array $classes, + /** + * @var array + */ + protected readonly array $ignored = [], + ) { + // empty + } + + #[Override] + public function getNodeType(): string { + return InClassNode::class; + } + + /** + * @inheritDoc + */ + #[Override] + public function processNode(Node $node, Scope $scope): array { + // Skip? + $origin = $node->getOriginalNode(); + + if (!($origin instanceof Class_) || $origin->isAnonymous()) { + return []; + } + + // Ignored? + if (in_array((string) $origin->namespacedName, $this->ignored, true)) { + return []; + } + + // Internal? + $reflection = $node->getClassReflection(); + $isInternal = (bool) $reflection->getResolvedPhpDoc()?->isInternal(); + + if ($isInternal) { + return []; + } + + // Must be internal? + if ($this->mustBe($reflection)) { + return [ + RuleErrorBuilder::message( + sprintf('Class `%s` must be marked by `@internal`.', $reflection->getName()), + )->build(), + ]; + } + + // Return + return []; + } + + private function mustBe(ClassReflection $reflection): bool { + return $this->mustBeIsTestInternal($reflection) + || $this->mustBeIsInstanceOf($reflection); + } + + private function mustBeIsInstanceOf(ClassReflection $reflection): bool { + $mustBe = false; + + foreach ($this->classes as $class) { + // Instance? + if ($reflection->is($class) || $reflection->implementsInterface($class)) { + $mustBe = true; + break; + } + } + + return $mustBe; + } + + private function mustBeIsTestInternal(ClassReflection $reflection): bool { + $classname = $reflection->getNativeReflection()->getShortName(); + $filename = pathinfo((string) $reflection->getFileName(), PATHINFO_FILENAME); + $mustBe = $filename + && str_ends_with($filename, 'Test') + && str_starts_with($classname, "{$filename}_"); + + return $mustBe; + } +} diff --git a/dev/PhpStan/ClassMustBeInternal/RuleTest.php b/dev/PhpStan/ClassMustBeInternal/RuleTest.php new file mode 100644 index 000000000..5715d3310 --- /dev/null +++ b/dev/PhpStan/ClassMustBeInternal/RuleTest.php @@ -0,0 +1,90 @@ + + */ +#[CoversClass(Rule::class)] +final class RuleTest extends RuleTestCase { + #[Override] + protected function getRule(): RuleContract { + return new Rule( + [ + RuleTest_MustBeInternalMarker::class, + ], + [ + RuleTest_MustBeIgnored::class, + ], + ); + } + + public function testRule(): void { + $this->analyse([__FILE__], [ + [ + sprintf('Class `%s` must be marked by `@internal`.', RuleTest_MustBeInternal::class), + 58, + ], + [ + sprintf('Class `%s` must be marked by `@internal`.', RuleTest_TestMustBeInternal::class), + 80, + ], + ]); + } +} + +// @phpcs:disable PSR1.Classes.ClassDeclaration.MultipleClasses +// @phpcs:disable Squiz.Classes.ValidClassName.NotCamelCaps + +/** + * @internal + * @noinspection PhpMultipleClassesDeclarationsInOneFile + */ +interface RuleTest_MustBeInternalMarker { + // empty +} + +/** + * @noinspection PhpMultipleClassesDeclarationsInOneFile + */ +class RuleTest_MustBeInternal implements RuleTest_MustBeInternalMarker { + // empty +} + +/** + * @noinspection PhpMultipleClassesDeclarationsInOneFile + */ +class RuleTest_MustBeIgnored implements RuleTest_MustBeInternalMarker { + // empty +} + +/** + * @internal + * @noinspection PhpMultipleClassesDeclarationsInOneFile + */ +class RuleTest_AlreadyInternal implements RuleTest_MustBeInternalMarker { + // empty +} + +/** + * @noinspection PhpMultipleClassesDeclarationsInOneFile + */ +class RuleTest_TestMustBeInternal { + // empty +} + +/** + * @internal + * @noinspection PhpMultipleClassesDeclarationsInOneFile + */ +class RuleTest_TestAlreadyInternal { + // empty +} diff --git a/dev/PhpStan/ClassMustBeInternal/extension.neon b/dev/PhpStan/ClassMustBeInternal/extension.neon new file mode 100644 index 000000000..441d8a5c9 --- /dev/null +++ b/dev/PhpStan/ClassMustBeInternal/extension.neon @@ -0,0 +1,17 @@ +parameters: + classMustBeInternal: [] + +parametersSchema: + classMustBeInternal: structure({ + classes: listOf(string()) + ignored: listOf(string()) + }) + +services: + - + class: LastDragon_ru\LaraASP\Dev\PhpStan\ClassMustBeInternal\Rule + arguments: + classes: %classMustBeInternal.classes% + ignored: %classMustBeInternal.ignored% + tags: + - phpstan.rules.rule diff --git a/dev/PhpStan/Extensions/Container/ContainerExtension.php b/dev/PhpStan/Container/Extension.php similarity index 86% rename from dev/PhpStan/Extensions/Container/ContainerExtension.php rename to dev/PhpStan/Container/Extension.php index 8a3d76a57..f0021cfda 100644 --- a/dev/PhpStan/Extensions/Container/ContainerExtension.php +++ b/dev/PhpStan/Container/Extension.php @@ -1,6 +1,6 @@ // ========================================================================= /** diff --git a/packages/core/src/Helpers/ViewerTest.php b/packages/core/src/Helpers/ViewerTest.php index 2b09bd67d..4d423b7b7 100644 --- a/packages/core/src/Helpers/ViewerTest.php +++ b/packages/core/src/Helpers/ViewerTest.php @@ -12,7 +12,7 @@ * @internal */ #[CoversClass(Viewer::class)] -class ViewerTest extends TestCase { +final class ViewerTest extends TestCase { public function testGet(): void { $view = 'view'; $data = ['a' => 123]; diff --git a/packages/core/src/Observer/DispatcherTest.php b/packages/core/src/Observer/DispatcherTest.php index 95aedb1d0..15fc5abfb 100644 --- a/packages/core/src/Observer/DispatcherTest.php +++ b/packages/core/src/Observer/DispatcherTest.php @@ -11,7 +11,7 @@ * @internal */ #[CoversClass(Dispatcher::class)] -class DispatcherTest extends TestCase { +final class DispatcherTest extends TestCase { public function testSubject(): void { $spy = Mockery::spy(static fn(stdClass $context) => null); $context = new stdClass(); diff --git a/packages/core/src/Provider/WithScheduleTest.php b/packages/core/src/Provider/WithScheduleTest.php index 201d159ab..308186731 100644 --- a/packages/core/src/Provider/WithScheduleTest.php +++ b/packages/core/src/Provider/WithScheduleTest.php @@ -16,7 +16,7 @@ * @internal */ #[CoversClass(WithSchedule::class)] -class WithScheduleTest extends TestCase { +final class WithScheduleTest extends TestCase { public function testRegistration(): void { $this->override(Scheduler::class, static function (MockInterface $mock): void { $mock diff --git a/packages/core/src/Utils/ConfigMergerTest.php b/packages/core/src/Utils/ConfigMergerTest.php index 279ea4849..83783ebaf 100644 --- a/packages/core/src/Utils/ConfigMergerTest.php +++ b/packages/core/src/Utils/ConfigMergerTest.php @@ -4,15 +4,15 @@ use Exception; use InvalidArgumentException; +use LastDragon_ru\LaraASP\Core\Testing\Package\TestCase; use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\TestCase; use stdClass; /** * @internal */ #[CoversClass(ConfigMerger::class)] -class ConfigMergerTest extends TestCase { +final class ConfigMergerTest extends TestCase { // // ========================================================================= /** diff --git a/packages/core/src/Utils/SchedulerTest.php b/packages/core/src/Utils/SchedulerTest.php index 9157d7378..50dbedaa2 100644 --- a/packages/core/src/Utils/SchedulerTest.php +++ b/packages/core/src/Utils/SchedulerTest.php @@ -16,7 +16,7 @@ * @internal */ #[CoversClass(Scheduler::class)] -class SchedulerTest extends TestCase { +final class SchedulerTest extends TestCase { public function testRegisterClass(): void { // Mocks $job = new class() implements Schedulable { diff --git a/packages/documentator/src/Commands/CommandsTest.php b/packages/documentator/src/Commands/CommandsTest.php index f43d84c43..0cda89872 100644 --- a/packages/documentator/src/Commands/CommandsTest.php +++ b/packages/documentator/src/Commands/CommandsTest.php @@ -22,7 +22,7 @@ * @internal */ #[CoversClass(Commands::class)] -class CommandsTest extends TestCase { +final class CommandsTest extends TestCase { // // ========================================================================= /** @@ -42,7 +42,7 @@ public function testInvoke(): void { $directory = Path::normalize(self::getTempDirectory()); self::assertNotFalse( - file_put_contents(Path::join($directory, 'file.txt'), static::class), + file_put_contents(Path::join($directory, 'file.txt'), self::class), ); $result = $this diff --git a/packages/documentator/src/Commands/RequirementsTest.php b/packages/documentator/src/Commands/RequirementsTest.php index cfdeb3949..034a74d03 100644 --- a/packages/documentator/src/Commands/RequirementsTest.php +++ b/packages/documentator/src/Commands/RequirementsTest.php @@ -13,7 +13,7 @@ * @internal */ #[CoversClass(Requirements::class)] -class RequirementsTest extends TestCase { +final class RequirementsTest extends TestCase { public function testGetMergedVersions(): void { $command = new class() extends Requirements { /** diff --git a/packages/documentator/src/Preprocessor/Instructions/IncludeDocBlockTest.php b/packages/documentator/src/Preprocessor/Instructions/IncludeDocBlockTest.php index 6c4f6428e..005991e78 100644 --- a/packages/documentator/src/Preprocessor/Instructions/IncludeDocBlockTest.php +++ b/packages/documentator/src/Preprocessor/Instructions/IncludeDocBlockTest.php @@ -14,7 +14,7 @@ * @internal */ #[CoversClass(IncludeDocBlock::class)] -class IncludeDocBlockTest extends TestCase { +final class IncludeDocBlockTest extends TestCase { // // ========================================================================= /** diff --git a/packages/documentator/src/Preprocessor/Instructions/IncludeDocumentListTest.php b/packages/documentator/src/Preprocessor/Instructions/IncludeDocumentListTest.php index d42f82724..1a5623eb7 100644 --- a/packages/documentator/src/Preprocessor/Instructions/IncludeDocumentListTest.php +++ b/packages/documentator/src/Preprocessor/Instructions/IncludeDocumentListTest.php @@ -13,7 +13,7 @@ * @internal */ #[CoversClass(IncludeDocumentList::class)] -class IncludeDocumentListTest extends TestCase { +final class IncludeDocumentListTest extends TestCase { public function testProcessSameDirectory(): void { $path = self::getTestData()->file('Document.md'); $params = new IncludeDocumentListParameters(); diff --git a/packages/documentator/src/Preprocessor/Instructions/IncludeExampleTest.php b/packages/documentator/src/Preprocessor/Instructions/IncludeExampleTest.php index ad28a8008..71b1342a5 100644 --- a/packages/documentator/src/Preprocessor/Instructions/IncludeExampleTest.php +++ b/packages/documentator/src/Preprocessor/Instructions/IncludeExampleTest.php @@ -18,7 +18,7 @@ * @internal */ #[CoversClass(IncludeFile::class)] -class IncludeExampleTest extends TestCase { +final class IncludeExampleTest extends TestCase { public function testProcessNoRun(): void { $path = self::getTestData()->path('~example.md'); $file = basename(self::getTestData()->path('~example.md')); diff --git a/packages/documentator/src/Preprocessor/Instructions/IncludeExecTest.php b/packages/documentator/src/Preprocessor/Instructions/IncludeExecTest.php index 0a6cd954d..f6fd1ddef 100644 --- a/packages/documentator/src/Preprocessor/Instructions/IncludeExecTest.php +++ b/packages/documentator/src/Preprocessor/Instructions/IncludeExecTest.php @@ -14,7 +14,7 @@ * @internal */ #[CoversClass(IncludeFile::class)] -class IncludeExecTest extends TestCase { +final class IncludeExecTest extends TestCase { public function testProcess(): void { $path = 'current/working/directory/file.md'; $expected = 'result'; diff --git a/packages/documentator/src/Preprocessor/Instructions/IncludeFileTest.php b/packages/documentator/src/Preprocessor/Instructions/IncludeFileTest.php index 07dfa5b6e..8bd9efb47 100644 --- a/packages/documentator/src/Preprocessor/Instructions/IncludeFileTest.php +++ b/packages/documentator/src/Preprocessor/Instructions/IncludeFileTest.php @@ -10,7 +10,7 @@ * @internal */ #[CoversClass(IncludeFile::class)] -class IncludeFileTest extends TestCase { +final class IncludeFileTest extends TestCase { public function testProcessRelative(): void { $file = self::getTestData()->file('.md'); $instance = Container::getInstance()->make(IncludeFile::class); diff --git a/packages/documentator/src/Preprocessor/Instructions/IncludePackageListTest.php b/packages/documentator/src/Preprocessor/Instructions/IncludePackageListTest.php index f05afd8a6..602b40905 100644 --- a/packages/documentator/src/Preprocessor/Instructions/IncludePackageListTest.php +++ b/packages/documentator/src/Preprocessor/Instructions/IncludePackageListTest.php @@ -15,7 +15,7 @@ * @internal */ #[CoversClass(IncludePackageList::class)] -class IncludePackageListTest extends TestCase { +final class IncludePackageListTest extends TestCase { public function testProcess(): void { $path = self::getTestData()->file('Document.md')->getPathname(); $target = basename(self::getTestData()->path('/packages')); diff --git a/packages/documentator/src/Preprocessor/Instructions/IncludeTemplateTest.php b/packages/documentator/src/Preprocessor/Instructions/IncludeTemplateTest.php index 23cd4fa8b..214140318 100644 --- a/packages/documentator/src/Preprocessor/Instructions/IncludeTemplateTest.php +++ b/packages/documentator/src/Preprocessor/Instructions/IncludeTemplateTest.php @@ -13,7 +13,7 @@ * @internal */ #[CoversClass(IncludeTemplate::class)] -class IncludeTemplateTest extends TestCase { +final class IncludeTemplateTest extends TestCase { public function testProcessRelative(): void { $file = self::getTestData()->file('.md'); $params = new IncludeTemplateParameters([ diff --git a/packages/documentator/src/Preprocessor/PreprocessorTest.php b/packages/documentator/src/Preprocessor/PreprocessorTest.php index 27c1d7d40..cf7799dcc 100644 --- a/packages/documentator/src/Preprocessor/PreprocessorTest.php +++ b/packages/documentator/src/Preprocessor/PreprocessorTest.php @@ -12,8 +12,11 @@ use Mockery\Matcher\IsEqual; use PHPUnit\Framework\Attributes\CoversClass; +/** + * @internal + */ #[CoversClass(Preprocessor::class)] -class PreprocessorTest extends TestCase { +final class PreprocessorTest extends TestCase { public function testProcess(): void { $content = <<<'MARKDOWN' Bla bla bla [processable]: ./path/to/file should be ignored. diff --git a/packages/documentator/src/Testing/Package/TestCase.php b/packages/documentator/src/Testing/Package/TestCase.php index 8bb906e86..00523fd83 100644 --- a/packages/documentator/src/Testing/Package/TestCase.php +++ b/packages/documentator/src/Testing/Package/TestCase.php @@ -10,7 +10,7 @@ /** * @internal */ -class TestCase extends PackageTestCase { +abstract class TestCase extends PackageTestCase { /** * @inheritDoc */ diff --git a/packages/documentator/src/Utils/ArtisanSerializerTest.php b/packages/documentator/src/Utils/ArtisanSerializerTest.php index c0ac0e6ea..46664edef 100644 --- a/packages/documentator/src/Utils/ArtisanSerializerTest.php +++ b/packages/documentator/src/Utils/ArtisanSerializerTest.php @@ -14,7 +14,7 @@ * @internal */ #[CoversClass(ArtisanSerializer::class)] -class ArtisanSerializerTest extends TestCase { +final class ArtisanSerializerTest extends TestCase { // // ========================================================================= /** diff --git a/packages/documentator/src/Utils/MarkdownTest.php b/packages/documentator/src/Utils/MarkdownTest.php index 0973db750..7522116ee 100644 --- a/packages/documentator/src/Utils/MarkdownTest.php +++ b/packages/documentator/src/Utils/MarkdownTest.php @@ -9,7 +9,7 @@ * @internal */ #[CoversClass(Markdown::class)] -class MarkdownTest extends TestCase { +final class MarkdownTest extends TestCase { public function testGetTitle(): void { self::assertNull( Markdown::getTitle( diff --git a/packages/documentator/src/Utils/PathTest.php b/packages/documentator/src/Utils/PathTest.php index 11c475d45..b4f273c25 100644 --- a/packages/documentator/src/Utils/PathTest.php +++ b/packages/documentator/src/Utils/PathTest.php @@ -12,7 +12,7 @@ * @internal */ #[CoversClass(Path::class)] -class PathTest extends TestCase { +final class PathTest extends TestCase { public function testGetPath(): void { self::assertEquals('/absolute/path/to/file', Path::getPath('any/path', '/absolute/path/./to/file')); self::assertEquals('/absolute/path/to/file', Path::getPath('/absolute/path', 'to/./file')); diff --git a/packages/documentator/src/Utils/VersionTest.php b/packages/documentator/src/Utils/VersionTest.php index 652daf5c0..e07bfb319 100644 --- a/packages/documentator/src/Utils/VersionTest.php +++ b/packages/documentator/src/Utils/VersionTest.php @@ -9,7 +9,7 @@ * @internal */ #[CoversClass(Version::class)] -class VersionTest extends TestCase { +final class VersionTest extends TestCase { public function testCompare(): void { self::assertEquals(0, Version::compare('1.2.3', '1.2.3')); self::assertEquals(0, Version::compare('v1.2.3', '1.2.3')); diff --git a/packages/eloquent/src/Concerns/WithDateSerializationTest.php b/packages/eloquent/src/Concerns/WithDateSerializationTest.php index 38fc43a39..79707924b 100644 --- a/packages/eloquent/src/Concerns/WithDateSerializationTest.php +++ b/packages/eloquent/src/Concerns/WithDateSerializationTest.php @@ -15,7 +15,7 @@ * @internal */ #[CoversClass(WithDateSerialization::class)] -class WithDateSerializationTest extends TestCase { +final class WithDateSerializationTest extends TestCase { public function testSerializeDate(): void { // Prepare $trait = new class() extends Model { diff --git a/packages/eloquent/src/Iterators/ChunkedChangeSafeIteratorTest.php b/packages/eloquent/src/Iterators/ChunkedChangeSafeIteratorTest.php index af9dc48f0..807c323e1 100644 --- a/packages/eloquent/src/Iterators/ChunkedChangeSafeIteratorTest.php +++ b/packages/eloquent/src/Iterators/ChunkedChangeSafeIteratorTest.php @@ -23,7 +23,7 @@ * @internal */ #[CoversClass(ChunkedChangeSafeIterator::class)] -class ChunkedChangeSafeIteratorTest extends TestCase { +final class ChunkedChangeSafeIteratorTest extends TestCase { use WithTestObject; use WithQueryLog; diff --git a/packages/eloquent/src/Iterators/ChunkedIteratorTest.php b/packages/eloquent/src/Iterators/ChunkedIteratorTest.php index 85ec1e215..079e54dc7 100644 --- a/packages/eloquent/src/Iterators/ChunkedIteratorTest.php +++ b/packages/eloquent/src/Iterators/ChunkedIteratorTest.php @@ -18,7 +18,7 @@ * @internal */ #[CoversClass(ChunkedIterator::class)] -class ChunkedIteratorTest extends TestCase { +final class ChunkedIteratorTest extends TestCase { use WithTestObject; use WithQueryLog; diff --git a/packages/eloquent/src/Iterators/IteratorImplTest.php b/packages/eloquent/src/Iterators/IteratorImplTest.php index c504e352e..fd60d70ab 100644 --- a/packages/eloquent/src/Iterators/IteratorImplTest.php +++ b/packages/eloquent/src/Iterators/IteratorImplTest.php @@ -14,7 +14,7 @@ * @internal */ #[CoversClass(IteratorImpl::class)] -class IteratorImplTest extends TestCase { +final class IteratorImplTest extends TestCase { // // ========================================================================= /** diff --git a/packages/eloquent/src/Mixins/EloquentBuilderMixinTest.php b/packages/eloquent/src/Mixins/EloquentBuilderMixinTest.php index e29423ad5..5c7b13c8c 100644 --- a/packages/eloquent/src/Mixins/EloquentBuilderMixinTest.php +++ b/packages/eloquent/src/Mixins/EloquentBuilderMixinTest.php @@ -16,7 +16,7 @@ * @internal */ #[CoversClass(EloquentBuilderMixin::class)] -class EloquentBuilderMixinTest extends TestCase { +final class EloquentBuilderMixinTest extends TestCase { use WithTestObject; public function testIterator(): void { diff --git a/packages/eloquent/src/ModelHelperTest.php b/packages/eloquent/src/ModelHelperTest.php index 5316c270e..797d356a9 100644 --- a/packages/eloquent/src/ModelHelperTest.php +++ b/packages/eloquent/src/ModelHelperTest.php @@ -23,7 +23,7 @@ * @internal */ #[CoversClass(ModelHelper::class)] -class ModelHelperTest extends TestCase { +final class ModelHelperTest extends TestCase { // // ========================================================================= /** diff --git a/packages/formatter/src/Formatter.php b/packages/formatter/src/Formatter.php index 874562c4e..c57999ff2 100644 --- a/packages/formatter/src/Formatter.php +++ b/packages/formatter/src/Formatter.php @@ -152,8 +152,8 @@ class Formatter { /** * Options (one of): - * - `int`: {@link \IntlDateFormatter::SHORT}, {@link \IntlDateFormatter::FULL}, - * {@link \IntlDateFormatter::LONG} or {@link \IntlDateFormatter::MEDIUM} + * - `int`: {@link IntlDateFormatter::SHORT}, {@link IntlDateFormatter::FULL}, + * {@link IntlDateFormatter::LONG} or {@link IntlDateFormatter::MEDIUM} * - `string`: the name of custom format * * Locales options: diff --git a/packages/formatter/src/FormatterTest.php b/packages/formatter/src/FormatterTest.php index 85599f2a1..3b63f2b69 100644 --- a/packages/formatter/src/FormatterTest.php +++ b/packages/formatter/src/FormatterTest.php @@ -20,7 +20,7 @@ * @internal */ #[CoversClass(Formatter::class)] -class FormatterTest extends TestCase { +final class FormatterTest extends TestCase { protected Formatter $formatter; // diff --git a/packages/formatter/src/ProviderTest.php b/packages/formatter/src/ProviderTest.php index 826327439..cf2cc9016 100644 --- a/packages/formatter/src/ProviderTest.php +++ b/packages/formatter/src/ProviderTest.php @@ -10,7 +10,7 @@ * @internal */ #[CoversClass(Provider::class)] -class ProviderTest extends TestCase { +final class ProviderTest extends TestCase { public function testRegister(): void { self::assertSame( Container::getInstance()->make(Formatter::class), diff --git a/packages/formatter/src/Testing/Package/TestCase.php b/packages/formatter/src/Testing/Package/TestCase.php index 3f9fe5f09..5db484ed2 100644 --- a/packages/formatter/src/Testing/Package/TestCase.php +++ b/packages/formatter/src/Testing/Package/TestCase.php @@ -9,7 +9,7 @@ /** * @internal */ -class TestCase extends PackageTestCase { +abstract class TestCase extends PackageTestCase { /** * @inheritDoc */ diff --git a/packages/formatter/src/Utils/DurationFormatterTest.php b/packages/formatter/src/Utils/DurationFormatterTest.php index d857acb86..a998bc4f2 100644 --- a/packages/formatter/src/Utils/DurationFormatterTest.php +++ b/packages/formatter/src/Utils/DurationFormatterTest.php @@ -11,7 +11,7 @@ * @internal */ #[CoversClass(DurationFormatter::class)] -class DurationFormatterTest extends TestCase { +final class DurationFormatterTest extends TestCase { // // ========================================================================= /** diff --git a/packages/formatter/src/Utils/UnicodeDateTimeFormatParserTest.php b/packages/formatter/src/Utils/UnicodeDateTimeFormatParserTest.php index 19eeb71dd..b0650b6b0 100644 --- a/packages/formatter/src/Utils/UnicodeDateTimeFormatParserTest.php +++ b/packages/formatter/src/Utils/UnicodeDateTimeFormatParserTest.php @@ -12,7 +12,7 @@ * @internal */ #[CoversClass(UnicodeDateTimeFormatParser::class)] -class UnicodeDateTimeFormatParserTest extends TestCase { +final class UnicodeDateTimeFormatParserTest extends TestCase { // // ========================================================================= /** diff --git a/packages/graphql-printer/src/Blocks/BlockTest.php b/packages/graphql-printer/src/Blocks/BlockTest.php index 61c0d0987..507da6ffc 100644 --- a/packages/graphql-printer/src/Blocks/BlockTest.php +++ b/packages/graphql-printer/src/Blocks/BlockTest.php @@ -14,6 +14,7 @@ use GraphQL\Type\Definition\Type; use GraphQL\Type\Definition\UnresolvedFieldDefinition; use GraphQL\Type\Schema; +use LastDragon_ru\LaraASP\GraphQLPrinter\Contracts\Settings; use LastDragon_ru\LaraASP\GraphQLPrinter\Misc\Collector; use LastDragon_ru\LaraASP\GraphQLPrinter\Misc\Context; use LastDragon_ru\LaraASP\GraphQLPrinter\Testing\Package\GraphQLAstNode; @@ -38,7 +39,7 @@ * @internal */ #[CoversClass(Block::class)] -class BlockTest extends TestCase { +final class BlockTest extends TestCase { // // ========================================================================= #[CoversNothing] @@ -183,7 +184,7 @@ protected function getExpectedClasses(string $target, array $classes = [], array // // ========================================================================= /** - * @return array + * @return array */ public static function dataProviderIsMultiline(): array { $settings = new TestSettings(); diff --git a/packages/graphql-printer/src/Blocks/Document/ArgumentTest.php b/packages/graphql-printer/src/Blocks/Document/ArgumentTest.php index 2f3b8c2fb..cd283d765 100644 --- a/packages/graphql-printer/src/Blocks/Document/ArgumentTest.php +++ b/packages/graphql-printer/src/Blocks/Document/ArgumentTest.php @@ -18,7 +18,7 @@ * @internal */ #[CoversClass(Argument::class)] -class ArgumentTest extends TestCase { +final class ArgumentTest extends TestCase { // // ========================================================================= /** diff --git a/packages/graphql-printer/src/Blocks/Document/DirectiveDefinitionTest.php b/packages/graphql-printer/src/Blocks/Document/DirectiveDefinitionTest.php index 2b97bc356..43103c2c3 100644 --- a/packages/graphql-printer/src/Blocks/Document/DirectiveDefinitionTest.php +++ b/packages/graphql-printer/src/Blocks/Document/DirectiveDefinitionTest.php @@ -22,7 +22,7 @@ #[CoversClass(ArgumentsDefinition::class)] #[CoversClass(DirectiveLocations::class)] #[CoversClass(DirectiveLocation::class)] -class DirectiveDefinitionTest extends TestCase { +final class DirectiveDefinitionTest extends TestCase { // // ========================================================================= /** diff --git a/packages/graphql-printer/src/Blocks/Document/DirectiveTest.php b/packages/graphql-printer/src/Blocks/Document/DirectiveTest.php index 93175ee06..3b3184d25 100644 --- a/packages/graphql-printer/src/Blocks/Document/DirectiveTest.php +++ b/packages/graphql-printer/src/Blocks/Document/DirectiveTest.php @@ -23,7 +23,7 @@ * @internal */ #[CoversClass(Directive::class)] -class DirectiveTest extends TestCase { +final class DirectiveTest extends TestCase { // // ========================================================================= /** diff --git a/packages/graphql-printer/src/Blocks/Document/DirectivesTest.php b/packages/graphql-printer/src/Blocks/Document/DirectivesTest.php index 9bf40054d..80d56ee54 100644 --- a/packages/graphql-printer/src/Blocks/Document/DirectivesTest.php +++ b/packages/graphql-printer/src/Blocks/Document/DirectivesTest.php @@ -16,7 +16,7 @@ * @internal */ #[CoversClass(Directives::class)] -class DirectivesTest extends TestCase { +final class DirectivesTest extends TestCase { // // ========================================================================= /** diff --git a/packages/graphql-printer/src/Blocks/Document/DocumentTest.php b/packages/graphql-printer/src/Blocks/Document/DocumentTest.php index b83735e37..b575d765a 100644 --- a/packages/graphql-printer/src/Blocks/Document/DocumentTest.php +++ b/packages/graphql-printer/src/Blocks/Document/DocumentTest.php @@ -17,7 +17,7 @@ * @internal */ #[CoversClass(Document::class)] -class DocumentTest extends TestCase { +final class DocumentTest extends TestCase { // // ========================================================================= /** diff --git a/packages/graphql-printer/src/Blocks/Document/EnumTypeDefinitionTest.php b/packages/graphql-printer/src/Blocks/Document/EnumTypeDefinitionTest.php index e30a23e74..2f06a7de7 100644 --- a/packages/graphql-printer/src/Blocks/Document/EnumTypeDefinitionTest.php +++ b/packages/graphql-printer/src/Blocks/Document/EnumTypeDefinitionTest.php @@ -17,7 +17,7 @@ */ #[CoversClass(EnumTypeDefinition::class)] #[CoversClass(EnumValuesDefinition::class)] -class EnumTypeDefinitionTest extends TestCase { +final class EnumTypeDefinitionTest extends TestCase { // // ========================================================================= /** diff --git a/packages/graphql-printer/src/Blocks/Document/EnumTypeExtensionTest.php b/packages/graphql-printer/src/Blocks/Document/EnumTypeExtensionTest.php index deff094c4..a46360df5 100644 --- a/packages/graphql-printer/src/Blocks/Document/EnumTypeExtensionTest.php +++ b/packages/graphql-printer/src/Blocks/Document/EnumTypeExtensionTest.php @@ -16,7 +16,7 @@ */ #[CoversClass(EnumTypeExtension::class)] #[CoversClass(EnumValuesDefinition::class)] -class EnumTypeExtensionTest extends TestCase { +final class EnumTypeExtensionTest extends TestCase { // // ========================================================================= /** diff --git a/packages/graphql-printer/src/Blocks/Document/EnumValueDefinitionTest.php b/packages/graphql-printer/src/Blocks/Document/EnumValueDefinitionTest.php index 31f948882..1c42e9a41 100644 --- a/packages/graphql-printer/src/Blocks/Document/EnumValueDefinitionTest.php +++ b/packages/graphql-printer/src/Blocks/Document/EnumValueDefinitionTest.php @@ -16,7 +16,7 @@ * @internal */ #[CoversClass(EnumValueDefinition::class)] -class EnumValueDefinitionTest extends TestCase { +final class EnumValueDefinitionTest extends TestCase { // // ========================================================================= /** diff --git a/packages/graphql-printer/src/Blocks/Document/FieldDefinitionTest.php b/packages/graphql-printer/src/Blocks/Document/FieldDefinitionTest.php index 0c04f8735..5c25ea447 100644 --- a/packages/graphql-printer/src/Blocks/Document/FieldDefinitionTest.php +++ b/packages/graphql-printer/src/Blocks/Document/FieldDefinitionTest.php @@ -21,7 +21,7 @@ */ #[CoversClass(FieldDefinition::class)] #[CoversClass(ArgumentsDefinition::class)] -class FieldDefinitionTest extends TestCase { +final class FieldDefinitionTest extends TestCase { // // ========================================================================= /** diff --git a/packages/graphql-printer/src/Blocks/Document/FieldTest.php b/packages/graphql-printer/src/Blocks/Document/FieldTest.php index f06fcec55..b08727fc2 100644 --- a/packages/graphql-printer/src/Blocks/Document/FieldTest.php +++ b/packages/graphql-printer/src/Blocks/Document/FieldTest.php @@ -20,7 +20,7 @@ * @internal */ #[CoversClass(Field::class)] -class FieldTest extends TestCase { +final class FieldTest extends TestCase { // // ========================================================================= /** diff --git a/packages/graphql-printer/src/Blocks/Document/FragmentDefinitionTest.php b/packages/graphql-printer/src/Blocks/Document/FragmentDefinitionTest.php index 35c4af691..77300d902 100644 --- a/packages/graphql-printer/src/Blocks/Document/FragmentDefinitionTest.php +++ b/packages/graphql-printer/src/Blocks/Document/FragmentDefinitionTest.php @@ -17,7 +17,7 @@ * @internal */ #[CoversClass(FragmentDefinition::class)] -class FragmentDefinitionTest extends TestCase { +final class FragmentDefinitionTest extends TestCase { // // ========================================================================= /** diff --git a/packages/graphql-printer/src/Blocks/Document/FragmentSpreadTest.php b/packages/graphql-printer/src/Blocks/Document/FragmentSpreadTest.php index ff5ee71af..f8d3159a6 100644 --- a/packages/graphql-printer/src/Blocks/Document/FragmentSpreadTest.php +++ b/packages/graphql-printer/src/Blocks/Document/FragmentSpreadTest.php @@ -21,7 +21,7 @@ * @internal */ #[CoversClass(FragmentSpread::class)] -class FragmentSpreadTest extends TestCase { +final class FragmentSpreadTest extends TestCase { // // ========================================================================= /** diff --git a/packages/graphql-printer/src/Blocks/Document/InlineFragmentTest.php b/packages/graphql-printer/src/Blocks/Document/InlineFragmentTest.php index b4a2f03f2..6a46daa9f 100644 --- a/packages/graphql-printer/src/Blocks/Document/InlineFragmentTest.php +++ b/packages/graphql-printer/src/Blocks/Document/InlineFragmentTest.php @@ -21,7 +21,7 @@ * @internal */ #[CoversClass(InlineFragment::class)] -class InlineFragmentTest extends TestCase { +final class InlineFragmentTest extends TestCase { // // ========================================================================= /** diff --git a/packages/graphql-printer/src/Blocks/Document/InputObjectTypeDefinitionTest.php b/packages/graphql-printer/src/Blocks/Document/InputObjectTypeDefinitionTest.php index 31a79fdc9..87b39a170 100644 --- a/packages/graphql-printer/src/Blocks/Document/InputObjectTypeDefinitionTest.php +++ b/packages/graphql-printer/src/Blocks/Document/InputObjectTypeDefinitionTest.php @@ -18,7 +18,7 @@ */ #[CoversClass(InputObjectTypeDefinition::class)] #[CoversClass(InputFieldsDefinition::class)] -class InputObjectTypeDefinitionTest extends TestCase { +final class InputObjectTypeDefinitionTest extends TestCase { // // ========================================================================= /** diff --git a/packages/graphql-printer/src/Blocks/Document/InputObjectTypeExtensionTest.php b/packages/graphql-printer/src/Blocks/Document/InputObjectTypeExtensionTest.php index 2627f81fe..306b4091c 100644 --- a/packages/graphql-printer/src/Blocks/Document/InputObjectTypeExtensionTest.php +++ b/packages/graphql-printer/src/Blocks/Document/InputObjectTypeExtensionTest.php @@ -18,7 +18,7 @@ */ #[CoversClass(InputObjectTypeExtension::class)] #[CoversClass(InputFieldsDefinition::class)] -class InputObjectTypeExtensionTest extends TestCase { +final class InputObjectTypeExtensionTest extends TestCase { // // ========================================================================= /** diff --git a/packages/graphql-printer/src/Blocks/Document/InputValueDefinitionTest.php b/packages/graphql-printer/src/Blocks/Document/InputValueDefinitionTest.php index c37798b39..33acb4dce 100644 --- a/packages/graphql-printer/src/Blocks/Document/InputValueDefinitionTest.php +++ b/packages/graphql-printer/src/Blocks/Document/InputValueDefinitionTest.php @@ -20,7 +20,7 @@ * @internal */ #[CoversClass(InputValueDefinition::class)] -class InputValueDefinitionTest extends TestCase { +final class InputValueDefinitionTest extends TestCase { // // ========================================================================= /** diff --git a/packages/graphql-printer/src/Blocks/Document/InterfaceTypeDefinitionTest.php b/packages/graphql-printer/src/Blocks/Document/InterfaceTypeDefinitionTest.php index 08d6272d0..b02769243 100644 --- a/packages/graphql-printer/src/Blocks/Document/InterfaceTypeDefinitionTest.php +++ b/packages/graphql-printer/src/Blocks/Document/InterfaceTypeDefinitionTest.php @@ -18,7 +18,7 @@ * @internal */ #[CoversClass(InterfaceTypeDefinition::class)] -class InterfaceTypeDefinitionTest extends TestCase { +final class InterfaceTypeDefinitionTest extends TestCase { // // ========================================================================= /** diff --git a/packages/graphql-printer/src/Blocks/Document/InterfaceTypeExtensionTest.php b/packages/graphql-printer/src/Blocks/Document/InterfaceTypeExtensionTest.php index 94fc387ab..e096086f6 100644 --- a/packages/graphql-printer/src/Blocks/Document/InterfaceTypeExtensionTest.php +++ b/packages/graphql-printer/src/Blocks/Document/InterfaceTypeExtensionTest.php @@ -17,7 +17,7 @@ * @internal */ #[CoversClass(InterfaceTypeExtension::class)] -class InterfaceTypeExtensionTest extends TestCase { +final class InterfaceTypeExtensionTest extends TestCase { // // ========================================================================= /** diff --git a/packages/graphql-printer/src/Blocks/Document/ObjectTypeDefinitionTest.php b/packages/graphql-printer/src/Blocks/Document/ObjectTypeDefinitionTest.php index d1db42e9e..f074718db 100644 --- a/packages/graphql-printer/src/Blocks/Document/ObjectTypeDefinitionTest.php +++ b/packages/graphql-printer/src/Blocks/Document/ObjectTypeDefinitionTest.php @@ -18,7 +18,7 @@ * @internal */ #[CoversClass(ObjectTypeDefinition::class)] -class ObjectTypeDefinitionTest extends TestCase { +final class ObjectTypeDefinitionTest extends TestCase { // // ========================================================================= /** diff --git a/packages/graphql-printer/src/Blocks/Document/ObjectTypeExtensionTest.php b/packages/graphql-printer/src/Blocks/Document/ObjectTypeExtensionTest.php index f8a4bc7fd..fb5ad8d24 100644 --- a/packages/graphql-printer/src/Blocks/Document/ObjectTypeExtensionTest.php +++ b/packages/graphql-printer/src/Blocks/Document/ObjectTypeExtensionTest.php @@ -17,7 +17,7 @@ * @internal */ #[CoversClass(ObjectTypeExtension::class)] -class ObjectTypeExtensionTest extends TestCase { +final class ObjectTypeExtensionTest extends TestCase { // // ========================================================================= /** diff --git a/packages/graphql-printer/src/Blocks/Document/OperationDefinitionTest.php b/packages/graphql-printer/src/Blocks/Document/OperationDefinitionTest.php index 37a21c886..80176b32d 100644 --- a/packages/graphql-printer/src/Blocks/Document/OperationDefinitionTest.php +++ b/packages/graphql-printer/src/Blocks/Document/OperationDefinitionTest.php @@ -20,7 +20,7 @@ * @internal */ #[CoversClass(OperationDefinition::class)] -class OperationDefinitionTest extends TestCase { +final class OperationDefinitionTest extends TestCase { // // ========================================================================= /** diff --git a/packages/graphql-printer/src/Blocks/Document/ScalarTypeDefinitionTest.php b/packages/graphql-printer/src/Blocks/Document/ScalarTypeDefinitionTest.php index 577f3b5bd..34bbb76c4 100644 --- a/packages/graphql-printer/src/Blocks/Document/ScalarTypeDefinitionTest.php +++ b/packages/graphql-printer/src/Blocks/Document/ScalarTypeDefinitionTest.php @@ -17,7 +17,7 @@ * @internal */ #[CoversClass(ScalarTypeDefinition::class)] -class ScalarTypeDefinitionTest extends TestCase { +final class ScalarTypeDefinitionTest extends TestCase { // // ========================================================================= /** diff --git a/packages/graphql-printer/src/Blocks/Document/ScalarTypeExtensionTest.php b/packages/graphql-printer/src/Blocks/Document/ScalarTypeExtensionTest.php index 0a60c4dd7..f029dd7c1 100644 --- a/packages/graphql-printer/src/Blocks/Document/ScalarTypeExtensionTest.php +++ b/packages/graphql-printer/src/Blocks/Document/ScalarTypeExtensionTest.php @@ -15,7 +15,7 @@ * @internal */ #[CoversClass(ScalarTypeExtension::class)] -class ScalarTypeExtensionTest extends TestCase { +final class ScalarTypeExtensionTest extends TestCase { // // ========================================================================= /** diff --git a/packages/graphql-printer/src/Blocks/Document/SchemaDefinitionTest.php b/packages/graphql-printer/src/Blocks/Document/SchemaDefinitionTest.php index 7e027c25b..a9b78f71f 100644 --- a/packages/graphql-printer/src/Blocks/Document/SchemaDefinitionTest.php +++ b/packages/graphql-printer/src/Blocks/Document/SchemaDefinitionTest.php @@ -22,7 +22,7 @@ #[CoversClass(SchemaDefinition::class)] #[CoversClass(RootOperationTypeDefinition::class)] #[CoversClass(RootOperationTypesDefinition::class)] -class SchemaDefinitionTest extends TestCase { +final class SchemaDefinitionTest extends TestCase { // // ========================================================================= /** diff --git a/packages/graphql-printer/src/Blocks/Document/SchemaExtensionTest.php b/packages/graphql-printer/src/Blocks/Document/SchemaExtensionTest.php index b80ecc43f..767878317 100644 --- a/packages/graphql-printer/src/Blocks/Document/SchemaExtensionTest.php +++ b/packages/graphql-printer/src/Blocks/Document/SchemaExtensionTest.php @@ -19,7 +19,7 @@ #[CoversClass(SchemaExtension::class)] #[CoversClass(RootOperationTypeDefinition::class)] #[CoversClass(RootOperationTypesDefinition::class)] -class SchemaExtensionTest extends TestCase { +final class SchemaExtensionTest extends TestCase { // // ========================================================================= /** diff --git a/packages/graphql-printer/src/Blocks/Document/TypeTest.php b/packages/graphql-printer/src/Blocks/Document/TypeTest.php index e6dd6a974..f4fcbdb32 100644 --- a/packages/graphql-printer/src/Blocks/Document/TypeTest.php +++ b/packages/graphql-printer/src/Blocks/Document/TypeTest.php @@ -24,7 +24,7 @@ * @internal */ #[CoversClass(Type::class)] -class TypeTest extends TestCase { +final class TypeTest extends TestCase { // // ========================================================================= /** diff --git a/packages/graphql-printer/src/Blocks/Document/UnionTypeDefinitionTest.php b/packages/graphql-printer/src/Blocks/Document/UnionTypeDefinitionTest.php index 236b6d707..abe307021 100644 --- a/packages/graphql-printer/src/Blocks/Document/UnionTypeDefinitionTest.php +++ b/packages/graphql-printer/src/Blocks/Document/UnionTypeDefinitionTest.php @@ -19,7 +19,7 @@ */ #[CoversClass(UnionTypeDefinition::class)] #[CoversClass(UnionMemberTypes::class)] -class UnionTypeDefinitionTest extends TestCase { +final class UnionTypeDefinitionTest extends TestCase { // // ========================================================================= /** diff --git a/packages/graphql-printer/src/Blocks/Document/UnionTypeExtensionTest.php b/packages/graphql-printer/src/Blocks/Document/UnionTypeExtensionTest.php index d95fd6216..9e359bfa1 100644 --- a/packages/graphql-printer/src/Blocks/Document/UnionTypeExtensionTest.php +++ b/packages/graphql-printer/src/Blocks/Document/UnionTypeExtensionTest.php @@ -18,7 +18,7 @@ */ #[CoversClass(UnionTypeExtension::class)] #[CoversClass(UnionMemberTypes::class)] -class UnionTypeExtensionTest extends TestCase { +final class UnionTypeExtensionTest extends TestCase { // // ========================================================================= /** diff --git a/packages/graphql-printer/src/Blocks/Document/ValueTest.php b/packages/graphql-printer/src/Blocks/Document/ValueTest.php index e81f873b4..eb551aa1e 100644 --- a/packages/graphql-printer/src/Blocks/Document/ValueTest.php +++ b/packages/graphql-printer/src/Blocks/Document/ValueTest.php @@ -33,7 +33,7 @@ * @internal */ #[CoversClass(Value::class)] -class ValueTest extends TestCase { +final class ValueTest extends TestCase { // // ========================================================================= /** diff --git a/packages/graphql-printer/src/Blocks/Document/VariableDefinitionTest.php b/packages/graphql-printer/src/Blocks/Document/VariableDefinitionTest.php index 2f6f6d0bb..d9eb511f1 100644 --- a/packages/graphql-printer/src/Blocks/Document/VariableDefinitionTest.php +++ b/packages/graphql-printer/src/Blocks/Document/VariableDefinitionTest.php @@ -17,7 +17,7 @@ * @internal */ #[CoversClass(VariableDefinition::class)] -class VariableDefinitionTest extends TestCase { +final class VariableDefinitionTest extends TestCase { // // ========================================================================= /** diff --git a/packages/graphql-printer/src/Blocks/ListBlockTest.php b/packages/graphql-printer/src/Blocks/ListBlockTest.php index ab354c5f9..2d9050d93 100644 --- a/packages/graphql-printer/src/Blocks/ListBlockTest.php +++ b/packages/graphql-printer/src/Blocks/ListBlockTest.php @@ -18,7 +18,7 @@ * @internal */ #[CoversClass(ListBlock::class)] -class ListBlockTest extends TestCase { +final class ListBlockTest extends TestCase { // // ========================================================================= /** diff --git a/packages/graphql-printer/src/Blocks/PropertyBlockTest.php b/packages/graphql-printer/src/Blocks/PropertyBlockTest.php index 07f853913..ada0af9d3 100644 --- a/packages/graphql-printer/src/Blocks/PropertyBlockTest.php +++ b/packages/graphql-printer/src/Blocks/PropertyBlockTest.php @@ -15,7 +15,7 @@ * @internal */ #[CoversClass(PropertyBlock::class)] -class PropertyBlockTest extends TestCase { +final class PropertyBlockTest extends TestCase { public function testSerialize(): void { $name = 'name'; $used = 123; diff --git a/packages/graphql-printer/src/Blocks/Types/DescriptionBlockTest.php b/packages/graphql-printer/src/Blocks/Types/DescriptionBlockTest.php index 94317133a..94094328b 100644 --- a/packages/graphql-printer/src/Blocks/Types/DescriptionBlockTest.php +++ b/packages/graphql-printer/src/Blocks/Types/DescriptionBlockTest.php @@ -16,7 +16,7 @@ * @internal */ #[CoversClass(DescriptionBlock::class)] -class DescriptionBlockTest extends TestCase { +final class DescriptionBlockTest extends TestCase { // // ========================================================================= /** diff --git a/packages/graphql-printer/src/Blocks/Values/StringValueTest.php b/packages/graphql-printer/src/Blocks/Values/StringValueTest.php index 49cc802c1..a03135256 100644 --- a/packages/graphql-printer/src/Blocks/Values/StringValueTest.php +++ b/packages/graphql-printer/src/Blocks/Values/StringValueTest.php @@ -17,7 +17,7 @@ * @internal */ #[CoversClass(StringValue::class)] -class StringValueTest extends TestCase { +final class StringValueTest extends TestCase { // // ========================================================================= /** diff --git a/packages/graphql-printer/src/IntrospectionPrinterTest.php b/packages/graphql-printer/src/IntrospectionPrinterTest.php index 466d15d61..ca66f9ea8 100644 --- a/packages/graphql-printer/src/IntrospectionPrinterTest.php +++ b/packages/graphql-printer/src/IntrospectionPrinterTest.php @@ -13,7 +13,7 @@ * @internal */ #[CoversClass(IntrospectionPrinter::class)] -class IntrospectionPrinterTest extends TestCase { +final class IntrospectionPrinterTest extends TestCase { // // ========================================================================= /** diff --git a/packages/graphql-printer/src/PrinterTest.php b/packages/graphql-printer/src/PrinterTest.php index 1ba4c9153..68ef7448f 100644 --- a/packages/graphql-printer/src/PrinterTest.php +++ b/packages/graphql-printer/src/PrinterTest.php @@ -34,7 +34,7 @@ * @internal */ #[CoversClass(Printer::class)] -class PrinterTest extends TestCase { +final class PrinterTest extends TestCase { // // ========================================================================= /** diff --git a/packages/graphql-printer/src/Settings/ImmutableSettingsTest.php b/packages/graphql-printer/src/Settings/ImmutableSettingsTest.php index e23bb9ad0..05e5e9f3c 100644 --- a/packages/graphql-printer/src/Settings/ImmutableSettingsTest.php +++ b/packages/graphql-printer/src/Settings/ImmutableSettingsTest.php @@ -13,7 +13,7 @@ * @internal */ #[CoversClass(ImmutableSettings::class)] -class ImmutableSettingsTest extends TestCase { +final class ImmutableSettingsTest extends TestCase { public function testCreateFrom(): void { $methods = (new ReflectionClass(Settings::class))->getMethods(ReflectionMethod::IS_PUBLIC); $settings = Mockery::mock(Settings::class); diff --git a/packages/graphql/src/Builder/BuilderInfoDetectorTest.php b/packages/graphql/src/Builder/BuilderInfoDetectorTest.php index 9001ee41d..ec89b3b7c 100644 --- a/packages/graphql/src/Builder/BuilderInfoDetectorTest.php +++ b/packages/graphql/src/Builder/BuilderInfoDetectorTest.php @@ -43,7 +43,7 @@ * @internal */ #[CoversClass(BuilderInfoDetector::class)] -class BuilderInfoDetectorTest extends TestCase { +final class BuilderInfoDetectorTest extends TestCase { // // ========================================================================= /** @@ -257,7 +257,7 @@ public function __construct() { #[Override] public static function definition(): string { - throw new Exception('should not be called.'); + throw new Exception('Should not be called.'); } })::class, ); @@ -363,7 +363,7 @@ public function __construct() { #[Override] public static function definition(): string { - throw new Exception('should not be called.'); + throw new Exception('Should not be called.'); } #[Override] @@ -394,7 +394,7 @@ public function getBuilderInfo(TypeSource $source): BuilderInfo { */ class BuilderInfoDetectorTest__QueryBuilderResolver { public function __invoke(): QueryBuilder { - throw new Exception('should not be called.'); + throw new Exception('Should not be called.'); } } @@ -404,7 +404,7 @@ public function __invoke(): QueryBuilder { */ class BuilderInfoDetectorTest__CustomBuilderResolver { public function __invoke(): BuilderInfoDetectorTest__CustomBuilder { - throw new Exception('should not be called.'); + throw new Exception('Should not be called.'); } } @@ -414,7 +414,7 @@ public function __invoke(): BuilderInfoDetectorTest__CustomBuilder { */ class BuilderInfoDetectorTest__PaginatorResolver { public function __invoke(): mixed { - throw new Exception('should not be called.'); + throw new Exception('Should not be called.'); } } diff --git a/packages/graphql/src/Builder/ContextTest.php b/packages/graphql/src/Builder/ContextTest.php index d5451b422..938507c59 100644 --- a/packages/graphql/src/Builder/ContextTest.php +++ b/packages/graphql/src/Builder/ContextTest.php @@ -10,7 +10,7 @@ * @internal */ #[CoversClass(Context::class)] -class ContextTest extends TestCase { +final class ContextTest extends TestCase { public function testContext(): void { $context = new Context(); $class = (new class('origin') { diff --git a/packages/graphql/src/Builder/ManipulatorTest.php b/packages/graphql/src/Builder/ManipulatorTest.php index 1d6874e66..8d3174429 100644 --- a/packages/graphql/src/Builder/ManipulatorTest.php +++ b/packages/graphql/src/Builder/ManipulatorTest.php @@ -34,7 +34,7 @@ * @internal */ #[CoversClass(Manipulator::class)] -class ManipulatorTest extends TestCase { +final class ManipulatorTest extends TestCase { // // ========================================================================= /** diff --git a/packages/graphql/src/Builder/OperatorsTest.php b/packages/graphql/src/Builder/OperatorsTest.php index 11b075238..7d8642562 100644 --- a/packages/graphql/src/Builder/OperatorsTest.php +++ b/packages/graphql/src/Builder/OperatorsTest.php @@ -19,7 +19,7 @@ * @internal */ #[CoversClass(Operators::class)] -class OperatorsTest extends TestCase { +final class OperatorsTest extends TestCase { // // ========================================================================= public function testHasOperators(): void { diff --git a/packages/graphql/src/Builder/Property.php b/packages/graphql/src/Builder/Property.php index 582a90023..ab3e7b132 100644 --- a/packages/graphql/src/Builder/Property.php +++ b/packages/graphql/src/Builder/Property.php @@ -2,17 +2,11 @@ namespace LastDragon_ru\LaraASP\GraphQL\Builder; -use Override; -use Stringable; - use function array_slice; use function array_values; use function end; -use function implode; - -class Property implements Stringable { - protected const Separator = '.'; +class Property { /** * @var list */ @@ -45,9 +39,4 @@ public function getParent(): static { return $parent; } - - #[Override] - public function __toString(): string { - return implode(static::Separator, $this->path); - } } diff --git a/packages/graphql/src/Printer/PrinterTest.php b/packages/graphql/src/Printer/PrinterTest.php index 363251517..9e3ac4e60 100644 --- a/packages/graphql/src/Printer/PrinterTest.php +++ b/packages/graphql/src/Printer/PrinterTest.php @@ -44,7 +44,7 @@ * @internal */ #[CoversClass(Printer::class)] -class PrinterTest extends TestCase { +final class PrinterTest extends TestCase { // // ========================================================================= /** diff --git a/packages/graphql/src/Scalars/JsonStringTypeTest.php b/packages/graphql/src/Scalars/JsonStringTypeTest.php index 627b17147..8f67cb720 100644 --- a/packages/graphql/src/Scalars/JsonStringTypeTest.php +++ b/packages/graphql/src/Scalars/JsonStringTypeTest.php @@ -17,7 +17,7 @@ * @internal */ #[CoversClass(JsonStringType::class)] -class JsonStringTypeTest extends TestCase { +final class JsonStringTypeTest extends TestCase { // // ========================================================================= /** diff --git a/packages/graphql/src/SearchBy/Directives/DirectiveTest.php b/packages/graphql/src/SearchBy/Directives/DirectiveTest.php index 4fdb40648..c483f6f7d 100644 --- a/packages/graphql/src/SearchBy/Directives/DirectiveTest.php +++ b/packages/graphql/src/SearchBy/Directives/DirectiveTest.php @@ -71,7 +71,7 @@ * @internal */ #[CoversClass(Directive::class)] -class DirectiveTest extends TestCase { +final class DirectiveTest extends TestCase { use WithTestObject; use MakesGraphQLRequests; @@ -376,7 +376,7 @@ static function (self $test): GraphQLExpected { return new GraphQLExpected($test::getTestData()->file($file)); }, '~full.graphql', - static function (TestCase $test): void { + static function (): void { $package = Package::Name; config([ @@ -393,7 +393,7 @@ static function (self $test): GraphQLExpected { )); }, '~example.graphql', - static function (TestCase $test): void { + static function (): void { $package = Package::Name; config([ @@ -457,7 +457,7 @@ public function call( Argument $argument, Context $context, ): object { - throw new Exception('should not be called'); + throw new Exception('Should not be called'); } #[Override] @@ -866,6 +866,6 @@ static function (object $builder, Property $property): string { */ class DirectiveTest__Resolver { public function __invoke(): mixed { - throw new Exception('should not be called.'); + throw new Exception('Should not be called.'); } } diff --git a/packages/graphql/src/SearchBy/Operators/Complex/Relation.php b/packages/graphql/src/SearchBy/Operators/Complex/Relation.php index 3656d0b53..6b17564bb 100644 --- a/packages/graphql/src/SearchBy/Operators/Complex/Relation.php +++ b/packages/graphql/src/SearchBy/Operators/Complex/Relation.php @@ -5,6 +5,7 @@ use Closure; use GraphQL\Language\DirectiveLocation; use Illuminate\Database\Eloquent\Builder as EloquentBuilder; +use Illuminate\Database\Eloquent\Model as EloquentModel; use LastDragon_ru\LaraASP\Eloquent\ModelHelper; use LastDragon_ru\LaraASP\GraphQL\Builder\Contracts\BuilderPropertyResolver; use LastDragon_ru\LaraASP\GraphQL\Builder\Contracts\Context; @@ -137,7 +138,7 @@ static function (EloquentBuilder $builder) use ($context, $relation, $handler, $ } /** - * @template TBuilder of EloquentBuilder<\Illuminate\Database\Eloquent\Model> + * @template TBuilder of EloquentBuilder * * @param TBuilder $builder * @param Closure(TBuilder): void $closure diff --git a/packages/graphql/src/SearchBy/OperatorsTest.php b/packages/graphql/src/SearchBy/OperatorsTest.php index 6192bdb6b..957958595 100644 --- a/packages/graphql/src/SearchBy/OperatorsTest.php +++ b/packages/graphql/src/SearchBy/OperatorsTest.php @@ -15,7 +15,7 @@ * @internal */ #[CoversClass(Operators::class)] -class OperatorsTest extends TestCase { +final class OperatorsTest extends TestCase { // // ========================================================================= public function testConstructor(): void { diff --git a/packages/graphql/src/SortBy/Directives/DirectiveTest.php b/packages/graphql/src/SortBy/Directives/DirectiveTest.php index b81772bef..45f66e426 100644 --- a/packages/graphql/src/SortBy/Directives/DirectiveTest.php +++ b/packages/graphql/src/SortBy/Directives/DirectiveTest.php @@ -56,7 +56,7 @@ * @internal */ #[CoversClass(Directive::class)] -class DirectiveTest extends TestCase { +final class DirectiveTest extends TestCase { use WithTestObject; use MakesGraphQLRequests; @@ -525,7 +525,7 @@ public static function dataProviderHandleBuilder(): array { 'random' => 'yes', ], ], - static function (TestCase $test): void { + static function (): void { $package = Package::Name; config([ @@ -803,6 +803,6 @@ static function (object $builder, Property $property): string { */ class DirectiveTest__QueryBuilderResolver { public function __invoke(): QueryBuilder { - throw new Exception('should not be called.'); + throw new Exception('Should not be called.'); } } diff --git a/packages/graphql/src/SortBy/Operators/FieldTest.php b/packages/graphql/src/SortBy/Operators/FieldTest.php index 251ea6272..388e3d2fa 100644 --- a/packages/graphql/src/SortBy/Operators/FieldTest.php +++ b/packages/graphql/src/SortBy/Operators/FieldTest.php @@ -290,7 +290,7 @@ public function sort( Direction $direction, Nulls $nulls = null, ): object { - throw new Exception('should not be called.'); + throw new Exception('Should not be called.'); } }; }; diff --git a/packages/graphql/src/SortBy/OperatorsTest.php b/packages/graphql/src/SortBy/OperatorsTest.php index 2a9913fcc..eca4a7d20 100644 --- a/packages/graphql/src/SortBy/OperatorsTest.php +++ b/packages/graphql/src/SortBy/OperatorsTest.php @@ -14,7 +14,7 @@ * @internal */ #[CoversClass(Operators::class)] -class OperatorsTest extends TestCase { +final class OperatorsTest extends TestCase { // // ========================================================================= public function testConstructor(): void { diff --git a/packages/graphql/src/SortBy/Sorters/DatabaseSorterTest.php b/packages/graphql/src/SortBy/Sorters/DatabaseSorterTest.php index c0f685ea1..c001de7f8 100644 --- a/packages/graphql/src/SortBy/Sorters/DatabaseSorterTest.php +++ b/packages/graphql/src/SortBy/Sorters/DatabaseSorterTest.php @@ -27,7 +27,7 @@ * @internal */ #[CoversClass(DatabaseSorter::class)] -class DatabaseSorterTest extends TestCase { +final class DatabaseSorterTest extends TestCase { // // ========================================================================= /** @@ -65,7 +65,7 @@ public function sort( Direction $direction, Nulls $nulls = null, ): object { - throw new Exception('should not be called.'); + throw new Exception('Should not be called.'); } #[Override] @@ -103,7 +103,7 @@ public function sort( Direction $direction, Nulls $nulls = null, ): object { - throw new Exception('should not be called.'); + throw new Exception('Should not be called.'); } #[Override] diff --git a/packages/graphql/src/SortBy/Sorters/EloquentSorterTest.php b/packages/graphql/src/SortBy/Sorters/EloquentSorterTest.php index 2fcc616b7..44099ed9d 100644 --- a/packages/graphql/src/SortBy/Sorters/EloquentSorterTest.php +++ b/packages/graphql/src/SortBy/Sorters/EloquentSorterTest.php @@ -42,7 +42,7 @@ * @internal */ #[CoversClass(EloquentSorter::class)] -class EloquentSorterTest extends TestCase { +final class EloquentSorterTest extends TestCase { // // ========================================================================= /** diff --git a/packages/graphql/src/SortBy/Sorters/QuerySorterTest.php b/packages/graphql/src/SortBy/Sorters/QuerySorterTest.php index 18c633d07..d9e25dca6 100644 --- a/packages/graphql/src/SortBy/Sorters/QuerySorterTest.php +++ b/packages/graphql/src/SortBy/Sorters/QuerySorterTest.php @@ -23,7 +23,7 @@ * @internal */ #[CoversClass(QuerySorter::class)] -class QuerySorterTest extends TestCase { +final class QuerySorterTest extends TestCase { // // ========================================================================= /** diff --git a/packages/graphql/src/SortBy/Sorters/ScoutSorterTest.php b/packages/graphql/src/SortBy/Sorters/ScoutSorterTest.php index b60b2ff09..e47c043c6 100644 --- a/packages/graphql/src/SortBy/Sorters/ScoutSorterTest.php +++ b/packages/graphql/src/SortBy/Sorters/ScoutSorterTest.php @@ -23,7 +23,7 @@ * @internal */ #[CoversClass(ScoutSorter::class)] -class ScoutSorterTest extends TestCase { +final class ScoutSorterTest extends TestCase { // // ========================================================================= /** diff --git a/packages/graphql/src/Stream/Directives/DirectiveTest.php b/packages/graphql/src/Stream/Directives/DirectiveTest.php index 144edd582..367f4f272 100644 --- a/packages/graphql/src/Stream/Directives/DirectiveTest.php +++ b/packages/graphql/src/Stream/Directives/DirectiveTest.php @@ -80,7 +80,7 @@ * @internal */ #[CoversClass(Directive::class)] -class DirectiveTest extends TestCase { +final class DirectiveTest extends TestCase { use WithTestObject; use MakesGraphQLRequests; diff --git a/packages/graphql/src/Stream/Directives/OffsetTest.php b/packages/graphql/src/Stream/Directives/OffsetTest.php index 20a6a21c2..97a9462fd 100644 --- a/packages/graphql/src/Stream/Directives/OffsetTest.php +++ b/packages/graphql/src/Stream/Directives/OffsetTest.php @@ -14,7 +14,7 @@ * @internal */ #[CoversClass(Offset::class)] -class OffsetTest extends TestCase { +final class OffsetTest extends TestCase { // // ========================================================================= /** diff --git a/packages/graphql/src/Stream/Streams/DatabaseTest.php b/packages/graphql/src/Stream/Streams/DatabaseTest.php index ccab69998..926e2fcde 100644 --- a/packages/graphql/src/Stream/Streams/DatabaseTest.php +++ b/packages/graphql/src/Stream/Streams/DatabaseTest.php @@ -20,7 +20,7 @@ * @internal */ #[CoversClass(Database::class)] -class DatabaseTest extends TestCase { +final class DatabaseTest extends TestCase { use WithFaker; use WithQueryLog; use WithTestObject; diff --git a/packages/graphql/src/Stream/Streams/ScoutTest.php b/packages/graphql/src/Stream/Streams/ScoutTest.php index 8ff08b662..51a07724d 100644 --- a/packages/graphql/src/Stream/Streams/ScoutTest.php +++ b/packages/graphql/src/Stream/Streams/ScoutTest.php @@ -23,7 +23,7 @@ * @internal */ #[CoversClass(Scout::class)] -class ScoutTest extends TestCase { +final class ScoutTest extends TestCase { use WithFaker; use WithQueryLog; use WithTestObject; diff --git a/packages/graphql/src/Stream/Types/OffsetTest.php b/packages/graphql/src/Stream/Types/OffsetTest.php index 6f78d695c..162d0cb24 100644 --- a/packages/graphql/src/Stream/Types/OffsetTest.php +++ b/packages/graphql/src/Stream/Types/OffsetTest.php @@ -21,7 +21,7 @@ * @internal */ #[CoversClass(Offset::class)] -class OffsetTest extends TestCase { +final class OffsetTest extends TestCase { // // ========================================================================= /** diff --git a/packages/graphql/src/Stream/Utils/PageTest.php b/packages/graphql/src/Stream/Utils/PageTest.php index 1e3d43451..4553610cc 100644 --- a/packages/graphql/src/Stream/Utils/PageTest.php +++ b/packages/graphql/src/Stream/Utils/PageTest.php @@ -9,7 +9,7 @@ * @internal */ #[CoversClass(Page::class)] -class PageTest extends TestCase { +final class PageTest extends TestCase { // // ========================================================================= /** diff --git a/packages/graphql/src/Testing/Package/TestCase.php b/packages/graphql/src/Testing/Package/TestCase.php index 665d644bc..0de43d47d 100644 --- a/packages/graphql/src/Testing/Package/TestCase.php +++ b/packages/graphql/src/Testing/Package/TestCase.php @@ -35,7 +35,7 @@ /** * @internal */ -class TestCase extends PackageTestCase { +abstract class TestCase extends PackageTestCase { use GraphQLAssertions { getGraphQLPrinter as private getDefaultGraphQLPrinter; } diff --git a/packages/graphql/src/Testing/SchemaBuilderWrapperTest.php b/packages/graphql/src/Testing/SchemaBuilderWrapperTest.php index 0dce7555f..44dc81558 100644 --- a/packages/graphql/src/Testing/SchemaBuilderWrapperTest.php +++ b/packages/graphql/src/Testing/SchemaBuilderWrapperTest.php @@ -12,7 +12,7 @@ * @internal */ #[CoversClass(SchemaBuilderWrapper::class)] -class SchemaBuilderWrapperTest extends TestCase { +final class SchemaBuilderWrapperTest extends TestCase { public function testWrappedSuccessfully(): void { $missed = []; $origin = new ReflectionClass(SchemaBuilder::class); diff --git a/packages/graphql/src/Utils/AstManipulatorTest.php b/packages/graphql/src/Utils/AstManipulatorTest.php index e5f7410d6..89c051f7d 100644 --- a/packages/graphql/src/Utils/AstManipulatorTest.php +++ b/packages/graphql/src/Utils/AstManipulatorTest.php @@ -50,7 +50,7 @@ * @internal */ #[CoversClass(AstManipulator::class)] -class AstManipulatorTest extends TestCase { +final class AstManipulatorTest extends TestCase { // // ========================================================================= public function testGetInterfaces(): void { diff --git a/packages/graphql/src/Utils/Directives/AsEnumTest.php b/packages/graphql/src/Utils/Directives/AsEnumTest.php index 0cbc80730..ad56c63e3 100644 --- a/packages/graphql/src/Utils/Directives/AsEnumTest.php +++ b/packages/graphql/src/Utils/Directives/AsEnumTest.php @@ -19,7 +19,7 @@ * @internal */ #[CoversClass(AsEnum::class)] -class AsEnumTest extends TestCase { +final class AsEnumTest extends TestCase { public function testResolveNode(): void { $class = AsEnumTest_Enum::class; $enum = json_encode($class, JSON_THROW_ON_ERROR); diff --git a/packages/graphql/src/Utils/PhpEnumTypeHelperTest.php b/packages/graphql/src/Utils/PhpEnumTypeHelperTest.php index 4dea9b732..7f6ea57b2 100644 --- a/packages/graphql/src/Utils/PhpEnumTypeHelperTest.php +++ b/packages/graphql/src/Utils/PhpEnumTypeHelperTest.php @@ -10,7 +10,7 @@ * @internal */ #[CoversClass(PhpEnumTypeHelper::class)] -class PhpEnumTypeHelperTest extends TestCase { +final class PhpEnumTypeHelperTest extends TestCase { public function testGetEnumClass(): void { $type = new PhpEnumType(PhpEnumTypeHelperTest_Enum::class); $actual = PhpEnumTypeHelper::getEnumClass($type); diff --git a/packages/migrator/src/Commands/RawMigrationTest.php b/packages/migrator/src/Commands/RawMigrationTest.php index 8cfc64c82..d023b2b64 100644 --- a/packages/migrator/src/Commands/RawMigrationTest.php +++ b/packages/migrator/src/Commands/RawMigrationTest.php @@ -21,7 +21,7 @@ * @internal */ #[CoversClass(RawMigration::class)] -class RawMigrationTest extends TestCase { +final class RawMigrationTest extends TestCase { public function testHandle(): void { // make:migration may also call dump-autoload we are no need this. $composer = Mockery::mock(Composer::class); diff --git a/packages/migrator/src/Commands/RawSeederTest.php b/packages/migrator/src/Commands/RawSeederTest.php index 49372cd66..3c4b5f3fb 100644 --- a/packages/migrator/src/Commands/RawSeederTest.php +++ b/packages/migrator/src/Commands/RawSeederTest.php @@ -13,7 +13,7 @@ * @internal */ #[CoversClass(RawSeeder::class)] -class RawSeederTest extends TestCase { +final class RawSeederTest extends TestCase { public function testHandle(): void { // Pre test $pkg = Package::Name; diff --git a/packages/migrator/src/Extenders/SmartMigratorTest.php b/packages/migrator/src/Extenders/SmartMigratorTest.php index 16ee30d7a..92f1f4802 100644 --- a/packages/migrator/src/Extenders/SmartMigratorTest.php +++ b/packages/migrator/src/Extenders/SmartMigratorTest.php @@ -27,7 +27,7 @@ */ #[CoversClass(SmartMigrator::class)] #[CoversClass(Provider::class)] -class SmartMigratorTest extends TestCase { +final class SmartMigratorTest extends TestCase { public function testProvider(): void { self::assertEquals(SmartMigrator::class, get_class(Container::getInstance()->make('migrator'))); } diff --git a/packages/migrator/src/Migrations/RawDataMigration.php b/packages/migrator/src/Migrations/RawDataMigration.php index d01767d99..27efe4275 100644 --- a/packages/migrator/src/Migrations/RawDataMigration.php +++ b/packages/migrator/src/Migrations/RawDataMigration.php @@ -10,8 +10,8 @@ * Migration that contains data only. * * This migration is useful to insert data into the existing working application - * and unlike {@link \LastDragon_ru\LaraASP\Migrator\Migrations\RawMigration} it - * will be applied only if the database already seeded. + * and unlike {@link RawMigration} it will be applied only if the database + * already seeded. */ abstract class RawDataMigration extends RawMigration { // diff --git a/packages/migrator/src/Testing/Package/TestCase.php b/packages/migrator/src/Testing/Package/TestCase.php index 4816d112a..39ebc46ac 100644 --- a/packages/migrator/src/Testing/Package/TestCase.php +++ b/packages/migrator/src/Testing/Package/TestCase.php @@ -9,7 +9,7 @@ /** * @internal */ -class TestCase extends PackageTestCase { +abstract class TestCase extends PackageTestCase { /** * @inheritDoc */ diff --git a/packages/serializer/composer.json b/packages/serializer/composer.json index a33c61e70..4c6221f92 100644 --- a/packages/serializer/composer.json +++ b/packages/serializer/composer.json @@ -21,7 +21,7 @@ "laravel/framework": "^10.0.0", "lastdragon-ru/lara-asp-core": "self.version", "phpdocumentor/type-resolver": "^1.7", - "phpstan/phpdoc-parser": "^1.23", + "phpstan/phpdoc-parser": "^1.25", "symfony/property-access": "^6.3.0", "symfony/property-info": "^6.3.9", "symfony/serializer": "^6.3.3", diff --git a/packages/serializer/src/Casts/AsSerializableTest.php b/packages/serializer/src/Casts/AsSerializableTest.php index 5dd12f29b..9086e25b5 100644 --- a/packages/serializer/src/Casts/AsSerializableTest.php +++ b/packages/serializer/src/Casts/AsSerializableTest.php @@ -14,7 +14,7 @@ * @internal */ #[CoversClass(AsSerializable::class)] -class AsSerializableTest extends TestCase { +final class AsSerializableTest extends TestCase { // // ========================================================================= /** diff --git a/packages/serializer/src/FactoryTest.php b/packages/serializer/src/FactoryTest.php index ac72027d3..9f0c42558 100644 --- a/packages/serializer/src/FactoryTest.php +++ b/packages/serializer/src/FactoryTest.php @@ -24,7 +24,7 @@ * @internal */ #[CoversClass(Factory::class)] -class FactoryTest extends TestCase { +final class FactoryTest extends TestCase { public function testCreate(): void { config([ Package::Name => [ diff --git a/packages/serializer/src/Metadata/MetadataFactoryTest.php b/packages/serializer/src/Metadata/MetadataFactoryTest.php index d041e1ba3..e968c204c 100644 --- a/packages/serializer/src/Metadata/MetadataFactoryTest.php +++ b/packages/serializer/src/Metadata/MetadataFactoryTest.php @@ -15,7 +15,7 @@ * @internal */ #[CoversClass(MetadataFactory::class)] -class MetadataFactoryTest extends TestCase { +final class MetadataFactoryTest extends TestCase { public function testHasMetadataFor(): void { $factory = new MetadataFactory(); diff --git a/packages/serializer/src/Normalizers/UnitEnumNormalizerTest.php b/packages/serializer/src/Normalizers/UnitEnumNormalizerTest.php index 69ca44775..5559a1ada 100644 --- a/packages/serializer/src/Normalizers/UnitEnumNormalizerTest.php +++ b/packages/serializer/src/Normalizers/UnitEnumNormalizerTest.php @@ -14,7 +14,7 @@ * @internal */ #[CoversClass(UnitEnumNormalizer::class)] -class UnitEnumNormalizerTest extends TestCase { +final class UnitEnumNormalizerTest extends TestCase { public function testNormalize(): void { $normalizer = new UnitEnumNormalizer(); $enumAA = UnitEnumNormalizerTest__EnumA::A; diff --git a/packages/serializer/src/ProviderTest.php b/packages/serializer/src/ProviderTest.php index 10c5daabc..d6ab7b293 100644 --- a/packages/serializer/src/ProviderTest.php +++ b/packages/serializer/src/ProviderTest.php @@ -32,7 +32,7 @@ #[CoversClass(Provider::class)] #[CoversClass(Serializer::class)] #[CoversClass(SerializableNormalizer::class)] -class ProviderTest extends TestCase { +final class ProviderTest extends TestCase { // // ========================================================================= public function testRegister(): void { diff --git a/packages/serializer/src/Testing/Package/TestCase.php b/packages/serializer/src/Testing/Package/TestCase.php index 278524a7d..fcdf4ed31 100644 --- a/packages/serializer/src/Testing/Package/TestCase.php +++ b/packages/serializer/src/Testing/Package/TestCase.php @@ -9,7 +9,7 @@ /** * @internal */ -class TestCase extends PackageTestCase { +abstract class TestCase extends PackageTestCase { /** * @inheritDoc */ diff --git a/packages/spa/src/Angular/UrlTest.php b/packages/spa/src/Angular/UrlTest.php index fea3557b6..0085c3fa2 100644 --- a/packages/spa/src/Angular/UrlTest.php +++ b/packages/spa/src/Angular/UrlTest.php @@ -4,14 +4,14 @@ use Exception; use InvalidArgumentException; +use LastDragon_ru\LaraASP\Spa\Testing\Package\TestCase; use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\TestCase; /** * @internal */ #[CoversClass(Url::class)] -class UrlTest extends TestCase { +final class UrlTest extends TestCase { // // ========================================================================= /** diff --git a/packages/spa/src/Http/Controllers/SpaControllerTest.php b/packages/spa/src/Http/Controllers/SpaControllerTest.php index bf2158e94..9e63b9cd5 100644 --- a/packages/spa/src/Http/Controllers/SpaControllerTest.php +++ b/packages/spa/src/Http/Controllers/SpaControllerTest.php @@ -26,7 +26,7 @@ * @internal */ #[CoversClass(SpaController::class)] -class SpaControllerTest extends TestCase { +final class SpaControllerTest extends TestCase { // // ========================================================================= /** diff --git a/packages/spa/src/Http/RequestTest.php b/packages/spa/src/Http/RequestTest.php index aace4f156..86b49f63e 100644 --- a/packages/spa/src/Http/RequestTest.php +++ b/packages/spa/src/Http/RequestTest.php @@ -17,7 +17,7 @@ * @internal */ #[CoversClass(Request::class)] -class RequestTest extends TestCase { +final class RequestTest extends TestCase { public function testValidated(): void { $router = Container::getInstance()->make(Router::class); $translator = Container::getInstance()->make(Translator::class); diff --git a/packages/spa/src/Http/Resources/PaginatedCollectionTest.php b/packages/spa/src/Http/Resources/PaginatedCollectionTest.php index 82535ae1f..1fbbc6c6c 100644 --- a/packages/spa/src/Http/Resources/PaginatedCollectionTest.php +++ b/packages/spa/src/Http/Resources/PaginatedCollectionTest.php @@ -16,7 +16,7 @@ */ #[CoversClass(PaginatedCollection::class)] #[CoversClass(PaginatedResponse::class)] -class PaginatedCollectionTest extends TestCase { +final class PaginatedCollectionTest extends TestCase { public function testToResponseLengthAwarePaginator(): void { $total = 123; $perPage = 25; diff --git a/packages/spa/src/Http/Resources/ResourceCollectionTest.php b/packages/spa/src/Http/Resources/ResourceCollectionTest.php index 2b76021e5..d308dbe6a 100644 --- a/packages/spa/src/Http/Resources/ResourceCollectionTest.php +++ b/packages/spa/src/Http/Resources/ResourceCollectionTest.php @@ -18,7 +18,7 @@ * @internal */ #[CoversClass(ResourceCollection::class)] -class ResourceCollectionTest extends TestCase { +final class ResourceCollectionTest extends TestCase { // // ========================================================================= /** diff --git a/packages/spa/src/Http/Resources/ResourceTest.php b/packages/spa/src/Http/Resources/ResourceTest.php index da424899a..5dd6484a7 100644 --- a/packages/spa/src/Http/Resources/ResourceTest.php +++ b/packages/spa/src/Http/Resources/ResourceTest.php @@ -26,7 +26,7 @@ * @internal */ #[CoversClass(Resource::class)] -class ResourceTest extends TestCase { +final class ResourceTest extends TestCase { // // ========================================================================= /** diff --git a/packages/spa/src/Http/Resources/Scalar/BoolResourceTest.php b/packages/spa/src/Http/Resources/Scalar/BoolResourceTest.php index 30bff3fcf..3bfc7a420 100644 --- a/packages/spa/src/Http/Resources/Scalar/BoolResourceTest.php +++ b/packages/spa/src/Http/Resources/Scalar/BoolResourceTest.php @@ -11,7 +11,7 @@ * @internal */ #[CoversClass(BoolResource::class)] -class BoolResourceTest extends TestCase { +final class BoolResourceTest extends TestCase { public function testToResponse(): void { Route::get(__METHOD__, static function (): mixed { return new BoolResource(true); diff --git a/packages/spa/src/Http/Resources/Scalar/FalseResourceTest.php b/packages/spa/src/Http/Resources/Scalar/FalseResourceTest.php index 8bd805e93..42726ff83 100644 --- a/packages/spa/src/Http/Resources/Scalar/FalseResourceTest.php +++ b/packages/spa/src/Http/Resources/Scalar/FalseResourceTest.php @@ -11,7 +11,7 @@ * @internal */ #[CoversClass(FalseResource::class)] -class FalseResourceTest extends TestCase { +final class FalseResourceTest extends TestCase { public function testToResponse(): void { Route::get(__METHOD__, static function (): mixed { return new FalseResource(); diff --git a/packages/spa/src/Http/Resources/Scalar/IntResourceTest.php b/packages/spa/src/Http/Resources/Scalar/IntResourceTest.php index 5206974e3..95873dca8 100644 --- a/packages/spa/src/Http/Resources/Scalar/IntResourceTest.php +++ b/packages/spa/src/Http/Resources/Scalar/IntResourceTest.php @@ -11,7 +11,7 @@ * @internal */ #[CoversClass(IntResource::class)] -class IntResourceTest extends TestCase { +final class IntResourceTest extends TestCase { public function testToResponse(): void { Route::get(__METHOD__, static function (): mixed { return new IntResource(123); diff --git a/packages/spa/src/Http/Resources/Scalar/NullResourceTest.php b/packages/spa/src/Http/Resources/Scalar/NullResourceTest.php index 101834d4c..3202214b5 100644 --- a/packages/spa/src/Http/Resources/Scalar/NullResourceTest.php +++ b/packages/spa/src/Http/Resources/Scalar/NullResourceTest.php @@ -11,7 +11,7 @@ * @internal */ #[CoversClass(NullResource::class)] -class NullResourceTest extends TestCase { +final class NullResourceTest extends TestCase { public function testToResponse(): void { Route::get(__METHOD__, static function (): mixed { return new NullResource(); diff --git a/packages/spa/src/Http/Resources/Scalar/NumberResourceTest.php b/packages/spa/src/Http/Resources/Scalar/NumberResourceTest.php index 8c9dddca5..a1b3edaa8 100644 --- a/packages/spa/src/Http/Resources/Scalar/NumberResourceTest.php +++ b/packages/spa/src/Http/Resources/Scalar/NumberResourceTest.php @@ -11,7 +11,7 @@ * @internal */ #[CoversClass(NumberResource::class)] -class NumberResourceTest extends TestCase { +final class NumberResourceTest extends TestCase { public function testToResponse(): void { Route::get(__METHOD__, static function (): mixed { return new NumberResource(123); diff --git a/packages/spa/src/Http/Resources/Scalar/StringResourceTest.php b/packages/spa/src/Http/Resources/Scalar/StringResourceTest.php index 060673487..81d1de2fb 100644 --- a/packages/spa/src/Http/Resources/Scalar/StringResourceTest.php +++ b/packages/spa/src/Http/Resources/Scalar/StringResourceTest.php @@ -11,7 +11,7 @@ * @internal */ #[CoversClass(StringResource::class)] -class StringResourceTest extends TestCase { +final class StringResourceTest extends TestCase { public function testToResponse(): void { Route::get(__METHOD__, static function (): mixed { return new StringResource('123'); diff --git a/packages/spa/src/Http/Resources/Scalar/TrueResourceTest.php b/packages/spa/src/Http/Resources/Scalar/TrueResourceTest.php index 10441b436..1d00ce1f9 100644 --- a/packages/spa/src/Http/Resources/Scalar/TrueResourceTest.php +++ b/packages/spa/src/Http/Resources/Scalar/TrueResourceTest.php @@ -11,7 +11,7 @@ * @internal */ #[CoversClass(TrueResource::class)] -class TrueResourceTest extends TestCase { +final class TrueResourceTest extends TestCase { public function testToResponse(): void { Route::get(__METHOD__, static function (): mixed { return new TrueResource(); diff --git a/packages/spa/src/Routing/ResolverTest.php b/packages/spa/src/Routing/ResolverTest.php index cfa01dab1..4c6ee6de1 100644 --- a/packages/spa/src/Routing/ResolverTest.php +++ b/packages/spa/src/Routing/ResolverTest.php @@ -15,7 +15,7 @@ * @internal */ #[CoversClass(Resolver::class)] -class ResolverTest extends TestCase { +final class ResolverTest extends TestCase { public function testGet(): void { $router = Container::getInstance()->make(Router::class); $resolver = new class($router) extends Resolver { diff --git a/packages/spa/src/Routing/UnresolvedValueExceptionTest.php b/packages/spa/src/Routing/UnresolvedValueExceptionTest.php index a2d60271e..58653af1e 100644 --- a/packages/spa/src/Routing/UnresolvedValueExceptionTest.php +++ b/packages/spa/src/Routing/UnresolvedValueExceptionTest.php @@ -11,7 +11,7 @@ * @internal */ #[CoversClass(UnresolvedValueException::class)] -class UnresolvedValueExceptionTest extends TestCase { +final class UnresolvedValueExceptionTest extends TestCase { public function testHttpResponse(): void { Route::get(__FUNCTION__, static function (): void { throw new UnresolvedValueException(123); diff --git a/packages/spa/src/Testing/Http/Resources/PaginatedCollectionTest.php b/packages/spa/src/Testing/Http/Resources/PaginatedCollectionTest.php index 93850a9ec..6b950b040 100644 --- a/packages/spa/src/Testing/Http/Resources/PaginatedCollectionTest.php +++ b/packages/spa/src/Testing/Http/Resources/PaginatedCollectionTest.php @@ -2,16 +2,16 @@ namespace LastDragon_ru\LaraASP\Spa\Testing\Http\Resources; +use LastDragon_ru\LaraASP\Spa\Testing\Package\TestCase; use LastDragon_ru\LaraASP\Testing\Constraints\Json\JsonMatchesSchema; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\ExpectationFailedException; -use PHPUnit\Framework\TestCase; /** * @internal */ #[CoversClass(PaginatedCollection::class)] -class PaginatedCollectionTest extends TestCase { +final class PaginatedCollectionTest extends TestCase { // // ========================================================================= /** @@ -22,7 +22,7 @@ class PaginatedCollectionTest extends TestCase { * @param array $json */ public function testSchema(bool $expected, array $json): void { - $schema = new PaginatedCollection(static::class); + $schema = new PaginatedCollection(self::class); $constraint = new JsonMatchesSchema($schema); $message = ''; $actual = null; @@ -32,6 +32,7 @@ public function testSchema(bool $expected, array $json): void { $actual = true; } catch (ExpectationFailedException $exception) { $message = $exception->getMessage(); + $actual = false; } self::assertEquals($expected, $actual, $message); diff --git a/packages/spa/src/Testing/Http/Resources/ResourceCollectionTest.php b/packages/spa/src/Testing/Http/Resources/ResourceCollectionTest.php index 35987363a..7e8027bfe 100644 --- a/packages/spa/src/Testing/Http/Resources/ResourceCollectionTest.php +++ b/packages/spa/src/Testing/Http/Resources/ResourceCollectionTest.php @@ -2,16 +2,16 @@ namespace LastDragon_ru\LaraASP\Spa\Testing\Http\Resources; +use LastDragon_ru\LaraASP\Spa\Testing\Package\TestCase; use LastDragon_ru\LaraASP\Testing\Constraints\Json\JsonMatchesSchema; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\ExpectationFailedException; -use PHPUnit\Framework\TestCase; /** * @internal */ #[CoversClass(ResourceCollection::class)] -class ResourceCollectionTest extends TestCase { +final class ResourceCollectionTest extends TestCase { // // ========================================================================= /** @@ -22,7 +22,7 @@ class ResourceCollectionTest extends TestCase { * @param array $json */ public function testSchema(bool $expected, array $json): void { - $schema = new ResourceCollection(static::class); + $schema = new ResourceCollection(self::class); $constraint = new JsonMatchesSchema($schema); $message = ''; $actual = null; @@ -32,6 +32,7 @@ public function testSchema(bool $expected, array $json): void { $actual = true; } catch (ExpectationFailedException $exception) { $message = $exception->getMessage(); + $actual = false; } self::assertEquals($expected, $actual, $message); diff --git a/packages/spa/src/Validation/Rules/BoolRuleTest.php b/packages/spa/src/Validation/Rules/BoolRuleTest.php index 09304cdc8..756e3b417 100644 --- a/packages/spa/src/Validation/Rules/BoolRuleTest.php +++ b/packages/spa/src/Validation/Rules/BoolRuleTest.php @@ -11,7 +11,7 @@ * @internal */ #[CoversClass(BoolRule::class)] -class BoolRuleTest extends TestCase { +final class BoolRuleTest extends TestCase { // // ========================================================================= /** diff --git a/packages/spa/src/Validation/Rules/DateRuleTest.php b/packages/spa/src/Validation/Rules/DateRuleTest.php index eacf86b6c..25d12ebb0 100644 --- a/packages/spa/src/Validation/Rules/DateRuleTest.php +++ b/packages/spa/src/Validation/Rules/DateRuleTest.php @@ -13,7 +13,7 @@ * @internal */ #[CoversClass(DateRule::class)] -class DateRuleTest extends TestCase { +final class DateRuleTest extends TestCase { // // ========================================================================= /** diff --git a/packages/spa/src/Validation/Rules/DateTimeRuleTest.php b/packages/spa/src/Validation/Rules/DateTimeRuleTest.php index 1ccb786c6..54003204a 100644 --- a/packages/spa/src/Validation/Rules/DateTimeRuleTest.php +++ b/packages/spa/src/Validation/Rules/DateTimeRuleTest.php @@ -16,7 +16,7 @@ * @internal */ #[CoversClass(DateTimeRule::class)] -class DateTimeRuleTest extends TestCase { +final class DateTimeRuleTest extends TestCase { // // ========================================================================= /** diff --git a/packages/spa/src/Validation/Rules/IntRuleTest.php b/packages/spa/src/Validation/Rules/IntRuleTest.php index 5c47ee3a1..ef64ca09f 100644 --- a/packages/spa/src/Validation/Rules/IntRuleTest.php +++ b/packages/spa/src/Validation/Rules/IntRuleTest.php @@ -14,7 +14,7 @@ * @internal */ #[CoversClass(IntRule::class)] -class IntRuleTest extends TestCase { +final class IntRuleTest extends TestCase { // // ========================================================================= /** diff --git a/packages/spa/src/Validation/Rules/NumberRuleTest.php b/packages/spa/src/Validation/Rules/NumberRuleTest.php index 06ca37f40..8be7e5472 100644 --- a/packages/spa/src/Validation/Rules/NumberRuleTest.php +++ b/packages/spa/src/Validation/Rules/NumberRuleTest.php @@ -14,7 +14,7 @@ * @internal */ #[CoversClass(NumberRule::class)] -class NumberRuleTest extends TestCase { +final class NumberRuleTest extends TestCase { // // ========================================================================= /** diff --git a/packages/spa/src/Validation/Rules/ResolverRuleTest.php b/packages/spa/src/Validation/Rules/ResolverRuleTest.php index 1df6cf413..474be7d23 100644 --- a/packages/spa/src/Validation/Rules/ResolverRuleTest.php +++ b/packages/spa/src/Validation/Rules/ResolverRuleTest.php @@ -15,7 +15,7 @@ * @internal */ #[CoversClass(ResolverRule::class)] -class ResolverRuleTest extends TestCase { +final class ResolverRuleTest extends TestCase { // // ========================================================================= public function testPasses(): void { diff --git a/packages/spa/src/Validation/Rules/StringRuleTest.php b/packages/spa/src/Validation/Rules/StringRuleTest.php index a52a36e90..429831214 100644 --- a/packages/spa/src/Validation/Rules/StringRuleTest.php +++ b/packages/spa/src/Validation/Rules/StringRuleTest.php @@ -11,7 +11,7 @@ * @internal */ #[CoversClass(StringRule::class)] -class StringRuleTest extends TestCase { +final class StringRuleTest extends TestCase { // // ========================================================================= /** diff --git a/packages/testing/src/Assertions/Application/ScheduleAssertionsTest.php b/packages/testing/src/Assertions/Application/ScheduleAssertionsTest.php index e8c3c24df..33348a134 100644 --- a/packages/testing/src/Assertions/Application/ScheduleAssertionsTest.php +++ b/packages/testing/src/Assertions/Application/ScheduleAssertionsTest.php @@ -12,7 +12,7 @@ * @internal */ #[CoversClass(ScheduleAssertions::class)] -class ScheduleAssertionsTest extends TestCase { +final class ScheduleAssertionsTest extends TestCase { public function testGetScheduleEvents(): void { $schedule = Container::getInstance()->make(Schedule::class); $assertions = new class() { diff --git a/packages/testing/src/Assertions/XmlAssertionsTest.php b/packages/testing/src/Assertions/XmlAssertionsTest.php index df3e8e496..2782dc022 100644 --- a/packages/testing/src/Assertions/XmlAssertionsTest.php +++ b/packages/testing/src/Assertions/XmlAssertionsTest.php @@ -3,16 +3,16 @@ namespace LastDragon_ru\LaraASP\Testing\Assertions; use LastDragon_ru\LaraASP\Testing\Constraints\Xml\XmlMatchesSchemaTest; +use LastDragon_ru\LaraASP\Testing\Package\TestCase; use LastDragon_ru\LaraASP\Testing\Utils\TestData; use PHPUnit\Framework\Assert; use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\TestCase; /** * @internal */ #[CoversClass(XmlAssertions::class)] -class XmlAssertionsTest extends TestCase { +final class XmlAssertionsTest extends TestCase { public function testAssertXmlMatchesSchema(): void { $data = new TestData(XmlMatchesSchemaTest::class); $assertion = new class() extends Assert { diff --git a/packages/testing/src/Comparators/DatabaseQueryComparatorTest.php b/packages/testing/src/Comparators/DatabaseQueryComparatorTest.php index 8f06b315f..2af6a60ae 100644 --- a/packages/testing/src/Comparators/DatabaseQueryComparatorTest.php +++ b/packages/testing/src/Comparators/DatabaseQueryComparatorTest.php @@ -3,9 +3,9 @@ namespace LastDragon_ru\LaraASP\Testing\Comparators; use LastDragon_ru\LaraASP\Testing\Database\QueryLog\Query; +use LastDragon_ru\LaraASP\Testing\Package\TestCase; use Override; use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\TestCase; use SebastianBergmann\Comparator\ComparisonFailure; use SebastianBergmann\Comparator\Factory; use stdClass; @@ -14,7 +14,7 @@ * @internal */ #[CoversClass(DatabaseQueryComparator::class)] -class DatabaseQueryComparatorTest extends TestCase { +final class DatabaseQueryComparatorTest extends TestCase { // // ========================================================================= /** diff --git a/packages/testing/src/Comparators/EloquentModelComparatorTest.php b/packages/testing/src/Comparators/EloquentModelComparatorTest.php index a5800b142..726890940 100644 --- a/packages/testing/src/Comparators/EloquentModelComparatorTest.php +++ b/packages/testing/src/Comparators/EloquentModelComparatorTest.php @@ -3,8 +3,8 @@ namespace LastDragon_ru\LaraASP\Testing\Comparators; use Illuminate\Database\Eloquent\Model; +use LastDragon_ru\LaraASP\Testing\Package\TestCase; use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\TestCase; use SebastianBergmann\Comparator\ComparisonFailure; use SebastianBergmann\Comparator\Factory; use stdClass; @@ -13,7 +13,7 @@ * @internal */ #[CoversClass(EloquentModelComparator::class)] -class EloquentModelComparatorTest extends TestCase { +final class EloquentModelComparatorTest extends TestCase { // // ========================================================================= /** diff --git a/packages/testing/src/Comparators/ScalarStrictComparatorTest.php b/packages/testing/src/Comparators/ScalarStrictComparatorTest.php index a115394d2..ddb903a39 100644 --- a/packages/testing/src/Comparators/ScalarStrictComparatorTest.php +++ b/packages/testing/src/Comparators/ScalarStrictComparatorTest.php @@ -2,15 +2,15 @@ namespace LastDragon_ru\LaraASP\Testing\Comparators; +use LastDragon_ru\LaraASP\Testing\Package\TestCase; use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\TestCase; use SebastianBergmann\Comparator\ComparisonFailure; /** * @internal */ #[CoversClass(ScalarStrictComparator::class)] -class ScalarStrictComparatorTest extends TestCase { +final class ScalarStrictComparatorTest extends TestCase { // // ========================================================================= /** diff --git a/packages/testing/src/Concerns/DatabaseQueryComparator.php b/packages/testing/src/Concerns/DatabaseQueryComparator.php index 5750823ef..567d598e2 100644 --- a/packages/testing/src/Concerns/DatabaseQueryComparator.php +++ b/packages/testing/src/Concerns/DatabaseQueryComparator.php @@ -6,7 +6,9 @@ use PHPUnit\Framework\Test; /** - * Adds {@link \LastDragon_ru\LaraASP\Testing\Comparators\DatabaseQueryComparator} + * Adds {@link Comparator} + * + * @see Comparator * * @mixin Test */ diff --git a/packages/testing/src/Concerns/ModelComparator.php b/packages/testing/src/Concerns/ModelComparator.php index 8024df664..bc5d94a19 100644 --- a/packages/testing/src/Concerns/ModelComparator.php +++ b/packages/testing/src/Concerns/ModelComparator.php @@ -6,7 +6,9 @@ use PHPUnit\Framework\Test; /** - * Adds {@link \LastDragon_ru\LaraASP\Testing\Comparators\EloquentModelComparator} + * Adds {@link EloquentModelComparator} + * + * @see EloquentModelComparator * * @mixin Test */ diff --git a/packages/testing/src/Constraints/Json/ProtocolTest.php b/packages/testing/src/Constraints/Json/ProtocolTest.php index 9f209e967..4c403210c 100644 --- a/packages/testing/src/Constraints/Json/ProtocolTest.php +++ b/packages/testing/src/Constraints/Json/ProtocolTest.php @@ -3,10 +3,9 @@ namespace LastDragon_ru\LaraASP\Testing\Constraints\Json; use Exception; -use LastDragon_ru\LaraASP\Testing\Utils\WithTempFile; +use LastDragon_ru\LaraASP\Testing\Package\TestCase; use OutOfBoundsException; use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\TestCase; use SplFileInfo; use function array_map; @@ -24,9 +23,7 @@ * @internal */ #[CoversClass(Protocol::class)] -class ProtocolTest extends TestCase { - use WithTempFile; - +final class ProtocolTest extends TestCase { // // ========================================================================= /** diff --git a/packages/testing/src/Constraints/Json/TemplateTest.php b/packages/testing/src/Constraints/Json/TemplateTest.php index 25bf36385..ec30788e0 100644 --- a/packages/testing/src/Constraints/Json/TemplateTest.php +++ b/packages/testing/src/Constraints/Json/TemplateTest.php @@ -3,9 +3,9 @@ namespace LastDragon_ru\LaraASP\Testing\Constraints\Json; use Exception; +use LastDragon_ru\LaraASP\Testing\Package\TestCase; use OutOfBoundsException; use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\TestCase; use function json_decode; @@ -13,7 +13,7 @@ * @internal */ #[CoversClass(Template::class)] -class TemplateTest extends TestCase { +final class TemplateTest extends TestCase { // // ========================================================================= /** diff --git a/packages/testing/src/Constraints/Response/ContentTypeTest.php b/packages/testing/src/Constraints/Response/ContentTypeTest.php index fab474e65..54b0cf487 100644 --- a/packages/testing/src/Constraints/Response/ContentTypeTest.php +++ b/packages/testing/src/Constraints/Response/ContentTypeTest.php @@ -4,15 +4,15 @@ use GuzzleHttp\Psr7\Response; use LastDragon_ru\LaraASP\Testing\Exceptions\InvalidArgumentResponse; +use LastDragon_ru\LaraASP\Testing\Package\TestCase; use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\TestCase; use stdClass; /** * @internal */ #[CoversClass(ContentType::class)] -class ContentTypeTest extends TestCase { +final class ContentTypeTest extends TestCase { public function testEvaluateInvalidArgument(): void { self::expectExceptionObject(new InvalidArgumentResponse('$response', new stdClass())); diff --git a/packages/testing/src/Constraints/Response/HeaderTest.php b/packages/testing/src/Constraints/Response/HeaderTest.php index 4187c40c4..d9d4a743e 100644 --- a/packages/testing/src/Constraints/Response/HeaderTest.php +++ b/packages/testing/src/Constraints/Response/HeaderTest.php @@ -4,16 +4,16 @@ use GuzzleHttp\Psr7\Response; use LastDragon_ru\LaraASP\Testing\Exceptions\InvalidArgumentResponse; +use LastDragon_ru\LaraASP\Testing\Package\TestCase; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Constraint\IsEqual; -use PHPUnit\Framework\TestCase; use stdClass; /** * @internal */ #[CoversClass(Header::class)] -class HeaderTest extends TestCase { +final class HeaderTest extends TestCase { public function testEvaluateInvalidArgument(): void { self::expectExceptionObject(new InvalidArgumentResponse('$response', new stdClass())); diff --git a/packages/testing/src/Constraints/Response/MimeTypeTest.php b/packages/testing/src/Constraints/Response/MimeTypeTest.php index 6e7058daa..fe74c4b51 100644 --- a/packages/testing/src/Constraints/Response/MimeTypeTest.php +++ b/packages/testing/src/Constraints/Response/MimeTypeTest.php @@ -4,15 +4,15 @@ use GuzzleHttp\Psr7\Response; use LastDragon_ru\LaraASP\Testing\Exceptions\InvalidArgumentResponse; +use LastDragon_ru\LaraASP\Testing\Package\TestCase; use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\TestCase; use stdClass; /** * @internal */ #[CoversClass(MimeType::class)] -class MimeTypeTest extends TestCase { +final class MimeTypeTest extends TestCase { public function testEvaluateInvalidArgument(): void { self::expectExceptionObject(new InvalidArgumentResponse('$response', new stdClass())); diff --git a/packages/testing/src/Constraints/Response/StatusCodeTest.php b/packages/testing/src/Constraints/Response/StatusCodeTest.php index af518bca8..da80d0dbf 100644 --- a/packages/testing/src/Constraints/Response/StatusCodeTest.php +++ b/packages/testing/src/Constraints/Response/StatusCodeTest.php @@ -4,15 +4,15 @@ use GuzzleHttp\Psr7\Response; use LastDragon_ru\LaraASP\Testing\Exceptions\InvalidArgumentResponse; +use LastDragon_ru\LaraASP\Testing\Package\TestCase; use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\TestCase; use stdClass; /** * @internal */ #[CoversClass(StatusCode::class)] -class StatusCodeTest extends TestCase { +final class StatusCodeTest extends TestCase { public function testEvaluateInvalidArgument(): void { self::expectExceptionObject(new InvalidArgumentResponse('$response', new stdClass())); diff --git a/packages/testing/src/Constraints/Xml/Matchers/DomDocumentRelaxNgSchemaMatcherTest.php b/packages/testing/src/Constraints/Xml/Matchers/DomDocumentRelaxNgSchemaMatcherTest.php index c02b75a90..5fcd1fffc 100644 --- a/packages/testing/src/Constraints/Xml/Matchers/DomDocumentRelaxNgSchemaMatcherTest.php +++ b/packages/testing/src/Constraints/Xml/Matchers/DomDocumentRelaxNgSchemaMatcherTest.php @@ -3,18 +3,15 @@ namespace LastDragon_ru\LaraASP\Testing\Constraints\Xml\Matchers; use LastDragon_ru\LaraASP\Testing\Constraints\Xml\XmlMatchesSchemaTest; -use LastDragon_ru\LaraASP\Testing\Utils\WithTestData; +use LastDragon_ru\LaraASP\Testing\Package\TestCase; use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\TestCase; use SplFileInfo; /** * @internal */ #[CoversClass(DomDocumentRelaxNgSchemaMatcher::class)] -class DomDocumentRelaxNgSchemaMatcherTest extends TestCase { - use WithTestData; - +final class DomDocumentRelaxNgSchemaMatcherTest extends TestCase { public function testEvaluateValid(): void { $schema = self::getTestData(XmlMatchesSchemaTest::class)->file('.rng'); $dom = self::getTestData(XmlMatchesSchemaTest::class)->dom('.xml'); diff --git a/packages/testing/src/Constraints/Xml/Matchers/DomDocumentXsdSchemaMatcherTest.php b/packages/testing/src/Constraints/Xml/Matchers/DomDocumentXsdSchemaMatcherTest.php index 1297a8212..2d6219fea 100644 --- a/packages/testing/src/Constraints/Xml/Matchers/DomDocumentXsdSchemaMatcherTest.php +++ b/packages/testing/src/Constraints/Xml/Matchers/DomDocumentXsdSchemaMatcherTest.php @@ -3,18 +3,15 @@ namespace LastDragon_ru\LaraASP\Testing\Constraints\Xml\Matchers; use LastDragon_ru\LaraASP\Testing\Constraints\Xml\XmlMatchesSchemaTest; -use LastDragon_ru\LaraASP\Testing\Utils\WithTestData; +use LastDragon_ru\LaraASP\Testing\Package\TestCase; use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\TestCase; use SplFileInfo; /** * @internal */ #[CoversClass(DomDocumentXsdSchemaMatcher::class)] -class DomDocumentXsdSchemaMatcherTest extends TestCase { - use WithTestData; - +final class DomDocumentXsdSchemaMatcherTest extends TestCase { public function testEvaluateValid(): void { $schema = self::getTestData(XmlMatchesSchemaTest::class)->file('.xsd'); $dom = self::getTestData(XmlMatchesSchemaTest::class)->dom('.xml'); diff --git a/packages/testing/src/Constraints/Xml/Matchers/XmlFileRelaxNgSchemaMatcherTest.php b/packages/testing/src/Constraints/Xml/Matchers/XmlFileRelaxNgSchemaMatcherTest.php index 56a5c5bb6..708b34bcb 100644 --- a/packages/testing/src/Constraints/Xml/Matchers/XmlFileRelaxNgSchemaMatcherTest.php +++ b/packages/testing/src/Constraints/Xml/Matchers/XmlFileRelaxNgSchemaMatcherTest.php @@ -4,17 +4,14 @@ use DOMDocument; use LastDragon_ru\LaraASP\Testing\Constraints\Xml\XmlMatchesSchemaTest; -use LastDragon_ru\LaraASP\Testing\Utils\WithTestData; +use LastDragon_ru\LaraASP\Testing\Package\TestCase; use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\TestCase; /** * @internal */ #[CoversClass(XmlFileRelaxNgSchemaMatcher::class)] -class XmlFileRelaxNgSchemaMatcherTest extends TestCase { - use WithTestData; - +final class XmlFileRelaxNgSchemaMatcherTest extends TestCase { public function testEvaluateValid(): void { $schema = self::getTestData(XmlMatchesSchemaTest::class)->file('.rng'); $xml = self::getTestData(XmlMatchesSchemaTest::class)->file('.xml'); diff --git a/packages/testing/src/Constraints/Xml/Matchers/XmlFileXsdSchemaMatcherTest.php b/packages/testing/src/Constraints/Xml/Matchers/XmlFileXsdSchemaMatcherTest.php index 3e7d10b6a..5f8904631 100644 --- a/packages/testing/src/Constraints/Xml/Matchers/XmlFileXsdSchemaMatcherTest.php +++ b/packages/testing/src/Constraints/Xml/Matchers/XmlFileXsdSchemaMatcherTest.php @@ -4,17 +4,14 @@ use DOMDocument; use LastDragon_ru\LaraASP\Testing\Constraints\Xml\XmlMatchesSchemaTest; -use LastDragon_ru\LaraASP\Testing\Utils\WithTestData; +use LastDragon_ru\LaraASP\Testing\Package\TestCase; use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\TestCase; /** * @internal */ #[CoversClass(XmlFileXsdSchemaMatcher::class)] -class XmlFileXsdSchemaMatcherTest extends TestCase { - use WithTestData; - +final class XmlFileXsdSchemaMatcherTest extends TestCase { public function testEvaluateValid(): void { $schema = self::getTestData(XmlMatchesSchemaTest::class)->file('.xsd'); $xml = self::getTestData(XmlMatchesSchemaTest::class)->file('.xml'); diff --git a/packages/testing/src/Constraints/Xml/XmlMatchesSchemaTest.php b/packages/testing/src/Constraints/Xml/XmlMatchesSchemaTest.php index 4ad87ebf8..db9a216ba 100644 --- a/packages/testing/src/Constraints/Xml/XmlMatchesSchemaTest.php +++ b/packages/testing/src/Constraints/Xml/XmlMatchesSchemaTest.php @@ -3,10 +3,9 @@ namespace LastDragon_ru\LaraASP\Testing\Constraints\Xml; use DOMDocument; -use LastDragon_ru\LaraASP\Testing\Utils\WithTestData; +use LastDragon_ru\LaraASP\Testing\Package\TestCase; use Override; use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\TestCase; use SplFileInfo; use function is_string; @@ -15,9 +14,7 @@ * @internal */ #[CoversClass(XmlMatchesSchema::class)] -class XmlMatchesSchemaTest extends TestCase { - use WithTestData; - +final class XmlMatchesSchemaTest extends TestCase { // // ========================================================================= /** diff --git a/packages/testing/src/Database/RefreshDatabaseIfEmpty.php b/packages/testing/src/Database/RefreshDatabaseIfEmpty.php index b04a07802..ce5d1a7ef 100644 --- a/packages/testing/src/Database/RefreshDatabaseIfEmpty.php +++ b/packages/testing/src/Database/RefreshDatabaseIfEmpty.php @@ -10,10 +10,8 @@ use PHPUnit\Framework\TestCase; /** - * Unlike {@link \Illuminate\Foundation\Testing\RefreshDatabase} will refresh - * the database only if it empty (very useful for local testing). - * - * @required {@link \Illuminate\Foundation\Testing\TestCase} + * Unlike {@link RefreshDatabase} will refresh the database only if it empty + * (very useful for local testing). * * @property-read Application $app * diff --git a/packages/testing/src/Database/RefreshDatabaseIfEmptyTest.php b/packages/testing/src/Database/RefreshDatabaseIfEmptyTest.php index 8bfef9381..51a22366c 100644 --- a/packages/testing/src/Database/RefreshDatabaseIfEmptyTest.php +++ b/packages/testing/src/Database/RefreshDatabaseIfEmptyTest.php @@ -13,7 +13,7 @@ * @internal */ #[CoversClass(RefreshDatabaseIfEmpty::class)] -class RefreshDatabaseIfEmptyTest extends TestCase { +final class RefreshDatabaseIfEmptyTest extends TestCase { public function testImpl(): void { self::assertNotEmpty(Container::getInstance()->make(RefreshDatabaseIfEmptyTest_Impl::class, [ 'name' => 'test', @@ -28,7 +28,7 @@ public function testImpl(): void { * @internal * @noinspection PhpMultipleClassesDeclarationsInOneFile */ -class RefreshDatabaseIfEmptyTest_Impl extends TestCase { +final class RefreshDatabaseIfEmptyTest_Impl extends TestCase { use RefreshDatabaseIfEmpty; #[Override] diff --git a/packages/testing/src/Providers/ArrayDataProviderTest.php b/packages/testing/src/Providers/ArrayDataProviderTest.php index 005a02871..768dfbca2 100644 --- a/packages/testing/src/Providers/ArrayDataProviderTest.php +++ b/packages/testing/src/Providers/ArrayDataProviderTest.php @@ -2,14 +2,14 @@ namespace LastDragon_ru\LaraASP\Testing\Providers; +use LastDragon_ru\LaraASP\Testing\Package\TestCase; use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\TestCase; /** * @internal */ #[CoversClass(ArrayDataProvider::class)] -class ArrayDataProviderTest extends TestCase { +final class ArrayDataProviderTest extends TestCase { public function testGetData(): void { $f = new ExpectedFinal('expected final'); $a = [ diff --git a/packages/testing/src/Providers/CompositeDataProviderTest.php b/packages/testing/src/Providers/CompositeDataProviderTest.php index fbdf073b2..f97b8f326 100644 --- a/packages/testing/src/Providers/CompositeDataProviderTest.php +++ b/packages/testing/src/Providers/CompositeDataProviderTest.php @@ -2,14 +2,14 @@ namespace LastDragon_ru\LaraASP\Testing\Providers; +use LastDragon_ru\LaraASP\Testing\Package\TestCase; use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\TestCase; /** * @internal */ #[CoversClass(CompositeDataProvider::class)] -class CompositeDataProviderTest extends TestCase { +final class CompositeDataProviderTest extends TestCase { public function testGetData(): void { $a = [ ['expected a', 'value a'], diff --git a/packages/testing/src/Providers/ExpectedValueTest.php b/packages/testing/src/Providers/ExpectedValueTest.php index a137d76bf..91a189c96 100644 --- a/packages/testing/src/Providers/ExpectedValueTest.php +++ b/packages/testing/src/Providers/ExpectedValueTest.php @@ -2,14 +2,14 @@ namespace LastDragon_ru\LaraASP\Testing\Providers; +use LastDragon_ru\LaraASP\Testing\Package\TestCase; use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\TestCase; /** * @internal */ #[CoversClass(ExpectedValue::class)] -class ExpectedValueTest extends TestCase { +final class ExpectedValueTest extends TestCase { public function testGetValue(): void { self::assertEquals(1, (new ExpectedValue(1))->getValue()); } diff --git a/packages/testing/src/Providers/MergeDataProviderTest.php b/packages/testing/src/Providers/MergeDataProviderTest.php index cb4316ec3..d05cd0693 100644 --- a/packages/testing/src/Providers/MergeDataProviderTest.php +++ b/packages/testing/src/Providers/MergeDataProviderTest.php @@ -2,14 +2,14 @@ namespace LastDragon_ru\LaraASP\Testing\Providers; +use LastDragon_ru\LaraASP\Testing\Package\TestCase; use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\TestCase; /** * @internal */ #[CoversClass(MergeDataProvider::class)] -class MergeDataProviderTest extends TestCase { +final class MergeDataProviderTest extends TestCase { public function testGetData(): void { $f = new ExpectedFinal('expected final'); $a = [ diff --git a/packages/testing/src/Providers/TraversableDataProviderTest.php b/packages/testing/src/Providers/TraversableDataProviderTest.php index f4e9e780c..e7e378804 100644 --- a/packages/testing/src/Providers/TraversableDataProviderTest.php +++ b/packages/testing/src/Providers/TraversableDataProviderTest.php @@ -3,14 +3,14 @@ namespace LastDragon_ru\LaraASP\Testing\Providers; use ArrayIterator; +use LastDragon_ru\LaraASP\Testing\Package\TestCase; use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\TestCase; /** * @internal */ #[CoversClass(TraversableDataProvider::class)] -class TraversableDataProviderTest extends TestCase { +final class TraversableDataProviderTest extends TestCase { public function testGetData(): void { $f = new ExpectedFinal('expected final'); $a = new ArrayIterator([ diff --git a/packages/testing/src/Responses/Laravel/Json/ErrorResponseTest.php b/packages/testing/src/Responses/Laravel/Json/ErrorResponseTest.php index 27c187d18..6ad525273 100644 --- a/packages/testing/src/Responses/Laravel/Json/ErrorResponseTest.php +++ b/packages/testing/src/Responses/Laravel/Json/ErrorResponseTest.php @@ -11,7 +11,7 @@ * @internal */ #[CoversClass(ErrorResponse::class)] -class ErrorResponseTest extends TestCase { +final class ErrorResponseTest extends TestCase { public function testEvaluate(): void { $response = Factory::make($this->getJson(__FUNCTION__)); $constraint = new ErrorResponse(new NotFound()); diff --git a/packages/testing/src/Responses/Laravel/Json/ValidationErrorResponseTest.php b/packages/testing/src/Responses/Laravel/Json/ValidationErrorResponseTest.php index ff4775662..645a7d80f 100644 --- a/packages/testing/src/Responses/Laravel/Json/ValidationErrorResponseTest.php +++ b/packages/testing/src/Responses/Laravel/Json/ValidationErrorResponseTest.php @@ -14,7 +14,7 @@ * @internal */ #[CoversClass(ValidationErrorResponse::class)] -class ValidationErrorResponseTest extends TestCase { +final class ValidationErrorResponseTest extends TestCase { // // ========================================================================= /** diff --git a/phpstan-baseline-well-known.neon b/phpstan-baseline-well-known.neon index 0caedd7e7..ddfb4e2a6 100644 --- a/phpstan-baseline-well-known.neon +++ b/phpstan-baseline-well-known.neon @@ -84,3 +84,9 @@ parameters: # https://github.com/phpstan/phpstan/issues/10305 - "#^Property Illuminate\\\\Database\\\\Query\\\\Builder::\\$orders \\(array\\) on left side of \\?\\? is not nullable\\.$#" - "#^Property Illuminate\\\\Database\\\\Query\\\\Builder::\\$unionOrders \\(array\\) on left side of \\?\\? is not nullable\\.$#" + + # (dev) Required for tests + - + message: "#^Class `[^`]+` must be marked by `@internal`\\.$#" + paths: + - dev/PhpStan/ClassMustBeInternal/RuleTest.php diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index a29f5476f..e04f28460 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,10 +1,5 @@ parameters: ignoreErrors: - - - message: "#^Parameter \\#1 \\$translations of method LastDragon_ru\\\\LaraASP\\\\Testing\\\\Package\\\\TestCase\\:\\:setTranslations\\(\\) expects array\\\\>\\|\\(callable\\(LastDragon_ru\\\\LaraASP\\\\Core\\\\Helpers\\\\TranslatorTest, string, string\\)\\: array\\\\>\\)\\|null, array\\\\>\\|\\(callable\\(static, string, string\\)\\: array\\\\>\\)\\|null given\\.$#" - count: 2 - path: packages/core/src/Helpers/TranslatorTest.php - - message: "#^Cannot call method once\\(\\) on mixed\\.$#" count: 1 diff --git a/phpstan.neon b/phpstan.neon index f52d65dac..b953af7dc 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -17,6 +17,16 @@ parameters: checkBenevolentUnionTypes: true checkUninitializedProperties: true + # Package + classMustBeFinal: + classes: + - PHPUnit\Framework\TestCase + classMustBeInternal: + classes: + - PHPUnit\Framework\TestCase + ignored: + - LastDragon_ru\LaraASP\Testing\TestCase + includes: # Vendor - ./vendor/phpstan/phpstan/conf/bleedingEdge.neon @@ -32,7 +42,9 @@ includes: - ./vendor/spaze/phpstan-disallowed-calls/disallowed-loose-calls.neon # Package - - ./dev/PhpStan/Extensions/Container/extension.neon + - ./dev/PhpStan/Container/extension.neon + - ./dev/PhpStan/ClassMustBeFinal/extension.neon + - ./dev/PhpStan/ClassMustBeInternal/extension.neon # Baseline - phpstan-baseline-well-known.neon