diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 70ce5750..3f9d0de6 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,13 +1,8 @@ - + - - DataTransformerInterface - - - - - DataTransformerInterface - + + $value + diff --git a/src/Handler/Exception/InvalidCallbackException.php b/src/Handler/Exception/InvalidCallbackException.php index ba24799e..9f2cba1d 100644 --- a/src/Handler/Exception/InvalidCallbackException.php +++ b/src/Handler/Exception/InvalidCallbackException.php @@ -13,6 +13,4 @@ use InvalidArgumentException; -class InvalidCallbackException extends InvalidArgumentException -{ -} +class InvalidCallbackException extends InvalidArgumentException {} diff --git a/src/Test/AbstractFormHandlerTest.php b/src/Test/AbstractFormHandlerTest.php index 9aced6ed..d6617de8 100644 --- a/src/Test/AbstractFormHandlerTest.php +++ b/src/Test/AbstractFormHandlerTest.php @@ -154,7 +154,7 @@ final protected function assertError(string $message, array $messageParameters = private function equalToErrors(): Constraint { - return static::callback(function ($error) { + return self::callback(function ($error) { if ($error instanceof FormError) { foreach ($this->errors as &$data) { if ($error->getMessage() === $data['message'] && $error->getMessageParameters() === $data['parameters']) { @@ -177,9 +177,9 @@ private function checkCalledErrors(): void { $count = \count($this->errors); if (0 === $count) { - $this->form->expects(static::never())->method('addError'); + $this->form->expects(self::never())->method('addError'); } else { - $this->form->expects(static::exactly($count))->method('addError') + $this->form->expects(self::exactly($count))->method('addError') ->with($this->equalToErrors()) ; } diff --git a/src/Type/GenderType.php b/src/Type/GenderType.php index c3f6fce8..53559d4c 100644 --- a/src/Type/GenderType.php +++ b/src/Type/GenderType.php @@ -27,9 +27,9 @@ public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'choices' => [ - 'male' => static::TYPE_MALE, - 'female' => static::TYPE_FEMALE, - 'non_binary' => static::TYPE_NON_BINARY, + 'male' => self::TYPE_MALE, + 'female' => self::TYPE_FEMALE, + 'non_binary' => self::TYPE_NON_BINARY, ], 'choice_label' => static function ($value, $key, $index) { return 'gender.'.$key; diff --git a/src/Validator/Constraints/BatchTimeAfter.php b/src/Validator/Constraints/BatchTimeAfter.php index b062fda8..4bb14831 100644 --- a/src/Validator/Constraints/BatchTimeAfter.php +++ b/src/Validator/Constraints/BatchTimeAfter.php @@ -17,7 +17,6 @@ /** * @Annotation - * * @Target({"CLASS", "ANNOTATION"}) */ #[Attribute(Attribute::TARGET_CLASS | Attribute::IS_REPEATABLE)] diff --git a/src/Validator/Constraints/DateAfter.php b/src/Validator/Constraints/DateAfter.php index 10fe3adc..7dead32b 100644 --- a/src/Validator/Constraints/DateAfter.php +++ b/src/Validator/Constraints/DateAfter.php @@ -17,7 +17,6 @@ /** * @Annotation - * * @Target({"CLASS", "ANNOTATION"}) */ #[Attribute(Attribute::TARGET_CLASS | Attribute::IS_REPEATABLE)] diff --git a/tests/Bridge/Symfony/Bundle/BundleIntegrationTest.php b/tests/Bridge/Symfony/Bundle/BundleIntegrationTest.php index f2b6b200..87c6dc59 100644 --- a/tests/Bridge/Symfony/Bundle/BundleIntegrationTest.php +++ b/tests/Bridge/Symfony/Bundle/BundleIntegrationTest.php @@ -28,6 +28,6 @@ public function testStartup(): void $client->request('GET', '/test'); - static::assertSame(200, $client->getResponse()->getStatusCode()); + self::assertSame(200, $client->getResponse()->getStatusCode()); } } diff --git a/tests/Bridge/Symfony/Bundle/NucleosFormBundleTest.php b/tests/Bridge/Symfony/Bundle/NucleosFormBundleTest.php index b4c11787..0e240cfb 100644 --- a/tests/Bridge/Symfony/Bundle/NucleosFormBundleTest.php +++ b/tests/Bridge/Symfony/Bundle/NucleosFormBundleTest.php @@ -21,13 +21,13 @@ public function testGetPath(): void { $bundle = new NucleosFormBundle(); - static::assertStringEndsWith('Bridge/Symfony/Bundle', \dirname($bundle->getPath())); + self::assertStringEndsWith('Bridge/Symfony/Bundle', \dirname($bundle->getPath())); } public function testGetContainerExtension(): void { $bundle = new NucleosFormBundle(); - static::assertInstanceOf(NucleosFormExtension::class, $bundle->getContainerExtension()); + self::assertInstanceOf(NucleosFormExtension::class, $bundle->getContainerExtension()); } } diff --git a/tests/Bridge/Symfony/DependencyInjection/NucleosFormExtensionTest.php b/tests/Bridge/Symfony/DependencyInjection/NucleosFormExtensionTest.php index d97718e5..481665e5 100644 --- a/tests/Bridge/Symfony/DependencyInjection/NucleosFormExtensionTest.php +++ b/tests/Bridge/Symfony/DependencyInjection/NucleosFormExtensionTest.php @@ -66,12 +66,12 @@ public function testLoadDefaultWithAdmin(): void public function testLoadWithTwigExtension(): void { $fakeContainer = $this->createMock(ContainerBuilder::class); - $fakeContainer->expects(static::once()) + $fakeContainer->expects(self::once()) ->method('hasExtension') - ->with(static::equalTo('twig')) + ->with(self::equalTo('twig')) ->willReturn(true) ; - $fakeContainer->expects(static::once()) + $fakeContainer->expects(self::once()) ->method('prependExtensionConfig') ->with('twig', ['form_themes' => ['@NucleosForm/Form/widgets.html.twig']]) ; diff --git a/tests/Extension/DownloadTypeExtensionTest.php b/tests/Extension/DownloadTypeExtensionTest.php index 8893ec59..989f56a3 100644 --- a/tests/Extension/DownloadTypeExtensionTest.php +++ b/tests/Extension/DownloadTypeExtensionTest.php @@ -30,14 +30,14 @@ public function testConfigureOptions(): void $result = $resolver->resolve(); - static::assertNull($result['download_path']); - static::assertSame('link_download', $result['download_text']); + self::assertNull($result['download_path']); + self::assertSame('link_download', $result['download_text']); } public function testBuildForm(): void { $builder = $this->createMock(FormBuilderInterface::class); - $builder->expects(static::once())->method('setAttribute') + $builder->expects(self::once())->method('setAttribute') ->with('download_path', 'image') ; @@ -69,8 +69,8 @@ public function testBuildView(): void 'download_text' => 'link_download', ]); - static::assertSame('/foo/bar.png', $view->vars['download_path']); - static::assertSame('link_download', $view->vars['download_text']); + self::assertSame('/foo/bar.png', $view->vars['download_path']); + self::assertSame('link_download', $view->vars['download_text']); } public function testBuildViewWithoutData(): void @@ -93,12 +93,12 @@ public function testBuildViewWithoutData(): void 'download_text' => 'link_download', ]); - static::assertNull($view->vars['download_path']); - static::assertSame('link_download', $view->vars['download_text']); + self::assertNull($view->vars['download_path']); + self::assertSame('link_download', $view->vars['download_text']); } public function testExtendedTypes(): void { - static::assertSame([FileType::class], DownloadTypeExtension::getExtendedTypes()); + self::assertSame([FileType::class], DownloadTypeExtension::getExtendedTypes()); } } diff --git a/tests/Extension/ImageTypeExtensionTest.php b/tests/Extension/ImageTypeExtensionTest.php index 6da607fe..ea3cd78c 100644 --- a/tests/Extension/ImageTypeExtensionTest.php +++ b/tests/Extension/ImageTypeExtensionTest.php @@ -30,13 +30,13 @@ public function testConfigureOptions(): void $result = $resolver->resolve(); - static::assertNull($result['image_path']); + self::assertNull($result['image_path']); } public function testBuildForm(): void { $builder = $this->createMock(FormBuilderInterface::class); - $builder->expects(static::once())->method('setAttribute') + $builder->expects(self::once())->method('setAttribute') ->with('image_path', 'image') ; @@ -67,7 +67,7 @@ public function testBuildView(): void 'image_path' => '[image]', ]); - static::assertSame('/foo/bar.png', $view->vars['image_url']); + self::assertSame('/foo/bar.png', $view->vars['image_url']); } public function testBuildViewWithoutData(): void @@ -89,11 +89,11 @@ public function testBuildViewWithoutData(): void 'image_path' => '[image]', ]); - static::assertNull($view->vars['image_url']); + self::assertNull($view->vars['image_url']); } public function testExtendedTypes(): void { - static::assertSame([FileType::class], ImageTypeExtension::getExtendedTypes()); + self::assertSame([FileType::class], ImageTypeExtension::getExtendedTypes()); } } diff --git a/tests/Fixtures/BarEntity.php b/tests/Fixtures/BarEntity.php index 79ac92ad..bba6062b 100644 --- a/tests/Fixtures/BarEntity.php +++ b/tests/Fixtures/BarEntity.php @@ -9,6 +9,4 @@ namespace Nucleos\Form\Tests\Fixtures; -class BarEntity -{ -} +class BarEntity {} diff --git a/tests/Fixtures/DummyConstraint.php b/tests/Fixtures/DummyConstraint.php index 7b6f4a5b..17f8f182 100644 --- a/tests/Fixtures/DummyConstraint.php +++ b/tests/Fixtures/DummyConstraint.php @@ -13,6 +13,4 @@ use Symfony\Component\Validator\Constraint; -final class DummyConstraint extends Constraint -{ -} +final class DummyConstraint extends Constraint {} diff --git a/tests/Fixtures/FooEntity.php b/tests/Fixtures/FooEntity.php index f6fe9447..f6e98782 100644 --- a/tests/Fixtures/FooEntity.php +++ b/tests/Fixtures/FooEntity.php @@ -9,6 +9,4 @@ namespace Nucleos\Form\Tests\Fixtures; -class FooEntity -{ -} +class FooEntity {} diff --git a/tests/Form/Handler/AbstractFormHandlerTest.php b/tests/Form/Handler/AbstractFormHandlerTest.php index 9c1d57eb..71fcb31a 100644 --- a/tests/Form/Handler/AbstractFormHandlerTest.php +++ b/tests/Form/Handler/AbstractFormHandlerTest.php @@ -26,13 +26,13 @@ public function testHandle(): void $response = $this->createMock(Response::class); $form = $this->createMock(FormInterface::class); - $form->expects(static::once())->method('handleRequest') - ->with(static::equalTo($request)) + $form->expects(self::once())->method('handleRequest') + ->with(self::equalTo($request)) ; - $form->expects(static::once())->method('isValid') + $form->expects(self::once())->method('isValid') ->willReturn(true) ; - $form->expects(static::once())->method('isSubmitted') + $form->expects(self::once())->method('isSubmitted') ->willReturn(true) ; @@ -42,7 +42,7 @@ public function testHandle(): void return $response; }); - static::assertSame($response, $result); + self::assertSame($response, $result); } public function testHandleInvalidCallback(): void @@ -52,13 +52,13 @@ public function testHandleInvalidCallback(): void $request = $this->createMock(Request::class); $form = $this->createMock(FormInterface::class); - $form->expects(static::once())->method('handleRequest') - ->with(static::equalTo($request)) + $form->expects(self::once())->method('handleRequest') + ->with(self::equalTo($request)) ; - $form->expects(static::once())->method('isValid') + $form->expects(self::once())->method('isValid') ->willReturn(true) ; - $form->expects(static::once())->method('isSubmitted') + $form->expects(self::once())->method('isSubmitted') ->willReturn(true) ; diff --git a/tests/Model/BatchTimeTest.php b/tests/Model/BatchTimeTest.php index d761cc3a..aa3d10a6 100644 --- a/tests/Model/BatchTimeTest.php +++ b/tests/Model/BatchTimeTest.php @@ -26,8 +26,8 @@ public function testItIsInstantiable(): void { $batchTime = new BatchTime(); - static::assertSame('Day: 0, Time: null', $batchTime->__toString()); - static::assertSame('Day: 0, Time: null', $batchTime->toString()); + self::assertSame('Day: 0, Time: null', $batchTime->__toString()); + self::assertSame('Day: 0, Time: null', $batchTime->toString()); } public function testDay(): void @@ -35,7 +35,7 @@ public function testDay(): void $batchTime = new BatchTime(); $batchTime->setDay(3); - static::assertSame(3, $batchTime->getDay()); + self::assertSame(3, $batchTime->getDay()); } public function testTime(): void @@ -45,7 +45,7 @@ public function testTime(): void $batchTime = new BatchTime(); $batchTime->setTime($time); - static::assertSame($time, $batchTime->getTime()); + self::assertSame($time, $batchTime->getTime()); } public function testSeconds(): void @@ -56,6 +56,6 @@ public function testSeconds(): void $batchTime->setDay(2); $batchTime->setTime($time); - static::assertSame(224580, $batchTime->getSeconds()); + self::assertSame(224580, $batchTime->getSeconds()); } } diff --git a/tests/Test/AbstractFormHandlerTestCaseTest.php b/tests/Test/AbstractFormHandlerTestCaseTest.php index f513c021..7ff46707 100644 --- a/tests/Test/AbstractFormHandlerTestCaseTest.php +++ b/tests/Test/AbstractFormHandlerTestCaseTest.php @@ -30,7 +30,7 @@ public function testExecutePreProcess(): void $object = new stdClass(); $request = new Request(); - static::assertNull($this->executePreProcess($request, $object)); + self::assertNull($this->executePreProcess($request, $object)); } public function testExecutePreProcessWithError(): void @@ -42,7 +42,7 @@ public function testExecutePreProcessWithError(): void $this->assertError('my error', ['foo' => 'bar']); - static::assertNotNull($this->executePreProcess($request, $object)); + self::assertNotNull($this->executePreProcess($request, $object)); } public function testExecuteProcess(): void @@ -52,7 +52,7 @@ public function testExecuteProcess(): void $object = new stdClass(); $request = new Request(); - static::assertTrue($this->executeProcess($request, $object)); + self::assertTrue($this->executeProcess($request, $object)); } public function testExecuteProcessWithError(): void @@ -64,7 +64,7 @@ public function testExecuteProcessWithError(): void $this->assertError('my error', ['foo' => 'bar']); - static::assertFalse($this->executeProcess($request, $object)); + self::assertFalse($this->executeProcess($request, $object)); } public function testExecutePostProcess(): void @@ -75,7 +75,7 @@ public function testExecutePostProcess(): void $request = new Request(); $response = new Response(); - static::assertSame($response, $this->executePostProcess($request, $response, $object)); + self::assertSame($response, $this->executePostProcess($request, $response, $object)); } public function testExecutePostProcessWithError(): void @@ -88,7 +88,7 @@ public function testExecutePostProcessWithError(): void $this->assertError('my error', ['foo' => 'bar']); - static::assertNull($this->executePostProcess($request, $response, $object)); + self::assertNull($this->executePostProcess($request, $response, $object)); } protected function createFormHandler(): FormHandlerInterface diff --git a/tests/Type/BaseTypeTestCase.php b/tests/Type/BaseTypeTestCase.php index 7aab4a8b..29811b62 100644 --- a/tests/Type/BaseTypeTestCase.php +++ b/tests/Type/BaseTypeTestCase.php @@ -26,7 +26,7 @@ public function testPassDisabledAsOption(): void { $form = $this->create(null, ['disabled' => true]); - static::assertTrue($form->isDisabled()); + self::assertTrue($form->isDisabled()); } public function testPassIdAndNameToView(): void @@ -35,9 +35,9 @@ public function testPassIdAndNameToView(): void ->createView() ; - static::assertSame('name', $view->vars['id']); - static::assertSame('name', $view->vars['name']); - static::assertSame('name', $view->vars['full_name']); + self::assertSame('name', $view->vars['id']); + self::assertSame('name', $view->vars['name']); + self::assertSame('name', $view->vars['full_name']); } public function testStripLeadingUnderscoresAndDigitsFromId(): void @@ -46,9 +46,9 @@ public function testStripLeadingUnderscoresAndDigitsFromId(): void ->createView() ; - static::assertSame('name', $view->vars['id']); - static::assertSame('_09name', $view->vars['name']); - static::assertSame('_09name', $view->vars['full_name']); + self::assertSame('name', $view->vars['id']); + self::assertSame('_09name', $view->vars['name']); + self::assertSame('_09name', $view->vars['full_name']); } public function testPassIdAndNameToViewWithParent(): void @@ -58,9 +58,9 @@ public function testPassIdAndNameToViewWithParent(): void ->createView() ; - static::assertSame('parent_child', $view['child']->vars['id']); - static::assertSame('child', $view['child']->vars['name']); - static::assertSame('parent[child]', $view['child']->vars['full_name']); + self::assertSame('parent_child', $view['child']->vars['id']); + self::assertSame('child', $view['child']->vars['name']); + self::assertSame('parent[child]', $view['child']->vars['full_name']); } public function testPassIdAndNameToViewWithGrandParent(): void @@ -71,9 +71,9 @@ public function testPassIdAndNameToViewWithGrandParent(): void $builder->get('child')->add('grand_child', $this->getTestedType()); $view = $builder->getForm()->createView(); - static::assertSame('parent_child_grand_child', $view['child']['grand_child']->vars['id']); - static::assertSame('grand_child', $view['child']['grand_child']->vars['name']); - static::assertSame('parent[child][grand_child]', $view['child']['grand_child']->vars['full_name']); + self::assertSame('parent_child_grand_child', $view['child']['grand_child']->vars['id']); + self::assertSame('grand_child', $view['child']['grand_child']->vars['name']); + self::assertSame('parent[child][grand_child]', $view['child']['grand_child']->vars['full_name']); } public function testPassTranslationDomainToView(): void @@ -84,7 +84,7 @@ public function testPassTranslationDomainToView(): void ->createView() ; - static::assertSame('domain', $view->vars['translation_domain']); + self::assertSame('domain', $view->vars['translation_domain']); } public function testInheritTranslationDomainFromParent(): void @@ -96,7 +96,7 @@ public function testInheritTranslationDomainFromParent(): void ->createView() ; - static::assertSame('domain', $view['child']->vars['translation_domain']); + self::assertSame('domain', $view['child']->vars['translation_domain']); } public function testPreferOwnTranslationDomain(): void @@ -110,7 +110,7 @@ public function testPreferOwnTranslationDomain(): void ->createView() ; - static::assertSame('domain', $view['child']->vars['translation_domain']); + self::assertSame('domain', $view['child']->vars['translation_domain']); } public function testDefaultTranslationDomain(): void @@ -120,7 +120,7 @@ public function testDefaultTranslationDomain(): void ->createView() ; - static::assertNull($view['child']->vars['translation_domain']); + self::assertNull($view['child']->vars['translation_domain']); } public function testPassLabelToView(): void @@ -129,7 +129,7 @@ public function testPassLabelToView(): void ->createView() ; - static::assertSame('My label', $view->vars['label']); + self::assertSame('My label', $view->vars['label']); } public function testPassMultipartFalseToView(): void @@ -138,7 +138,7 @@ public function testPassMultipartFalseToView(): void ->createView() ; - static::assertFalse($view->vars['multipart']); + self::assertFalse($view->vars['multipart']); } /** @@ -151,9 +151,9 @@ public function testSubmitNull($expected = null, $norm = null, $view = null): vo $form = $this->create(); $form->submit(null); - static::assertSame($expected, $form->getData()); - static::assertSame($norm, $form->getNormData()); - static::assertSame($view, $form->getViewData()); + self::assertSame($expected, $form->getData()); + self::assertSame($norm, $form->getNormData()); + self::assertSame($view, $form->getViewData()); } /** @@ -177,9 +177,9 @@ public function testSubmitNullUsesDefaultEmptyData($emptyData = 'empty', $expect $form = $builder->setEmptyData($emptyData)->getForm()->submit(null); - static::assertSame($emptyData, $form->getViewData()); - static::assertSame($expectedData, $form->getNormData()); - static::assertSame($expectedData, $form->getData()); + self::assertSame($emptyData, $form->getViewData()); + self::assertSame($expectedData, $form->getNormData()); + self::assertSame($expectedData, $form->getData()); } /** diff --git a/tests/Type/BatchTimeTypeTest.php b/tests/Type/BatchTimeTypeTest.php index f3b16da8..7576a03e 100644 --- a/tests/Type/BatchTimeTypeTest.php +++ b/tests/Type/BatchTimeTypeTest.php @@ -20,14 +20,14 @@ public function testGetParent(): void { $type = new BatchTimeType(); - static::assertSame(FormType::class, $type->getParent()); + self::assertSame(FormType::class, $type->getParent()); } public function testGetBlockPrefix(): void { $type = new BatchTimeType(); - static::assertSame('batch_time', $type->getBlockPrefix()); + self::assertSame('batch_time', $type->getBlockPrefix()); } public function testSubmitNull($expected = null, $norm = null, $view = null): void @@ -37,14 +37,14 @@ public function testSubmitNull($expected = null, $norm = null, $view = null): vo ]); $form->submit(null); - static::assertSame($expected, $form->getData()); - static::assertSame($norm, $form->getNormData()); - static::assertSame($view, $form->getViewData()); + self::assertSame($expected, $form->getData()); + self::assertSame($norm, $form->getNormData()); + self::assertSame($view, $form->getViewData()); } public function testSubmitNullUsesDefaultEmptyData($emptyData = null, $expectedData = null): void { - static::markTestSkipped('emptyData is not supported'); + self::markTestSkipped('emptyData is not supported'); } protected function getTestedType(): string diff --git a/tests/Type/DACHCountryTypeTest.php b/tests/Type/DACHCountryTypeTest.php index 5db483ca..ee3bd268 100644 --- a/tests/Type/DACHCountryTypeTest.php +++ b/tests/Type/DACHCountryTypeTest.php @@ -20,17 +20,19 @@ final class DACHCountryTypeTest extends BaseTypeTestCase public function testCountriesAreSelectable(): void { $choices = $this->factory->create($this->getTestedType()) - ->createView()->vars['choices']; + ->createView()->vars['choices'] + ; - static::assertContainsEquals(new ChoiceView('DE', 'DE', 'form.choice_de'), $choices); - static::assertContainsEquals(new ChoiceView('AT', 'AT', 'form.choice_at'), $choices); - static::assertContainsEquals(new ChoiceView('CH', 'CH', 'form.choice_ch'), $choices); + self::assertContainsEquals(new ChoiceView('DE', 'DE', 'form.choice_de'), $choices); + self::assertContainsEquals(new ChoiceView('AT', 'AT', 'form.choice_at'), $choices); + self::assertContainsEquals(new ChoiceView('CH', 'CH', 'form.choice_ch'), $choices); } public function testUnknownCountryIsNotIncluded(): void { $choices = $this->factory->create($this->getTestedType(), 'country') - ->createView()->vars['choices']; + ->createView()->vars['choices'] + ; $countryCodes = []; @@ -38,7 +40,7 @@ public function testUnknownCountryIsNotIncluded(): void $countryCodes[] = $choice->value; } - static::assertNotContains('ZZ', $countryCodes); + self::assertNotContains('ZZ', $countryCodes); } public function testSubmitNull($expected = null, $norm = null, $view = null): void @@ -55,14 +57,14 @@ public function testGetParent(): void { $type = new DACHCountryType(); - static::assertSame(ChoiceType::class, $type->getParent()); + self::assertSame(ChoiceType::class, $type->getParent()); } public function testGetBlockPrefix(): void { $type = new DACHCountryType(); - static::assertSame('nucleos_country', $type->getBlockPrefix()); + self::assertSame('nucleos_country', $type->getBlockPrefix()); } protected function getTestedType(): string diff --git a/tests/Type/DateOutputTypeTest.php b/tests/Type/DateOutputTypeTest.php index 1320df0b..55a011bf 100644 --- a/tests/Type/DateOutputTypeTest.php +++ b/tests/Type/DateOutputTypeTest.php @@ -26,9 +26,9 @@ public function testSubmitNullUsesDefaultEmptyData($emptyData = 'empty', $expect $form = $builder->setEmptyData($emptyData)->getForm()->submit(null); - static::assertSame('', $form->getViewData()); - static::assertSame($expectedData, $form->getNormData()); - static::assertSame($expectedData, $form->getData()); + self::assertSame('', $form->getViewData()); + self::assertSame($expectedData, $form->getNormData()); + self::assertSame($expectedData, $form->getData()); } protected function getTestedType(): string diff --git a/tests/Type/DoctrineDiscriminatorTypeTest.php b/tests/Type/DoctrineDiscriminatorTypeTest.php index 579b20fb..fe17a37d 100644 --- a/tests/Type/DoctrineDiscriminatorTypeTest.php +++ b/tests/Type/DoctrineDiscriminatorTypeTest.php @@ -68,10 +68,11 @@ public function testTypesAreSelectable(): void $choices = $this->factory->create($this->getTestedType(), null, [ 'class' => 'MyEntityClass', ]) - ->createView()->vars['choices']; + ->createView()->vars['choices'] + ; - static::assertContainsEquals(new ChoiceView('foo', 'foo', 'foo'), $choices); - static::assertContainsEquals(new ChoiceView('bar', 'bar', 'bar'), $choices); + self::assertContainsEquals(new ChoiceView('foo', 'foo', 'foo'), $choices); + self::assertContainsEquals(new ChoiceView('bar', 'bar', 'bar'), $choices); } public function testPassIdAndNameToViewWithGrandParent(): void @@ -84,9 +85,9 @@ public function testPassIdAndNameToViewWithGrandParent(): void ]); $view = $builder->getForm()->createView(); - static::assertSame('parent_child_grand_child', $view['child']['grand_child']->vars['id']); - static::assertSame('grand_child', $view['child']['grand_child']->vars['name']); - static::assertSame('parent[child][grand_child]', $view['child']['grand_child']->vars['full_name']); + self::assertSame('parent_child_grand_child', $view['child']['grand_child']->vars['id']); + self::assertSame('grand_child', $view['child']['grand_child']->vars['name']); + self::assertSame('parent[child][grand_child]', $view['child']['grand_child']->vars['full_name']); } public function testUnknownTypeIsNotIncluded(): void @@ -94,7 +95,8 @@ public function testUnknownTypeIsNotIncluded(): void $choices = $this->factory->create($this->getTestedType(), 'types', [ 'class' => 'MyEntityClass', ]) - ->createView()->vars['choices']; + ->createView()->vars['choices'] + ; $countryCodes = []; @@ -102,7 +104,7 @@ public function testUnknownTypeIsNotIncluded(): void $countryCodes[] = $choice->value; } - static::assertNotContains('baz', $countryCodes); + self::assertNotContains('baz', $countryCodes); } public function testSubmitNull($expected = null, $norm = null, $view = ''): void @@ -129,9 +131,9 @@ public function testSubmitNullUsesDefaultEmptyData($emptyData = 'foo', $expected $form = $builder->setEmptyData($emptyData)->getForm()->submit(null); - static::assertSame($emptyData, $form->getViewData()); - static::assertSame($expectedData, $form->getNormData()); - static::assertSame($expectedData, $form->getData()); + self::assertSame($emptyData, $form->getViewData()); + self::assertSame($expectedData, $form->getNormData()); + self::assertSame($expectedData, $form->getData()); } protected function create(mixed $data = null, array $options = []): FormInterface diff --git a/tests/Type/GenderTypeTest.php b/tests/Type/GenderTypeTest.php index d3883c86..dc7a3f8f 100644 --- a/tests/Type/GenderTypeTest.php +++ b/tests/Type/GenderTypeTest.php @@ -20,17 +20,19 @@ final class GenderTypeTest extends BaseTypeTestCase public function testGendersAreSelectable(): void { $choices = $this->factory->create($this->getTestedType()) - ->createView()->vars['choices']; + ->createView()->vars['choices'] + ; - static::assertContainsEquals(new ChoiceView('m', 'm', 'gender.male'), $choices); - static::assertContainsEquals(new ChoiceView('f', 'f', 'gender.female'), $choices); - static::assertContainsEquals(new ChoiceView('d', 'd', 'gender.non_binary'), $choices); + self::assertContainsEquals(new ChoiceView('m', 'm', 'gender.male'), $choices); + self::assertContainsEquals(new ChoiceView('f', 'f', 'gender.female'), $choices); + self::assertContainsEquals(new ChoiceView('d', 'd', 'gender.non_binary'), $choices); } public function testUnknownGenderIsNotIncluded(): void { $choices = $this->factory->create($this->getTestedType(), 'gender') - ->createView()->vars['choices']; + ->createView()->vars['choices'] + ; $genderCodes = []; @@ -38,7 +40,7 @@ public function testUnknownGenderIsNotIncluded(): void $genderCodes[] = $choice->value; } - static::assertNotContains('t', $genderCodes); + self::assertNotContains('t', $genderCodes); } public function testSubmitNull($expected = null, $norm = null, $view = null): void @@ -55,14 +57,14 @@ public function testGetParent(): void { $type = new GenderType(); - static::assertSame(ChoiceType::class, $type->getParent()); + self::assertSame(ChoiceType::class, $type->getParent()); } public function testGetBlockPrefix(): void { $type = new GenderType(); - static::assertSame('gender', $type->getBlockPrefix()); + self::assertSame('gender', $type->getBlockPrefix()); } protected function getTestedType(): string diff --git a/tests/Type/JsonTypeTest.php b/tests/Type/JsonTypeTest.php index fb4a53a0..d75f9338 100644 --- a/tests/Type/JsonTypeTest.php +++ b/tests/Type/JsonTypeTest.php @@ -37,9 +37,9 @@ public function testSubmitNullUsesDefaultEmptyData($emptyData = 'empty', $expect $form = $builder->setEmptyData($emptyData)->getForm()->submit(null); - static::assertSame($emptyData, $form->getViewData()); - static::assertSame($expectedData, $form->getNormData()); - static::assertSame([], $form->getData()); + self::assertSame($emptyData, $form->getViewData()); + self::assertSame($expectedData, $form->getNormData()); + self::assertSame([], $form->getData()); } protected function getTestedType(): string diff --git a/tests/Type/NumberOutputTypeTest.php b/tests/Type/NumberOutputTypeTest.php index 2de44003..ab95e27e 100644 --- a/tests/Type/NumberOutputTypeTest.php +++ b/tests/Type/NumberOutputTypeTest.php @@ -26,9 +26,9 @@ public function testSubmitNullUsesDefaultEmptyData($emptyData = 'empty', $expect $form = $builder->setEmptyData($emptyData)->getForm()->submit(null); - static::assertSame('', $form->getViewData()); - static::assertSame($expectedData, $form->getNormData()); - static::assertSame($expectedData, $form->getData()); + self::assertSame('', $form->getViewData()); + self::assertSame($expectedData, $form->getNormData()); + self::assertSame($expectedData, $form->getData()); } protected function getTestedType(): string diff --git a/tests/Type/OutputTypeTest.php b/tests/Type/OutputTypeTest.php index ff42a418..9e49ba3c 100644 --- a/tests/Type/OutputTypeTest.php +++ b/tests/Type/OutputTypeTest.php @@ -26,9 +26,9 @@ public function testSubmitNullUsesDefaultEmptyData($emptyData = 'empty', $expect $form = $builder->setEmptyData($emptyData)->getForm()->submit(null); - static::assertSame('', $form->getViewData()); - static::assertSame($expectedData, $form->getNormData()); - static::assertSame($expectedData, $form->getData()); + self::assertSame('', $form->getViewData()); + self::assertSame($expectedData, $form->getNormData()); + self::assertSame($expectedData, $form->getData()); } protected function getTestedType(): string diff --git a/tests/Type/TimePickerTypeTest.php b/tests/Type/TimePickerTypeTest.php index 79c91aea..ed18c23b 100644 --- a/tests/Type/TimePickerTypeTest.php +++ b/tests/Type/TimePickerTypeTest.php @@ -38,9 +38,9 @@ public function testSubmitNullUsesDefaultEmptyData($emptyData = '05:23', $expect $form = $builder->setEmptyData($emptyData)->getForm()->submit(null); - static::assertSame($emptyData, $form->getViewData()); - static::assertSame('05:23:00', $form->getNormData()->format('H:i:s')); - static::assertSame('05:23:00', $form->getData()->format('H:i:s')); + self::assertSame($emptyData, $form->getViewData()); + self::assertSame('05:23:00', $form->getNormData()->format('H:i:s')); + self::assertSame('05:23:00', $form->getData()->format('H:i:s')); } protected function getTestedType(): string diff --git a/tests/Validator/Constraints/BatchTimeAfterTest.php b/tests/Validator/Constraints/BatchTimeAfterTest.php index 6de8efa0..a3ad983c 100644 --- a/tests/Validator/Constraints/BatchTimeAfterTest.php +++ b/tests/Validator/Constraints/BatchTimeAfterTest.php @@ -56,8 +56,8 @@ public function testItIsInstantiable(): void 'secondField' => 'second', ]); - static::assertSame('first', $dateAfter->firstField); - static::assertSame('second', $dateAfter->secondField); + self::assertSame('first', $dateAfter->firstField); + self::assertSame('second', $dateAfter->secondField); } public function testGetTarget(): void @@ -67,6 +67,6 @@ public function testGetTarget(): void 'secondField' => 'second', ]); - static::assertSame('class', $dateAfter->getTargets()); + self::assertSame('class', $dateAfter->getTargets()); } } diff --git a/tests/Validator/Constraints/DateAfterTest.php b/tests/Validator/Constraints/DateAfterTest.php index 7711a4c2..f25a427d 100644 --- a/tests/Validator/Constraints/DateAfterTest.php +++ b/tests/Validator/Constraints/DateAfterTest.php @@ -56,8 +56,8 @@ public function testItIsInstantiable(): void 'secondField' => 'second', ]); - static::assertSame('first', $dateAfter->firstField); - static::assertSame('second', $dateAfter->secondField); + self::assertSame('first', $dateAfter->firstField); + self::assertSame('second', $dateAfter->secondField); } public function testGetTarget(): void @@ -67,6 +67,6 @@ public function testGetTarget(): void 'secondField' => 'second', ]); - static::assertSame('class', $dateAfter->getTargets()); + self::assertSame('class', $dateAfter->getTargets()); } }