From e78d2f53717371c92bb8cf75a4dc1001f632347d Mon Sep 17 00:00:00 2001 From: Filippo Tessarotto Date: Wed, 26 May 2021 16:25:54 +0200 Subject: [PATCH 1/9] vendor/bin/psalm --alter --issues=MissingReturnType,MissingClosureReturnType,MissingParamType Signed-off-by: Filippo Tessarotto --- src/Annotation/BuilderAbstractFactory.php | 2 +- src/Fieldset.php | 2 +- src/Form.php | 4 +- src/FormAbstractServiceFactory.php | 1 + src/FormElementManager.php | 3 +- src/InputFilterProviderFieldset.php | 2 +- src/View/Helper/AbstractHelper.php | 4 +- src/View/Helper/FormElementErrors.php | 2 +- test/Annotation/AbstractBuilderTestCase.php | 50 ++--- .../Annotation/BuilderAbstractFactoryTest.php | 12 +- test/Element/CaptchaTest.php | 14 +- test/Element/CheckboxTest.php | 18 +- test/Element/CollectionTest.php | 96 ++++----- test/Element/ColorTest.php | 2 +- test/Element/CsrfTest.php | 10 +- test/Element/DateSelectTest.php | 18 +- test/Element/DateTest.php | 14 +- test/Element/DateTimeLocalTest.php | 6 +- test/Element/DateTimeSelectTest.php | 18 +- test/Element/DateTimeTest.php | 18 +- test/Element/EmailTest.php | 4 +- test/Element/FileTest.php | 4 +- test/Element/MonthSelectTest.php | 8 +- test/Element/MonthTest.php | 4 +- test/Element/MultiCheckboxTest.php | 18 +- test/Element/NumberTest.php | 10 +- test/Element/RadioTest.php | 6 +- test/Element/RangeTest.php | 4 +- test/Element/SearchTest.php | 2 +- test/Element/SelectTest.php | 30 +-- test/Element/TelTest.php | 8 +- test/Element/TimeTest.php | 6 +- test/Element/UrlTest.php | 2 +- test/Element/WeekTest.php | 4 +- test/ElementFactoryTest.php | 2 +- test/ElementTest.php | 62 +++--- test/FactoryTest.php | 56 ++--- test/FieldsetTest.php | 94 ++++---- test/FormAbstractServiceFactoryTest.php | 22 +- test/FormElementManagerFactoryTest.php | 16 +- test/FormElementManagerTest.php | 34 +-- test/FormFactoryAwareTraitTest.php | 2 +- test/FormTest.php | 202 +++++++++--------- test/InputFilterProviderFieldsetTest.php | 6 +- .../FormCreatesCollectionInputFilterTest.php | 2 +- test/Integration/ServiceManagerTest.php | 13 +- test/LabelAwareTraitTest.php | 32 +-- test/TestAsset/Entity/Orphan.php | 2 +- test/TestAsset/Entity/Product.php | 2 +- test/TestAsset/FieldsetWithDependency.php | 2 +- test/TestAsset/HydratorStrategyEntityA.php | 2 +- test/View/Helper/AbstractCommonTestCase.php | 14 +- test/View/Helper/AbstractHelperTest.php | 16 +- test/View/Helper/Captcha/DumbTest.php | 16 +- test/View/Helper/Captcha/FigletTest.php | 10 +- test/View/Helper/Captcha/ImageTest.php | 10 +- test/View/Helper/Captcha/ReCaptchaTest.php | 8 +- .../Helper/File/FormFileApcProgressTest.php | 2 +- .../File/FormFileSessionProgressTest.php | 2 +- .../File/FormFileUploadProgressTest.php | 2 +- test/View/Helper/FormButtonTest.php | 44 ++-- test/View/Helper/FormCaptchaTest.php | 10 +- test/View/Helper/FormCheckboxTest.php | 16 +- test/View/Helper/FormCollectionTest.php | 66 +++--- test/View/Helper/FormColorTest.php | 12 +- test/View/Helper/FormDateSelectTest.php | 18 +- test/View/Helper/FormDateTest.php | 10 +- test/View/Helper/FormDateTimeLocalTest.php | 12 +- test/View/Helper/FormDateTimeSelectTest.php | 18 +- test/View/Helper/FormDateTimeTest.php | 12 +- test/View/Helper/FormElementErrorsTest.php | 22 +- test/View/Helper/FormElementTest.php | 16 +- test/View/Helper/FormEmailTest.php | 12 +- test/View/Helper/FormFileTest.php | 2 +- test/View/Helper/FormHiddenTest.php | 12 +- test/View/Helper/FormImageTest.php | 14 +- test/View/Helper/FormInputTest.php | 26 +-- test/View/Helper/FormLabelTest.php | 42 ++-- test/View/Helper/FormMonthSelectTest.php | 18 +- test/View/Helper/FormMonthTest.php | 12 +- test/View/Helper/FormMultiCheckboxTest.php | 62 +++--- test/View/Helper/FormNumberTest.php | 12 +- test/View/Helper/FormPasswordTest.php | 12 +- test/View/Helper/FormRadioTest.php | 28 +-- test/View/Helper/FormRangeTest.php | 12 +- test/View/Helper/FormResetTest.php | 14 +- test/View/Helper/FormRowTest.php | 86 ++++---- test/View/Helper/FormSearchTest.php | 12 +- test/View/Helper/FormSelectTest.php | 54 ++--- test/View/Helper/FormSubmitTest.php | 14 +- test/View/Helper/FormTelTest.php | 12 +- test/View/Helper/FormTest.php | 18 +- test/View/Helper/FormTextTest.php | 12 +- test/View/Helper/FormTextareaTest.php | 16 +- test/View/Helper/FormTimeTest.php | 12 +- test/View/Helper/FormUrlTest.php | 12 +- test/View/Helper/FormWeekTest.php | 12 +- test/View/Helper/MissingIntlExtensionTest.php | 6 +- 98 files changed, 922 insertions(+), 915 deletions(-) diff --git a/src/Annotation/BuilderAbstractFactory.php b/src/Annotation/BuilderAbstractFactory.php index b848c9478..761735043 100644 --- a/src/Annotation/BuilderAbstractFactory.php +++ b/src/Annotation/BuilderAbstractFactory.php @@ -120,7 +120,7 @@ private function injectListeners(array $config, EventManagerInterface $events, C * * Also injects the factory with the InputFilterManager if present. */ - private function injectFactory(Factory $factory, ContainerInterface $container) + private function injectFactory(Factory $factory, ContainerInterface $container): void { $factory->setFormElementManager($container->get('FormElementManager')); diff --git a/src/Fieldset.php b/src/Fieldset.php index 4249a6909..c491d3cbb 100644 --- a/src/Fieldset.php +++ b/src/Fieldset.php @@ -451,7 +451,7 @@ public function getObject() * * @param string $allowObjectBindingClass */ - public function setAllowedObjectBindingClass($allowObjectBindingClass) + public function setAllowedObjectBindingClass($allowObjectBindingClass): void { $this->allowedObjectBindingClass = $allowObjectBindingClass; } diff --git a/src/Form.php b/src/Form.php index eb982bcc6..fefcff5dc 100644 --- a/src/Form.php +++ b/src/Form.php @@ -3,6 +3,7 @@ namespace Laminas\Form; use ArrayAccess; +use ArrayObject; use Laminas\Form\Element\Collection; use Laminas\Hydrator\HydratorInterface; use Laminas\InputFilter\CollectionInputFilter; @@ -618,7 +619,7 @@ public function getValidationGroup() * @param array $data * @param array $validationGroup */ - protected function prepareValidationGroup(Fieldset $formOrFieldset, array $data, array &$validationGroup) + protected function prepareValidationGroup(Fieldset $formOrFieldset, array $data, array &$validationGroup): void { foreach ($validationGroup as $key => &$value) { if (! $formOrFieldset->has($key)) { @@ -943,6 +944,7 @@ public function wrapElements() * {@inheritDoc} * * @param bool $onlyBase + * @param ArrayObject|array $data */ public function populateValues($data, $onlyBase = false) { diff --git a/src/FormAbstractServiceFactory.php b/src/FormAbstractServiceFactory.php index 4f0bd1616..efe36e56e 100644 --- a/src/FormAbstractServiceFactory.php +++ b/src/FormAbstractServiceFactory.php @@ -122,6 +122,7 @@ protected function getFormFactory(ContainerInterface $container) * attaches the FilterManager and ValidatorManager to it. * * @param array $config + * @return void */ protected function marshalInputFilter(array &$config, ContainerInterface $container, Factory $formFactory) { diff --git a/src/FormElementManager.php b/src/FormElementManager.php index dc2008a0a..d03c02ad0 100644 --- a/src/FormElementManager.php +++ b/src/FormElementManager.php @@ -307,6 +307,7 @@ class FormElementManager extends AbstractPluginManager * Inject the factory to any element that implements FormFactoryAwareInterface * * @param mixed $instance Instance to inspect and optionally inject. + * @return void */ public function injectFactory(ContainerInterface $container, $instance) { @@ -328,7 +329,7 @@ public function injectFactory(ContainerInterface $container, $instance) * * @param mixed $instance Instance to inspect and optionally initialize. */ - public function callElementInit(ContainerInterface $container, $instance) + public function callElementInit(ContainerInterface $container, $instance): void { if ($instance instanceof InitializableInterface) { $instance->init(); diff --git a/src/InputFilterProviderFieldset.php b/src/InputFilterProviderFieldset.php index f3c6e98af..48c8b87dc 100644 --- a/src/InputFilterProviderFieldset.php +++ b/src/InputFilterProviderFieldset.php @@ -20,7 +20,7 @@ public function getInputFilterSpecification(): array return $this->filterSpec; } - public function setInputFilterSpecification(iterable $filterSpec) + public function setInputFilterSpecification(iterable $filterSpec): void { if ($filterSpec instanceof Traversable) { $filterSpec = ArrayUtils::iteratorToArray($filterSpec); diff --git a/src/View/Helper/AbstractHelper.php b/src/View/Helper/AbstractHelper.php index a4d9319e3..dd089bf70 100644 --- a/src/View/Helper/AbstractHelper.php +++ b/src/View/Helper/AbstractHelper.php @@ -524,7 +524,7 @@ public function addTranslatableAttribute($attribute) * * @param string $attribute */ - public static function addDefaultTranslatableAttribute($attribute) + public static function addDefaultTranslatableAttribute($attribute): void { self::$defaultTranslatableHtmlAttributes[$attribute] = true; } @@ -547,7 +547,7 @@ public function addTranslatableAttributePrefix($prefix) * * @param string $prefix */ - public static function addDefaultTranslatableAttributePrefix($prefix) + public static function addDefaultTranslatableAttributePrefix($prefix): void { self::$defaultTranslatableHtmlAttributePrefixes[] = $prefix; } diff --git a/src/View/Helper/FormElementErrors.php b/src/View/Helper/FormElementErrors.php index c1ffaa0a8..b8743fbdf 100644 --- a/src/View/Helper/FormElementErrors.php +++ b/src/View/Helper/FormElementErrors.php @@ -214,7 +214,7 @@ private function flattenMessagesWithTranslator(array $messages) $translator = $this->getTranslator(); $textDomain = $this->getTranslatorTextDomain(); $messagesToPrint = []; - $messageCallback = static function ($item) use (&$messagesToPrint, $translator, $textDomain) { + $messageCallback = static function ($item) use (&$messagesToPrint, $translator, $textDomain): void { $messagesToPrint[] = $translator->translate($item, $textDomain); }; array_walk_recursive($messages, $messageCallback); diff --git a/test/Annotation/AbstractBuilderTestCase.php b/test/Annotation/AbstractBuilderTestCase.php index 8106e5d66..e798574a0 100644 --- a/test/Annotation/AbstractBuilderTestCase.php +++ b/test/Annotation/AbstractBuilderTestCase.php @@ -34,7 +34,7 @@ protected function setUp(): void abstract protected function createBuilder(): Annotation\AbstractBuilder; - public function testCanCreateFormFromStandardEntity() + public function testCanCreateFormFromStandardEntity(): void { $entity = new TestAsset\Annotation\Entity(); $builder = $this->createBuilder(); @@ -71,7 +71,7 @@ public function testCanCreateFormFromStandardEntity() $this->assertCount(1, $password->getValidatorChain()); } - public function testCanCreateFormWithClassAnnotations() + public function testCanCreateFormWithClassAnnotations(): void { $entity = new TestAsset\Annotation\ClassEntity(); $builder = $this->createBuilder(); @@ -98,7 +98,7 @@ public function testCanCreateFormWithClassAnnotations() $this->assertSame(['omit', 'keep'], $form->getValidationGroup()); } - public function testComplexEntityCreationWithPriorities() + public function testComplexEntityCreationWithPriorities(): void { $entity = new TestAsset\Annotation\ComplexEntity(); $builder = $this->createBuilder(); @@ -128,7 +128,7 @@ public function testComplexEntityCreationWithPriorities() $this->assertInstanceOf(ObjectPropertyHydrator::class, $hydrator); } - public function testFieldsetOrder() + public function testFieldsetOrder(): void { $entity = new TestAsset\Annotation\FieldsetOrderEntity(); $builder = $this->createBuilder(); @@ -141,7 +141,7 @@ public function testFieldsetOrder() $this->assertSame($element, $first, 'Test is element ' . $first->getName()); } - public function testFieldsetOrderWithPreserve() + public function testFieldsetOrderWithPreserve(): void { $entity = new TestAsset\Annotation\FieldsetOrderEntity(); $builder = $this->createBuilder(); @@ -155,7 +155,7 @@ public function testFieldsetOrderWithPreserve() $this->assertSame($fieldset, $first, 'Test is element ' . $first->getName()); } - public function testCanRetrieveOnlyFormSpecification() + public function testCanRetrieveOnlyFormSpecification(): void { $entity = new TestAsset\Annotation\ComplexEntity(); $builder = $this->createBuilder(); @@ -163,7 +163,7 @@ public function testCanRetrieveOnlyFormSpecification() $this->assertInstanceOf('ArrayObject', $spec); } - public function testAllowsExtensionOfEntities() + public function testAllowsExtensionOfEntities(): void { $entity = new TestAsset\Annotation\ExtendedEntity(); $builder = $this->createBuilder(); @@ -182,7 +182,7 @@ public function testAllowsExtensionOfEntities() $this->assertEquals($expected, $test); } - public function testAllowsSpecifyingFormAndElementTypes() + public function testAllowsSpecifyingFormAndElementTypes(): void { $entity = new TestAsset\Annotation\TypedEntity(); $builder = $this->createBuilder(); @@ -193,7 +193,7 @@ public function testAllowsSpecifyingFormAndElementTypes() $this->assertInstanceOf(\LaminasTest\Form\TestAsset\Annotation\Element::class, $element); } - public function testAllowsComposingChildEntities() + public function testAllowsComposingChildEntities(): void { $entity = new TestAsset\Annotation\EntityComposingAnEntity(); $builder = $this->createBuilder(); @@ -213,7 +213,7 @@ public function testAllowsComposingChildEntities() $this->assertTrue($composed->has('password')); } - public function testAllowsComposingMultipleChildEntities() + public function testAllowsComposingMultipleChildEntities(): void { $entity = new TestAsset\Annotation\EntityComposingMultipleEntities(); $builder = $this->createBuilder(); @@ -234,7 +234,7 @@ public function testAllowsComposingMultipleChildEntities() * @param string $childName * @group issue-7108 */ - public function testOptionsAnnotationAndComposedObjectAnnotation($childName) + public function testOptionsAnnotationAndComposedObjectAnnotation($childName): void { $entity = new TestAsset\Annotation\EntityUsingComposedObjectAndOptions(); $builder = $this->createBuilder(); @@ -264,7 +264,7 @@ public function provideOptionsAnnotationAndComposedObjectAnnotation() * @param string $childName * @group issue-7108 */ - public function testOptionsAnnotationAndComposedObjectAnnotationNoneCollection($childName) + public function testOptionsAnnotationAndComposedObjectAnnotationNoneCollection($childName): void { $entity = new TestAsset\Annotation\EntityUsingComposedObjectAndOptions(); $builder = $this->createBuilder(); @@ -287,7 +287,7 @@ public function provideOptionsAnnotationAndComposedObjectAnnotationNoneCollectio yield ['childTheFourth']; } - public function testCanHandleOptionsAnnotation() + public function testCanHandleOptionsAnnotation(): void { $entity = new TestAsset\Annotation\EntityUsingOptions(); $builder = $this->createBuilder(); @@ -305,7 +305,7 @@ public function testCanHandleOptionsAnnotation() $this->assertEquals(['class' => 'label'], $username->getLabelAttributes()); } - public function testCanHandleHydratorArrayAnnotation() + public function testCanHandleHydratorArrayAnnotation(): void { $entity = new TestAsset\Annotation\EntityWithHydratorArray(); $builder = $this->createBuilder(); @@ -316,7 +316,7 @@ public function testCanHandleHydratorArrayAnnotation() $this->assertFalse($hydrator->getUnderscoreSeparatedKeys()); } - public function testAllowTypeAsElementNameInInputFilter() + public function testAllowTypeAsElementNameInInputFilter(): void { $entity = new TestAsset\Annotation\EntityWithTypeAsElementName(); $builder = $this->createBuilder(); @@ -327,7 +327,7 @@ public function testAllowTypeAsElementNameInInputFilter() $this->assertInstanceOf(Element::class, $element); } - public function testAllowEmptyInput() + public function testAllowEmptyInput(): void { $entity = new TestAsset\Annotation\SampleEntity(); $builder = $this->createBuilder(); @@ -338,7 +338,7 @@ public function testAllowEmptyInput() $this->assertTrue($sampleinput->allowEmpty()); } - public function testContinueIfEmptyInput() + public function testContinueIfEmptyInput(): void { $entity = new TestAsset\Annotation\SampleEntity(); $builder = $this->createBuilder(); @@ -350,7 +350,7 @@ public function testContinueIfEmptyInput() $this->assertTrue($sampleinput->continueIfEmpty()); } - public function testInputNotRequiredByDefault() + public function testInputNotRequiredByDefault(): void { $entity = new TestAsset\Annotation\SampleEntity(); $builder = $this->createBuilder(); @@ -360,7 +360,7 @@ public function testInputNotRequiredByDefault() $this->assertFalse($sampleinput->isRequired()); } - public function testInstanceElementAnnotation() + public function testInstanceElementAnnotation(): void { $entity = new TestAsset\Annotation\EntityUsingInstanceProperty(); $builder = $this->createBuilder(); @@ -375,7 +375,7 @@ public function testInstanceElementAnnotation() $this->assertFalse($hydrator->getUnderscoreSeparatedKeys()); } - public function testInputFilterInputAnnotation() + public function testInputFilterInputAnnotation(): void { $entity = new TestAsset\Annotation\EntityWithInputFilterInput(); $builder = $this->createBuilder(); @@ -395,7 +395,7 @@ public function testInputFilterInputAnnotation() /** * @group issue-6753 */ - public function testInputFilterAnnotationAllowsComposition() + public function testInputFilterAnnotationAllowsComposition(): void { $entity = new TestAsset\Annotation\EntityWithInputFilterAnnotation(); $builder = $this->createBuilder(); @@ -404,7 +404,7 @@ public function testInputFilterAnnotationAllowsComposition() $this->assertCount(2, $inputFilter->get('username')->getValidatorChain()); } - public function testLegacyComposedObjectAnnotation() + public function testLegacyComposedObjectAnnotation(): void { $this->expectDeprecation(); $this->expectDeprecationMessageMatches('/Passing a single array .* is deprecated/'); @@ -413,7 +413,7 @@ public function testLegacyComposedObjectAnnotation() $form = $builder->createForm($entity); } - public function testLegacyStyleFilterAnnotations() + public function testLegacyStyleFilterAnnotations(): void { $this->expectDeprecation(); $this->expectDeprecationMessageMatches('/Passing a single array .* is deprecated/'); @@ -422,7 +422,7 @@ public function testLegacyStyleFilterAnnotations() $form = $builder->createForm($entity); } - public function testLegacyStyleHydratorAnnotations() + public function testLegacyStyleHydratorAnnotations(): void { $this->expectDeprecation(); $this->expectDeprecationMessageMatches('/Passing a single array .* is deprecated/'); @@ -431,7 +431,7 @@ public function testLegacyStyleHydratorAnnotations() $form = $builder->createForm($entity); } - public function testLegacyStyleValidatorAnnotations() + public function testLegacyStyleValidatorAnnotations(): void { $this->expectDeprecation(); $this->expectDeprecationMessageMatches('/Passing a single array .* is deprecated/'); diff --git a/test/Annotation/BuilderAbstractFactoryTest.php b/test/Annotation/BuilderAbstractFactoryTest.php index 5cb4fe14a..1ce6f3b88 100644 --- a/test/Annotation/BuilderAbstractFactoryTest.php +++ b/test/Annotation/BuilderAbstractFactoryTest.php @@ -21,7 +21,7 @@ class BuilderAbstractFactoryTest extends TestCase { use ProphecyTrait; - public function testFactoryReturnsAnnotationBuilder() + public function testFactoryReturnsAnnotationBuilder(): void { $container = $this->prophesize(ContainerInterface::class); $events = $this->prophesize(EventManagerInterface::class); @@ -47,7 +47,7 @@ public function testFactoryReturnsAnnotationBuilder() ); } - public function testFactoryReturnsAttributeBuilderForPhp8() + public function testFactoryReturnsAttributeBuilderForPhp8(): void { if (PHP_MAJOR_VERSION < 8) { $this->markTestSkipped('Can only create attribute builder for PHP >= 8.0.'); @@ -77,7 +77,7 @@ public function testFactoryReturnsAttributeBuilderForPhp8() ); } - public function testFactoryReturnsNoAttributeBuilderForPhp7() + public function testFactoryReturnsNoAttributeBuilderForPhp7(): void { if (PHP_MAJOR_VERSION >= 8) { $this->markTestSkipped('Should only throw exceptions when creating attribute builder in PHP < 8.0.'); @@ -98,7 +98,7 @@ public function testFactoryReturnsNoAttributeBuilderForPhp7() $factory($container->reveal(), 'FormAttributeBuilder'); } - public function testFactoryCanSetPreserveDefinedOrderFlagFromConfiguration() + public function testFactoryCanSetPreserveDefinedOrderFlagFromConfiguration(): void { $container = $this->prophesize(ContainerInterface::class); $events = $this->prophesize(EventManagerInterface::class); @@ -120,7 +120,7 @@ public function testFactoryCanSetPreserveDefinedOrderFlagFromConfiguration() $this->assertTrue($builder->preserveDefinedOrder(), 'Preserve defined order was not set correctly'); } - public function testFactoryAllowsAttachingListenersFromConfiguration() + public function testFactoryAllowsAttachingListenersFromConfiguration(): void { $container = $this->prophesize(ContainerInterface::class); $events = $this->prophesize(EventManagerInterface::class); @@ -147,7 +147,7 @@ public function testFactoryAllowsAttachingListenersFromConfiguration() $factory($container->reveal(), AnnotationBuilder::class); } - public function testFactoryThrowsExceptionWhenAttachingInvalidListeners() + public function testFactoryThrowsExceptionWhenAttachingInvalidListeners(): void { $container = $this->prophesize(ContainerInterface::class); $events = $this->prophesize(EventManagerInterface::class); diff --git a/test/Element/CaptchaTest.php b/test/Element/CaptchaTest.php index 369740931..72343fda5 100644 --- a/test/Element/CaptchaTest.php +++ b/test/Element/CaptchaTest.php @@ -16,13 +16,13 @@ class CaptchaTest extends TestCase { - public function testCaptchaIsUndefinedByDefault() + public function testCaptchaIsUndefinedByDefault(): void { $element = new CaptchaElement(); $this->assertNull($element->getCaptcha()); } - public function testCaptchaIsMutable() + public function testCaptchaIsMutable(): void { $element = new CaptchaElement(); @@ -46,14 +46,14 @@ public function testCaptchaIsMutable() $this->assertInstanceOf(Dumb::class, $element->getCaptcha()); } - public function testCaptchaWithNullRaisesException() + public function testCaptchaWithNullRaisesException(): void { $element = new CaptchaElement(); $this->expectException(InvalidArgumentException::class); $element->setCaptcha(null); } - public function testSettingCaptchaSetsCaptchaAttribute() + public function testSettingCaptchaSetsCaptchaAttribute(): void { $element = new CaptchaElement(); $captcha = new Captcha\Dumb(); @@ -61,7 +61,7 @@ public function testSettingCaptchaSetsCaptchaAttribute() $this->assertSame($captcha, $element->getCaptcha()); } - public function testCreatingCaptchaElementViaFormFactoryWillCreateCaptcha() + public function testCreatingCaptchaElementViaFormFactoryWillCreateCaptcha(): void { $factory = new Factory(); $element = $factory->createElement([ @@ -78,7 +78,7 @@ public function testCreatingCaptchaElementViaFormFactoryWillCreateCaptcha() $this->assertInstanceOf(Dumb::class, $captcha); } - public function testProvidesInputSpecificationThatIncludesCaptchaAsValidator() + public function testProvidesInputSpecificationThatIncludesCaptchaAsValidator(): void { $element = new CaptchaElement(); $captcha = new Captcha\Dumb(); @@ -94,7 +94,7 @@ public function testProvidesInputSpecificationThatIncludesCaptchaAsValidator() /** * @group issue-3446 */ - public function testAllowsPassingTraversableOptionsToConstructor() + public function testAllowsPassingTraversableOptionsToConstructor(): void { $options = new TestAsset\IteratorAggregate(new ArrayIterator([ 'captcha' => [ diff --git a/test/Element/CheckboxTest.php b/test/Element/CheckboxTest.php index cceb3bc33..b8d9bd06e 100644 --- a/test/Element/CheckboxTest.php +++ b/test/Element/CheckboxTest.php @@ -11,14 +11,14 @@ class CheckboxTest extends TestCase { - public function testProvidesValidDefaultValues() + public function testProvidesValidDefaultValues(): void { $element = new CheckboxElement(); $this->assertEquals('1', $element->getCheckedValue()); $this->assertEquals('0', $element->getUncheckedValue()); } - public function testProvidesInputSpecificationThatIncludesValidatorsBasedOnAttributes() + public function testProvidesInputSpecificationThatIncludesValidatorsBasedOnAttributes(): void { $element = new CheckboxElement(); @@ -45,13 +45,13 @@ public function testProvidesInputSpecificationThatIncludesValidatorsBasedOnAttri } } - public function testIsChecked() + public function testIsChecked(): void { $element = new CheckboxElement(); $this->assertEquals(false, $element->isChecked()); } - public function testSetAttributeValue() + public function testSetAttributeValue(): void { $element = new CheckboxElement(); $this->assertEquals(false, $element->isChecked()); @@ -76,7 +76,7 @@ public function testSetAttributeValue() $this->assertEquals(false, $element->isChecked()); } - public function testIntegerCheckedValue() + public function testIntegerCheckedValue(): void { $element = new CheckboxElement(); $element->setCheckedValue('123'); @@ -87,7 +87,7 @@ public function testIntegerCheckedValue() $this->assertEquals(true, $element->isChecked()); } - public function testSetChecked() + public function testSetChecked(): void { $element = new CheckboxElement(); $this->assertEquals(false, $element->isChecked()); @@ -99,7 +99,7 @@ public function testSetChecked() $this->assertEquals(false, $element->isChecked()); } - public function testCheckWithCheckedValue() + public function testCheckWithCheckedValue(): void { $element = new CheckboxElement(); $this->assertEquals(false, $element->isChecked()); @@ -108,7 +108,7 @@ public function testCheckWithCheckedValue() $this->assertEquals(true, $element->isChecked()); } - public function testSetOptions() + public function testSetOptions(): void { $element = new CheckboxElement(); $element->setOptions([ @@ -121,7 +121,7 @@ public function testSetOptions() $this->assertEquals('bar', $element->getOption('checked_value')); } - public function testSetOptionsTraversable() + public function testSetOptionsTraversable(): void { $element = new CheckboxElement(); $element->setOptions(new CustomTraversable([ diff --git a/test/Element/CollectionTest.php b/test/Element/CollectionTest.php index 948f66949..726f30940 100644 --- a/test/Element/CollectionTest.php +++ b/test/Element/CollectionTest.php @@ -57,7 +57,7 @@ protected function setUp(): void parent::setUp(); } - public function testCanRetrieveDefaultPlaceholder() + public function testCanRetrieveDefaultPlaceholder(): void { $collection = $this->form->get('colors'); $this->assertInstanceOf(Collection::class, $collection); @@ -65,7 +65,7 @@ public function testCanRetrieveDefaultPlaceholder() $this->assertEquals('__index__', $placeholder); } - public function testCannotAllowNewElementsIfAllowAddIsFalse() + public function testCannotAllowNewElementsIfAllowAddIsFalse(): void { $collection = $this->form->get('colors'); $this->assertInstanceOf(Collection::class, $collection); @@ -87,7 +87,7 @@ public function testCannotAllowNewElementsIfAllowAddIsFalse() $collection->populateValues($data); } - public function testCanAddNewElementsIfAllowAddIsTrue() + public function testCanAddNewElementsIfAllowAddIsTrue(): void { $collection = $this->form->get('colors'); $this->assertInstanceOf(Collection::class, $collection); @@ -107,7 +107,7 @@ public function testCanAddNewElementsIfAllowAddIsTrue() $this->assertCount(3, $collection->getElements()); } - public function testCanRemoveElementsIfAllowRemoveIsTrue() + public function testCanRemoveElementsIfAllowRemoveIsTrue(): void { $collection = $this->form->get('colors'); $this->assertInstanceOf(Collection::class, $collection); @@ -127,7 +127,7 @@ public function testCanRemoveElementsIfAllowRemoveIsTrue() $this->assertCount(1, $collection->getElements()); } - public function testCanReplaceElementsIfAllowAddAndAllowRemoveIsTrue() + public function testCanReplaceElementsIfAllowAddAndAllowRemoveIsTrue(): void { $collection = $this->form->get('colors'); $this->assertInstanceOf(Collection::class, $collection); @@ -148,7 +148,7 @@ public function testCanReplaceElementsIfAllowAddAndAllowRemoveIsTrue() $this->assertCount(2, $collection->getElements()); } - public function testCanValidateFormWithCollectionWithoutTemplate() + public function testCanValidateFormWithCollectionWithoutTemplate(): void { $this->form->setData([ 'colors' => [ @@ -174,7 +174,7 @@ public function testCanValidateFormWithCollectionWithoutTemplate() $this->assertEquals(true, $this->form->isValid()); } - public function testCannotValidateFormWithCollectionWithBadColor() + public function testCannotValidateFormWithCollectionWithBadColor(): void { $this->form->setData([ 'colors' => [ @@ -202,7 +202,7 @@ public function testCannotValidateFormWithCollectionWithBadColor() $this->assertArrayHasKey('colors', $messages); } - public function testCannotValidateFormWithCollectionWithBadFieldsetField() + public function testCannotValidateFormWithCollectionWithBadFieldsetField(): void { $this->form->setData([ 'colors' => [ @@ -231,7 +231,7 @@ public function testCannotValidateFormWithCollectionWithBadFieldsetField() $this->assertArrayHasKey('fieldsets', $messages); } - public function testCanValidateFormWithCollectionWithTemplate() + public function testCanValidateFormWithCollectionWithTemplate(): void { $collection = $this->form->get('colors'); $this->assertInstanceOf(Collection::class, $collection); @@ -266,7 +266,7 @@ public function testCanValidateFormWithCollectionWithTemplate() $this->assertEquals(true, $this->form->isValid()); } - public function testThrowExceptionIfThereAreLessElementsAndAllowRemoveNotAllowed() + public function testThrowExceptionIfThereAreLessElementsAndAllowRemoveNotAllowed(): void { $this->expectException(DomainException::class); @@ -297,7 +297,7 @@ public function testThrowExceptionIfThereAreLessElementsAndAllowRemoveNotAllowed $this->form->isValid(); } - public function testCanValidateLessThanSpecifiedCount() + public function testCanValidateLessThanSpecifiedCount(): void { $collection = $this->form->get('colors'); $this->assertInstanceOf(Collection::class, $collection); @@ -326,7 +326,7 @@ public function testCanValidateLessThanSpecifiedCount() $this->assertEquals(true, $this->form->isValid()); } - public function testSetOptions() + public function testSetOptions(): void { $collection = $this->form->get('colors'); $element = new Element('foo'); @@ -347,7 +347,7 @@ public function testSetOptions() $this->assertEquals('foo', $collection->getOption('template_placeholder')); } - public function testSetOptionsTraversable() + public function testSetOptionsTraversable(): void { $collection = $this->form->get('colors'); $element = new Element('foo'); @@ -368,14 +368,14 @@ public function testSetOptionsTraversable() $this->assertEquals('foo', $collection->getOption('template_placeholder')); } - public function testSetObjectNullRaisesException() + public function testSetObjectNullRaisesException(): void { $collection = $this->form->get('colors'); $this->expectException(InvalidArgumentException::class); $collection->setObject(null); } - public function testSetTargetElementNullRaisesException() + public function testSetTargetElementNullRaisesException(): void { $collection = $this->form->get('colors'); $this->assertInstanceOf(Collection::class, $collection); @@ -383,7 +383,7 @@ public function testSetTargetElementNullRaisesException() $collection->setTargetElement(null); } - public function testGetTargetElement() + public function testGetTargetElement(): void { $collection = $this->form->get('colors'); $this->assertInstanceOf(Collection::class, $collection); @@ -393,7 +393,7 @@ public function testGetTargetElement() $this->assertInstanceOf(Element::class, $collection->getTargetElement()); } - public function testExtractFromObjectDoesntTouchOriginalObject() + public function testExtractFromObjectDoesntTouchOriginalObject(): void { $form = new Form(); $form->setHydrator( @@ -442,7 +442,7 @@ class_exists(ClassMethodsHydrator::class) $this->assertSame($originalObjectHash, $objectAfterExtractHash); } - public function testDoesNotCreateNewObjects() + public function testDoesNotCreateNewObjects(): void { if (! extension_loaded('intl')) { // Required by \Laminas\I18n\Validator\IsFloat @@ -487,7 +487,7 @@ class_exists(ClassMethodsHydrator::class) $this->assertSame($categories[1], $cat2); } - public function testCreatesNewObjectsIfSpecified() + public function testCreatesNewObjectsIfSpecified(): void { if (! extension_loaded('intl')) { // Required by \Laminas\I18n\Validator\IsFloat @@ -541,7 +541,7 @@ class_exists(ClassMethodsHydrator::class) * @group issue-6585 * @group issue-6614 */ - public function testAddingCollectionElementAfterBind() + public function testAddingCollectionElementAfterBind(): void { $form = new Form(); $form->setHydrator( @@ -584,7 +584,7 @@ class_exists(ObjectPropertyHydrator::class) * @group issue-6585 * @group issue-6614 */ - public function testDoesNotCreateNewObjectsWhenUsingNestedCollections() + public function testDoesNotCreateNewObjectsWhenUsingNestedCollections(): void { $addressesFieldset = new AddressFieldset(); $addressesFieldset->setHydrator( @@ -638,7 +638,7 @@ class_exists(ObjectPropertyHydrator::class) $this->assertSame($phone, $phones[0]); } - public function testDoNotCreateExtraFieldsetOnMultipleBind() + public function testDoNotCreateExtraFieldsetOnMultipleBind(): void { $form = new Form(); $this->productFieldset->setHydrator( @@ -672,14 +672,14 @@ class_exists(ObjectPropertyHydrator::class) $this->assertSame(count($categories), iterator_count($form->get('product')->get('categories')->getIterator())); } - public function testExtractDefaultIsEmptyArray() + public function testExtractDefaultIsEmptyArray(): void { $collection = $this->form->get('fieldsets'); $this->assertInstanceOf(Collection::class, $collection); $this->assertEquals([], $collection->extract()); } - public function testExtractThroughTargetElementHydrator() + public function testExtractThroughTargetElementHydrator(): void { $collection = $this->form->get('fieldsets'); $this->assertInstanceOf(Collection::class, $collection); @@ -693,7 +693,7 @@ public function testExtractThroughTargetElementHydrator() $this->assertEquals($expected, $collection->extract()); } - public function testExtractMaintainsTargetElementObject() + public function testExtractMaintainsTargetElementObject(): void { $collection = $this->form->get('fieldsets'); $this->assertInstanceOf(Collection::class, $collection); @@ -710,7 +710,7 @@ public function testExtractMaintainsTargetElementObject() $this->assertSame($expected, $test); } - public function testExtractThroughCustomHydrator() + public function testExtractThroughCustomHydrator(): void { $collection = $this->form->get('fieldsets'); $this->assertInstanceOf(Collection::class, $collection); @@ -733,7 +733,7 @@ public function testExtractThroughCustomHydrator() $this->assertEquals($expected, $collection->extract()); } - public function testExtractFromTraversable() + public function testExtractFromTraversable(): void { $collection = $this->form->get('fieldsets'); $this->assertInstanceOf(Collection::class, $collection); @@ -750,7 +750,7 @@ public function testExtractFromTraversable() $this->assertEquals($expected, $collection->extract()); } - public function testValidateData() + public function testValidateData(): void { $myFieldset = new Fieldset(); $myFieldset->add([ @@ -781,7 +781,7 @@ public function testValidateData() $this->assertEmpty($myForm->getMessages()); } - protected function prepareForExtract(Collection $collection) + protected function prepareForExtract(Collection $collection): void { $targetElement = $collection->getTargetElement(); $this->assertInstanceOf(FieldsetInterface::class, $targetElement); @@ -808,7 +808,7 @@ class_exists(ObjectPropertyHydrator::class) ]); } - public function testCollectionCanBindObjectAndPopulateAndExtractNestedFieldsets() + public function testCollectionCanBindObjectAndPopulateAndExtractNestedFieldsets(): void { $productFieldset = new ProductFieldset(); $productFieldset->setHydrator( @@ -944,7 +944,7 @@ class_exists(ObjectPropertyHydrator::class) } } - public function testExtractFromTraversableImplementingToArrayThroughCollectionHydrator() + public function testExtractFromTraversableImplementingToArrayThroughCollectionHydrator(): void { $collection = $this->form->get('fieldsets'); $this->assertInstanceOf(Collection::class, $collection); @@ -962,7 +962,7 @@ public function testExtractFromTraversableImplementingToArrayThroughCollectionHy $this->assertEquals($expected, $collection->extract()); } - public function testExtractFromTraversableImplementingToArrayThroughTargetElementHydrator() + public function testExtractFromTraversableImplementingToArrayThroughTargetElementHydrator(): void { $collection = $this->form->get('fieldsets'); $this->assertInstanceOf(Collection::class, $collection); @@ -988,7 +988,7 @@ class_exists(ArraySerializableHydrator::class) $this->assertEquals($expected, $collection->extract()); } - protected function prepareForExtractWithCustomTraversable(Collection $collection) + protected function prepareForExtractWithCustomTraversable(Collection $collection): void { $obj2 = new ArrayModel(); $obj2->exchangeArray(['foo' => 'foo_value_1', 'bar' => 'bar_value_1', 'foobar' => 'foobar_value_1']); @@ -1001,7 +1001,7 @@ protected function prepareForExtractWithCustomTraversable(Collection $collection $collection->setObject($traversable); } - public function testPopulateValuesWithFirstKeyGreaterThanZero() + public function testPopulateValuesWithFirstKeyGreaterThanZero(): void { $inputData = [ 1 => ['name' => 'black'], @@ -1034,7 +1034,7 @@ public function testPopulateValuesWithFirstKeyGreaterThanZero() $this->assertCount(count($formCollection->getFieldsets()), $inputData); } - public function testCanRemoveAllElementsIfAllowRemoveIsTrue() + public function testCanRemoveAllElementsIfAllowRemoveIsTrue(): void { $collection = $this->form->get('colors'); $this->assertInstanceOf(Collection::class, $collection); @@ -1053,7 +1053,7 @@ public function testCanRemoveAllElementsIfAllowRemoveIsTrue() $this->assertCount(0, $collection->getElements()); } - public function testCanBindObjectMultipleNestedFieldsets() + public function testCanBindObjectMultipleNestedFieldsets(): void { $productFieldset = new ProductFieldset(); $productFieldset->setHydrator( @@ -1143,7 +1143,7 @@ class_exists(ObjectPropertyHydrator::class) } } - public function testNestedCollections() + public function testNestedCollections(): void { // @see https://github.com/zendframework/zf2/issues/5640 $addressesFieldeset = new AddressFieldset(); @@ -1224,7 +1224,7 @@ class_exists(ObjectPropertyHydrator::class) } } - public function testSetDataOnFormPopulatesCollection() + public function testSetDataOnFormPopulatesCollection(): void { $form = new Form(); $form->add([ @@ -1250,7 +1250,7 @@ public function testSetDataOnFormPopulatesCollection() } } - public function testSettingSomeDataButNoneForCollectionReturnsSpecifiedNumberOfElementsAfterPrepare() + public function testSettingSomeDataButNoneForCollectionReturnsSpecifiedNumberOfElementsAfterPrepare(): void { $form = new Form(); $form->add(new Element\Text('input')); @@ -1274,7 +1274,7 @@ public function testSettingSomeDataButNoneForCollectionReturnsSpecifiedNumberOfE $this->assertCount(2, $form->get('names')); } - public function testMininumLenghtIsMaintanedWhenSettingASmallerCollection() + public function testMininumLenghtIsMaintanedWhenSettingASmallerCollection(): void { $arrayCollection = [ new Element\Color(), @@ -1292,7 +1292,7 @@ public function testMininumLenghtIsMaintanedWhenSettingASmallerCollection() * @group issue-6263 * @group issue-6518 */ - public function testCollectionProperlyHandlesAddingObjectsOfTypeElementInterface() + public function testCollectionProperlyHandlesAddingObjectsOfTypeElementInterface(): void { $form = new Form('test'); $text = new Element\Text('text'); @@ -1324,7 +1324,7 @@ public function testCollectionProperlyHandlesAddingObjectsOfTypeElementInterface * @group issue-6263 * @group issue-6518 */ - public function testCollectionShouldSilentlyIgnorePopulatingFieldsetWithDisallowedObject() + public function testCollectionShouldSilentlyIgnorePopulatingFieldsetWithDisallowedObject(): void { $mainFieldset = new Fieldset(); $mainFieldset->add(new Element\Text('test')); @@ -1371,7 +1371,7 @@ class_exists(ObjectPropertyHydrator::class) * @group issue-6263 * @group issue-6298 */ - public function testCanHydrateObject() + public function testCanHydrateObject(): void { $form = $this->form; $object = new ArrayObject(); @@ -1387,7 +1387,7 @@ public function testCanHydrateObject() $this->assertCount(1, $object['colors']); } - public function testCanRemoveMultipleElements() + public function testCanRemoveMultipleElements(): void { $collection = $this->form->get('colors'); $this->assertInstanceOf(Collection::class, $collection); @@ -1405,7 +1405,7 @@ public function testCanRemoveMultipleElements() $this->assertCount(1, $collection->getElements()); } - public function testGetErrorMessagesForInvalidCollectionElements() + public function testGetErrorMessagesForInvalidCollectionElements(): void { // Configure InputFilter $inputFilter = $this->form->getInputFilter(); @@ -1443,7 +1443,7 @@ public function testGetErrorMessagesForInvalidCollectionElements() /** * @see https://github.com/zendframework/zend-form/pull/230 */ - public function testNullTargetElementShouldResultInEmptyData() + public function testNullTargetElementShouldResultInEmptyData(): void { $form = new Form(); @@ -1476,7 +1476,7 @@ public function testNullTargetElementShouldResultInEmptyData() ); } - public function testPopulateValuesTraversable() + public function testPopulateValuesTraversable(): void { $data = new CustomTraversable(['blue', 'green']); @@ -1488,7 +1488,7 @@ public function testPopulateValuesTraversable() $this->assertCount(2, $collection->getElements()); } - public function testSetObjectTraversable() + public function testSetObjectTraversable(): void { $collection = $this->form->get('fieldsets'); $this->assertInstanceOf(Collection::class, $collection); diff --git a/test/Element/ColorTest.php b/test/Element/ColorTest.php index bc8b0a9ba..0146efcda 100644 --- a/test/Element/ColorTest.php +++ b/test/Element/ColorTest.php @@ -10,7 +10,7 @@ class ColorTest extends TestCase { - public function testProvidesInputSpecificationThatIncludesValidatorsBasedOnAttributes() + public function testProvidesInputSpecificationThatIncludesValidatorsBasedOnAttributes(): void { $element = new ColorElement(); diff --git a/test/Element/CsrfTest.php b/test/Element/CsrfTest.php index 406fc0701..6d2c2244f 100644 --- a/test/Element/CsrfTest.php +++ b/test/Element/CsrfTest.php @@ -11,7 +11,7 @@ class CsrfTest extends TestCase { - public function testProvidesInputSpecificationThatIncludesValidatorsBasedOnAttributes() + public function testProvidesInputSpecificationThatIncludesValidatorsBasedOnAttributes(): void { $element = new CsrfElement('foo'); @@ -35,7 +35,7 @@ public function testProvidesInputSpecificationThatIncludesValidatorsBasedOnAttri } } - public function testAllowSettingCustomCsrfValidator() + public function testAllowSettingCustomCsrfValidator(): void { $element = new CsrfElement('foo'); $validatorMock = $this->createMock(Csrf::class); @@ -43,7 +43,7 @@ public function testAllowSettingCustomCsrfValidator() $this->assertEquals($validatorMock, $element->getCsrfValidator()); } - public function testAllowSettingCsrfValidatorOptions() + public function testAllowSettingCsrfValidatorOptions(): void { $element = new CsrfElement('foo'); $element->setCsrfValidatorOptions(['timeout' => 777]); @@ -52,7 +52,7 @@ public function testAllowSettingCsrfValidatorOptions() $this->assertEquals(777, $validator->getTimeout()); } - public function testAllowSettingCsrfOptions() + public function testAllowSettingCsrfOptions(): void { $element = new CsrfElement('foo'); $element->setOptions([ @@ -67,7 +67,7 @@ public function testAllowSettingCsrfOptions() $this->assertEquals('MySalt', $validator->getSalt()); } - public function testSetOptionsTraversable() + public function testSetOptionsTraversable(): void { $element = new CsrfElement('foo'); $element->setOptions(new CustomTraversable([ diff --git a/test/Element/DateSelectTest.php b/test/Element/DateSelectTest.php index 2e539148c..5af03e260 100644 --- a/test/Element/DateSelectTest.php +++ b/test/Element/DateSelectTest.php @@ -13,7 +13,7 @@ class DateSelectTest extends TestCase { - public function testProvidesInputSpecificationThatIncludesValidatorsBasedOnAttributes() + public function testProvidesInputSpecificationThatIncludesValidatorsBasedOnAttributes(): void { $element = new DateSelectElement(); @@ -37,7 +37,7 @@ public function testProvidesInputSpecificationThatIncludesValidatorsBasedOnAttri } } - public function testCanSetDateFromDateTime() + public function testCanSetDateFromDateTime(): void { $element = new DateSelectElement(); $element->setValue(new DateTime('2012-09-24')); @@ -47,7 +47,7 @@ public function testCanSetDateFromDateTime() $this->assertEquals('24', $element->getDayElement()->getValue()); } - public function testCanSetDateFromString() + public function testCanSetDateFromString(): void { $element = new DateSelectElement(); $element->setValue('2012-09-24'); @@ -57,7 +57,7 @@ public function testCanSetDateFromString() $this->assertEquals('24', $element->getDayElement()->getValue()); } - public function testCanGetValue() + public function testCanGetValue(): void { $element = new DateSelectElement(); $element->setValue(new DateTime('2012-09-24')); @@ -65,21 +65,21 @@ public function testCanGetValue() $this->assertEquals('2012-09-24', $element->getValue()); } - public function testThrowsOnInvalidValue() + public function testThrowsOnInvalidValue(): void { $element = new DateSelectElement(); $this->expectException(InvalidArgumentException::class); $element->setValue('hello world'); } - public function testConstructAcceptsDayAttributes() + public function testConstructAcceptsDayAttributes(): void { $sut = new DateSelectElement('dateSelect', ['day_attributes' => ['class' => 'test']]); $dayAttributes = $sut->getDayAttributes(); $this->assertEquals('test', $dayAttributes['class']); } - public function testConstructAcceptsTraversableOptions() + public function testConstructAcceptsTraversableOptions(): void { $options = new CustomTraversable([ 'day_attributes' => ['class' => 'test'], @@ -89,7 +89,7 @@ public function testConstructAcceptsTraversableOptions() $this->assertSame('test', $sut->getDayAttributes()['class']); } - public function testSetOptionsAcceptsTraversableObject() + public function testSetOptionsAcceptsTraversableObject(): void { $options = new CustomTraversable([ 'day_attributes' => ['class' => 'test'], @@ -103,7 +103,7 @@ public function testSetOptionsAcceptsTraversableObject() /** * @group issue-7114 */ - public function testValueSetterReturnsSameObjectType() + public function testValueSetterReturnsSameObjectType(): void { $element = new DateSelectElement(); diff --git a/test/Element/DateTest.php b/test/Element/DateTest.php index b31e0e0d3..957e895a6 100644 --- a/test/Element/DateTest.php +++ b/test/Element/DateTest.php @@ -45,7 +45,7 @@ protected function tearDown(): void date_default_timezone_set($this->originaltimezone); } - public function testProvidesDefaultInputSpecification() + public function testProvidesDefaultInputSpecification(): void { $element = new DateElement('foo'); @@ -72,7 +72,7 @@ public function testProvidesDefaultInputSpecification() } } - public function testProvidesInputSpecificationThatIncludesValidatorsBasedOnAttributes() + public function testProvidesInputSpecificationThatIncludesValidatorsBasedOnAttributes(): void { $element = new DateElement('foo'); $element->setAttributes([ @@ -115,7 +115,7 @@ public function testProvidesInputSpecificationThatIncludesValidatorsBasedOnAttri } } - public function testValueReturnedFromComposedDateTimeIsRfc3339FullDateFormat() + public function testValueReturnedFromComposedDateTimeIsRfc3339FullDateFormat(): void { $element = new DateElement('foo'); $date = new DateTime(); @@ -124,7 +124,7 @@ public function testValueReturnedFromComposedDateTimeIsRfc3339FullDateFormat() $this->assertEquals($date->format('Y-m-d'), $value); } - public function testCorrectFormatPassedToDateValidator() + public function testCorrectFormatPassedToDateValidator(): void { $element = new DateElement('foo'); $element->setAttributes([ @@ -147,7 +147,7 @@ public function testCorrectFormatPassedToDateValidator() /** * @group issue-6245 */ - public function testStepValidatorIgnoresDaylightSavings() + public function testStepValidatorIgnoresDaylightSavings(): void { date_default_timezone_set('Europe/London'); @@ -163,7 +163,7 @@ public function testStepValidatorIgnoresDaylightSavings() } } - public function testFailsWithInvalidMinSpecification() + public function testFailsWithInvalidMinSpecification(): void { $element = new DateElement('foo'); $element->setAttributes([ @@ -176,7 +176,7 @@ public function testFailsWithInvalidMinSpecification() $element->getInputSpecification(); } - public function testFailsWithInvalidMaxSpecification() + public function testFailsWithInvalidMaxSpecification(): void { $element = new DateElement('foo'); $element->setAttributes([ diff --git a/test/Element/DateTimeLocalTest.php b/test/Element/DateTimeLocalTest.php index 527650bf8..f3cdb323d 100644 --- a/test/Element/DateTimeLocalTest.php +++ b/test/Element/DateTimeLocalTest.php @@ -15,7 +15,7 @@ class DateTimeLocalTest extends TestCase { - public function testProvidesInputSpecificationThatIncludesValidatorsBasedOnAttributes() + public function testProvidesInputSpecificationThatIncludesValidatorsBasedOnAttributes(): void { $element = new DateTimeLocalElement('foo'); $element->setAttributes([ @@ -57,7 +57,7 @@ public function testProvidesInputSpecificationThatIncludesValidatorsBasedOnAttri } } - public function testFailsWithInvalidMinSpecification() + public function testFailsWithInvalidMinSpecification(): void { $element = new DateTimeLocalElement('foo'); $element->setAttributes([ @@ -70,7 +70,7 @@ public function testFailsWithInvalidMinSpecification() $element->getInputSpecification(); } - public function testFailsWithInvalidMaxSpecification() + public function testFailsWithInvalidMaxSpecification(): void { $element = new DateTimeLocalElement('foo'); $element->setAttributes([ diff --git a/test/Element/DateTimeSelectTest.php b/test/Element/DateTimeSelectTest.php index f5ab7da07..4be9fd3c7 100644 --- a/test/Element/DateTimeSelectTest.php +++ b/test/Element/DateTimeSelectTest.php @@ -13,7 +13,7 @@ class DateTimeSelectTest extends TestCase { - public function testProvidesInputSpecificationThatIncludesValidatorsBasedOnAttributes() + public function testProvidesInputSpecificationThatIncludesValidatorsBasedOnAttributes(): void { $element = new DateTimeSelectElement(); @@ -37,7 +37,7 @@ public function testProvidesInputSpecificationThatIncludesValidatorsBasedOnAttri } } - public function testInputSpecificationFilterIfSecondNotProvided() + public function testInputSpecificationFilterIfSecondNotProvided(): void { $element = new DateTimeSelectElement('test'); $factory = new InputFilterFactory(); @@ -56,7 +56,7 @@ public function testInputSpecificationFilterIfSecondNotProvided() $this->assertTrue($inputFilter->isValid()); } - public function testCanSetDateFromDateTime() + public function testCanSetDateFromDateTime(): void { $element = new DateTimeSelectElement(); $element->setValue(new DateTime('2012-09-24 03:04:05')); @@ -69,7 +69,7 @@ public function testCanSetDateFromDateTime() $this->assertEquals('05', $element->getSecondElement()->getValue()); } - public function testCanSetDateFromString() + public function testCanSetDateFromString(): void { $element = new DateTimeSelectElement(); $element->setValue('2012-09-24 03:04:05'); @@ -82,7 +82,7 @@ public function testCanSetDateFromString() $this->assertEquals('05', $element->getSecondElement()->getValue()); } - public function testCanGetValue() + public function testCanGetValue(): void { $element = new DateTimeSelectElement(); $element->setValue(new DateTime('2012-09-24 03:04:05')); @@ -90,14 +90,14 @@ public function testCanGetValue() $this->assertEquals('2012-09-24 03:04:05', $element->getValue()); } - public function testThrowsOnInvalidValue() + public function testThrowsOnInvalidValue(): void { $element = new DateTimeSelectElement(); $this->expectException(InvalidArgumentException::class); $element->setValue('hello world'); } - public function testUseDefaultValueForSecondsIfNotProvided() + public function testUseDefaultValueForSecondsIfNotProvided(): void { $element = new DateTimeSelectElement(); $element->setValue([ @@ -116,7 +116,7 @@ public function testUseDefaultValueForSecondsIfNotProvided() $this->assertEquals('00', $element->getSecondElement()->getValue()); } - public function testCloningPreservesCorrectValues() + public function testCloningPreservesCorrectValues(): void { $element = new DateTimeSelectElement(); $element->setValue(new DateTime('2014-01-02 03:04:05')); @@ -131,7 +131,7 @@ public function testCloningPreservesCorrectValues() $this->assertEquals('05', $cloned->getSecondElement()->getValue()); } - public function testPassingNullValueToSetValueWillUseCurrentDate() + public function testPassingNullValueToSetValueWillUseCurrentDate(): void { $now = new DateTime(); $element = new DateTimeSelectElement(); diff --git a/test/Element/DateTimeTest.php b/test/Element/DateTimeTest.php index 566b7efbf..af9447cff 100644 --- a/test/Element/DateTimeTest.php +++ b/test/Element/DateTimeTest.php @@ -17,7 +17,7 @@ class DateTimeTest extends TestCase { - public function testProvidesInputSpecificationThatIncludesValidatorsBasedOnAttributes() + public function testProvidesInputSpecificationThatIncludesValidatorsBasedOnAttributes(): void { $element = new DateTimeElement('foo'); $element->setAttributes([ @@ -59,7 +59,7 @@ public function testProvidesInputSpecificationThatIncludesValidatorsBasedOnAttri } } - public function testProvidesInputSpecificationThatIncludesDateTimeFormatterBasedOnAttributes() + public function testProvidesInputSpecificationThatIncludesDateTimeFormatterBasedOnAttributes(): void { $element = new DateTimeElement('foo'); $element->setFormat(DateTime::W3C); @@ -80,13 +80,13 @@ public function testProvidesInputSpecificationThatIncludesDateTimeFormatterBased } } - public function testUsesBrowserFormatByDefault() + public function testUsesBrowserFormatByDefault(): void { $element = new DateTimeElement('foo'); $this->assertEquals(DateTimeElement::DATETIME_FORMAT, $element->getFormat()); } - public function testSpecifyingADateTimeValueWillReturnBrowserFormattedStringByDefault() + public function testSpecifyingADateTimeValueWillReturnBrowserFormattedStringByDefault(): void { $date = new DateTime(); $element = new DateTimeElement('foo'); @@ -94,7 +94,7 @@ public function testSpecifyingADateTimeValueWillReturnBrowserFormattedStringByDe $this->assertEquals($date->format(DateTimeElement::DATETIME_FORMAT), $element->getValue()); } - public function testValueIsFormattedAccordingToFormatInElement() + public function testValueIsFormattedAccordingToFormatInElement(): void { $date = new DateTime(); $element = new DateTimeElement('foo'); @@ -103,7 +103,7 @@ public function testValueIsFormattedAccordingToFormatInElement() $this->assertEquals($date->format($date::RFC2822), $element->getValue()); } - public function testCanRetrieveDateTimeObjectByPassingBooleanFalseToGetValue() + public function testCanRetrieveDateTimeObjectByPassingBooleanFalseToGetValue(): void { $date = new DateTime(); $element = new DateTimeElement('foo'); @@ -111,7 +111,7 @@ public function testCanRetrieveDateTimeObjectByPassingBooleanFalseToGetValue() $this->assertSame($date, $element->getValue(false)); } - public function testSetFormatWithOptions() + public function testSetFormatWithOptions(): void { $format = 'Y-m-d'; $element = new DateTimeElement('foo'); @@ -122,7 +122,7 @@ public function testSetFormatWithOptions() $this->assertSame($format, $element->getFormat()); } - public function testFailsWithInvalidMinSpecification() + public function testFailsWithInvalidMinSpecification(): void { $element = new DateTimeElement('foo'); $element->setAttributes([ @@ -135,7 +135,7 @@ public function testFailsWithInvalidMinSpecification() $element->getInputSpecification(); } - public function testFailsWithInvalidMaxSpecification() + public function testFailsWithInvalidMaxSpecification(): void { $element = new DateTimeElement('foo'); $element->setAttributes([ diff --git a/test/Element/EmailTest.php b/test/Element/EmailTest.php index 259b5517b..69b5729f3 100644 --- a/test/Element/EmailTest.php +++ b/test/Element/EmailTest.php @@ -11,7 +11,7 @@ class EmailTest extends TestCase { - public function testProvidesInputSpecificationThatIncludesDefaultValidators() + public function testProvidesInputSpecificationThatIncludesDefaultValidators(): void { $element = new EmailElement(); @@ -40,7 +40,7 @@ public function emailAttributesDataProvider(): array /** * @dataProvider emailAttributesDataProvider */ - public function testProvidesInputSpecificationBasedOnAttributes(array $attributes, array $expectedValidators) + public function testProvidesInputSpecificationBasedOnAttributes(array $attributes, array $expectedValidators): void { $element = new EmailElement(); $element->setAttributes($attributes); diff --git a/test/Element/FileTest.php b/test/Element/FileTest.php index 9359b6d5e..e20baecea 100644 --- a/test/Element/FileTest.php +++ b/test/Element/FileTest.php @@ -10,7 +10,7 @@ class FileTest extends TestCase { - public function testProvidesDefaultInputSpecification() + public function testProvidesDefaultInputSpecification(): void { $element = new FileElement('foo'); $this->assertEquals('file', $element->getAttribute('type')); @@ -21,7 +21,7 @@ public function testProvidesDefaultInputSpecification() $this->assertInstanceOf(FileInput::class, $input); } - public function testWillAddFileEnctypeAttributeToForm() + public function testWillAddFileEnctypeAttributeToForm(): void { $file = new FileElement('foo'); $formMock = $this->createMock(Form::class); diff --git a/test/Element/MonthSelectTest.php b/test/Element/MonthSelectTest.php index 5b9626854..6cef91742 100644 --- a/test/Element/MonthSelectTest.php +++ b/test/Element/MonthSelectTest.php @@ -11,7 +11,7 @@ class MonthSelectTest extends TestCase { - public function testProvidesInputSpecificationThatIncludesValidatorsBasedOnAttributes() + public function testProvidesInputSpecificationThatIncludesValidatorsBasedOnAttributes(): void { $element = new MonthSelectElement(); @@ -58,7 +58,7 @@ public function monthValuesDataProvider() /** * @dataProvider monthValuesDataProvider */ - public function testMonthValidation(string $value, bool $expected) + public function testMonthValidation(string $value, bool $expected): void { $element = new MonthSelectElement('foo'); $inputSpec = $element->getInputSpecification(); @@ -67,7 +67,7 @@ public function testMonthValidation(string $value, bool $expected) $this->assertEquals($expected, $monthValidator->isValid($value)); } - public function testCanSetMonthFromDateTime() + public function testCanSetMonthFromDateTime(): void { $element = new MonthSelectElement(); $element->setValue(new DateTime('2012-09')); @@ -76,7 +76,7 @@ public function testCanSetMonthFromDateTime() $this->assertEquals('09', $element->getMonthElement()->getValue()); } - public function testCanGetValue() + public function testCanGetValue(): void { $element = new MonthSelectElement(); $element->setValue(new DateTime('2012-09')); diff --git a/test/Element/MonthTest.php b/test/Element/MonthTest.php index 205089be6..1cd1cddf7 100644 --- a/test/Element/MonthTest.php +++ b/test/Element/MonthTest.php @@ -14,7 +14,7 @@ class MonthTest extends TestCase { - public function testProvidesInputSpecificationThatIncludesValidatorsBasedOnAttributes() + public function testProvidesInputSpecificationThatIncludesValidatorsBasedOnAttributes(): void { $element = new MonthElement('foo'); $element->setAttributes([ @@ -73,7 +73,7 @@ public function monthValuesDataProvider(): array /** * @dataProvider monthValuesDataProvider */ - public function testHTML5MonthValidation(string $value, bool $expected) + public function testHTML5MonthValidation(string $value, bool $expected): void { $element = new MonthElement('foo'); $inputSpec = $element->getInputSpecification(); diff --git a/test/Element/MultiCheckboxTest.php b/test/Element/MultiCheckboxTest.php index 0aa4ffce5..dc016ed8e 100644 --- a/test/Element/MultiCheckboxTest.php +++ b/test/Element/MultiCheckboxTest.php @@ -20,7 +20,7 @@ public function useHiddenAttributeDataProvider(): array /** * @dataProvider useHiddenAttributeDataProvider */ - public function testProvidesInputSpecificationThatIncludesValidatorsBasedOnAttributes(bool $useHiddenElement) + public function testProvidesInputSpecificationThatIncludesValidatorsBasedOnAttributes(bool $useHiddenElement): void { $element = new MultiCheckboxElement(); $options = [ @@ -77,7 +77,7 @@ public function multiCheckboxOptionsDataProvider(): array /** * @dataProvider multiCheckboxOptionsDataProvider */ - public function testInArrayValidationOfOptions(array $valueTests, array $options) + public function testInArrayValidationOfOptions(array $valueTests, array $options): void { $element = new MultiCheckboxElement('my-checkbox'); $element->setAttributes([ @@ -96,7 +96,7 @@ public function testInArrayValidationOfOptions(array $valueTests, array $options * * @dataProvider multiCheckboxOptionsDataProvider */ - public function testInArrayValidatorHaystakIsUpdated(array $valueTests, array $options) + public function testInArrayValidatorHaystakIsUpdated(array $valueTests, array $options): void { $element = new MultiCheckboxElement('my-checkbox'); $inputSpec = $element->getInputSpecification(); @@ -109,7 +109,7 @@ public function testInArrayValidatorHaystakIsUpdated(array $valueTests, array $o $this->assertCount(count($options), $haystack); } - public function testAttributeType() + public function testAttributeType(): void { $element = new MultiCheckboxElement(); $attributes = $element->getAttributes(); @@ -118,7 +118,7 @@ public function testAttributeType() $this->assertEquals('multi_checkbox', $attributes['type']); } - public function testSetOptionsOptions() + public function testSetOptionsOptions(): void { $element = new MultiCheckboxElement(); $element->setOptions([ @@ -129,7 +129,7 @@ public function testSetOptionsOptions() $this->assertEquals(['foo' => 'bar'], $element->getOption('options')); } - public function testDisableInputSpecification() + public function testDisableInputSpecification(): void { $element = new MultiCheckboxElement(); $element->setValueOptions([ @@ -143,7 +143,7 @@ public function testDisableInputSpecification() $this->assertArrayNotHasKey('validators', $inputSpec); } - public function testUnsetValueOption() + public function testUnsetValueOption(): void { $element = new MultiCheckboxElement(); $element->setValueOptions([ @@ -157,7 +157,7 @@ public function testUnsetValueOption() $this->assertArrayNotHasKey('Option 2', $valueOptions); } - public function testUnsetUndefinedValueOption() + public function testUnsetUndefinedValueOption(): void { $element = new MultiCheckboxElement(); $element->setValueOptions([ @@ -171,7 +171,7 @@ public function testUnsetUndefinedValueOption() $this->assertArrayNotHasKey('Option Undefined', $valueOptions); } - public function testOptionValueinSelectedOptions() + public function testOptionValueinSelectedOptions(): void { $element = new MultiCheckboxElement(); $element->setValueOptions([ diff --git a/test/Element/NumberTest.php b/test/Element/NumberTest.php index 876deddac..2a1660a55 100644 --- a/test/Element/NumberTest.php +++ b/test/Element/NumberTest.php @@ -13,7 +13,7 @@ class NumberTest extends TestCase { - public function testProvidesInputSpecificationWithDefaultAttributes() + public function testProvidesInputSpecificationWithDefaultAttributes(): void { $element = new NumberElement(); @@ -38,7 +38,7 @@ public function testProvidesInputSpecificationWithDefaultAttributes() } } - public function testProvidesInputSpecificationThatIncludesValidatorsBasedOnAttributes() + public function testProvidesInputSpecificationThatIncludesValidatorsBasedOnAttributes(): void { $element = new NumberElement(); $element->setAttributes([ @@ -79,7 +79,7 @@ public function testProvidesInputSpecificationThatIncludesValidatorsBasedOnAttri } } - public function testFalseInclusiveValidatorBasedOnAttributes() + public function testFalseInclusiveValidatorBasedOnAttributes(): void { $element = new NumberElement(); $element->setAttributes([ @@ -96,7 +96,7 @@ public function testFalseInclusiveValidatorBasedOnAttributes() } } - public function testDefaultInclusiveTrueatValidatorWhenInclusiveIsNotSetOnAttributes() + public function testDefaultInclusiveTrueatValidatorWhenInclusiveIsNotSetOnAttributes(): void { $element = new NumberElement(); $element->setAttributes([ @@ -112,7 +112,7 @@ public function testDefaultInclusiveTrueatValidatorWhenInclusiveIsNotSetOnAttrib } } - public function testOnlyCastableDecimalsAreAccepted() + public function testOnlyCastableDecimalsAreAccepted(): void { $element = new NumberElement(); diff --git a/test/Element/RadioTest.php b/test/Element/RadioTest.php index 2fcbfe882..e764ce83c 100644 --- a/test/Element/RadioTest.php +++ b/test/Element/RadioTest.php @@ -18,7 +18,7 @@ public function useHiddenAttributeDataProvider(): array /** * @dataProvider useHiddenAttributeDataProvider */ - public function testProvidesInputSpecificationThatIncludesValidatorsBasedOnAttributes(bool $useHiddenElement) + public function testProvidesInputSpecificationThatIncludesValidatorsBasedOnAttributes(bool $useHiddenElement): void { $element = new RadioElement(); $options = [ @@ -67,7 +67,7 @@ public function radioOptionsDataProvider(): array /** * @dataProvider radioOptionsDataProvider */ - public function testInArrayValidationOfOptions(array $valueTests, array $options) + public function testInArrayValidationOfOptions(array $valueTests, array $options): void { $element = new RadioElement('my-radio'); $element->setAttributes([ @@ -82,7 +82,7 @@ public function testInArrayValidationOfOptions(array $valueTests, array $options } } - public function testDisableInputSpecification() + public function testDisableInputSpecification(): void { $element = new RadioElement(); $element->setValueOptions([ diff --git a/test/Element/RangeTest.php b/test/Element/RangeTest.php index 357885d6b..9ff07b200 100644 --- a/test/Element/RangeTest.php +++ b/test/Element/RangeTest.php @@ -14,7 +14,7 @@ class RangeTest extends TestCase { - public function testProvidesInputSpecificationWithDefaultAttributes() + public function testProvidesInputSpecificationWithDefaultAttributes(): void { if (! extension_loaded('intl')) { // Required by \Laminas\I18n\Validator\IsFloat @@ -54,7 +54,7 @@ public function testProvidesInputSpecificationWithDefaultAttributes() } } - public function testProvidesInputSpecificationThatIncludesValidator() + public function testProvidesInputSpecificationThatIncludesValidator(): void { if (! extension_loaded('intl')) { // Required by \Laminas\I18n\Validator\IsFloat diff --git a/test/Element/SearchTest.php b/test/Element/SearchTest.php index ada9fc5e0..15848cba5 100644 --- a/test/Element/SearchTest.php +++ b/test/Element/SearchTest.php @@ -7,7 +7,7 @@ class SearchTest extends TestCase { - public function testType() + public function testType(): void { $element = new Search('test'); diff --git a/test/Element/SelectTest.php b/test/Element/SelectTest.php index f880f445f..edb5c59bb 100644 --- a/test/Element/SelectTest.php +++ b/test/Element/SelectTest.php @@ -13,7 +13,7 @@ class SelectTest extends TestCase { - public function testProvidesInputSpecificationForSingleSelect() + public function testProvidesInputSpecificationForSingleSelect(): void { $element = new SelectElement(); $element->setValueOptions([ @@ -35,7 +35,7 @@ public function testProvidesInputSpecificationForSingleSelect() } } - public function testValidateWorksForNestedSelectElementWithSimpleNaming() + public function testValidateWorksForNestedSelectElementWithSimpleNaming(): void { $element = new SelectElement(); $element->setValueOptions([ @@ -56,7 +56,7 @@ public function testValidateWorksForNestedSelectElementWithSimpleNaming() $this->assertFalse($inArrayValidator->isValid('Option 5')); } - public function testValidateWorksForNestedSelectElementWithExplicitNaming() + public function testValidateWorksForNestedSelectElementWithExplicitNaming(): void { $element = new SelectElement(); $element->setValueOptions([ @@ -79,7 +79,7 @@ public function testValidateWorksForNestedSelectElementWithExplicitNaming() $this->assertFalse($inArrayValidator->isValid('Option 5')); } - public function testProvidesInputSpecificationForMultipleSelect() + public function testProvidesInputSpecificationForMultipleSelect(): void { $element = new SelectElement(); $element->setAttributes([ @@ -134,7 +134,7 @@ public function selectOptionsDataProvider(): array /** * @dataProvider selectOptionsDataProvider */ - public function testInArrayValidationOfOptions(array $valueTests, array $options) + public function testInArrayValidationOfOptions(array $valueTests, array $options): void { $element = new SelectElement('my-select'); $element->setValueOptions($options); @@ -153,7 +153,7 @@ public function testInArrayValidationOfOptions(array $valueTests, array $options * * @dataProvider selectOptionsDataProvider */ - public function testInArrayValidatorHaystakIsUpdated(array $valueTests, array $options) + public function testInArrayValidatorHaystakIsUpdated(array $valueTests, array $options): void { $element = new SelectElement('my-select'); $inputSpec = $element->getInputSpecification(); @@ -166,13 +166,13 @@ public function testInArrayValidatorHaystakIsUpdated(array $valueTests, array $o $this->assertCount(count($options), $haystack); } - public function testOptionsHasArrayOnConstruct() + public function testOptionsHasArrayOnConstruct(): void { $element = new SelectElement(); $this->assertIsArray($element->getValueOptions()); } - public function testDeprecateOptionsInAttributes() + public function testDeprecateOptionsInAttributes(): void { $element = new SelectElement(); $valueOptions = [ @@ -187,7 +187,7 @@ public function testDeprecateOptionsInAttributes() $this->assertEquals($valueOptions, $element->getValueOptions()); } - public function testSetOptionsArray() + public function testSetOptionsArray(): void { $element = new SelectElement(); $element->setOptions([ @@ -200,7 +200,7 @@ public function testSetOptionsArray() $this->assertEquals(['baz' => 'foo'], $element->getOption('empty_option')); } - public function testSetOptionsTraversable() + public function testSetOptionsTraversable(): void { $element = new SelectElement(); $element->setOptions(new CustomTraversable([ @@ -213,7 +213,7 @@ public function testSetOptionsTraversable() $this->assertEquals(['baz' => 'foo'], $element->getOption('empty_option')); } - public function testDisableInputSpecification() + public function testDisableInputSpecification(): void { $element = new SelectElement(); $element->setValueOptions([ @@ -227,7 +227,7 @@ public function testDisableInputSpecification() $this->assertArrayNotHasKey('validators', $inputSpec); } - public function testUnsetValueOption() + public function testUnsetValueOption(): void { $element = new SelectElement(); $element->setValueOptions([ @@ -241,7 +241,7 @@ public function testUnsetValueOption() $this->assertArrayNotHasKey('Option 2', $valueOptions); } - public function testUnsetUndefinedValueOption() + public function testUnsetUndefinedValueOption(): void { $element = new SelectElement(); $element->setValueOptions([ @@ -255,7 +255,7 @@ public function testUnsetUndefinedValueOption() $this->assertArrayNotHasKey('Option Undefined', $valueOptions); } - public function testSetOptionsToSelectMultiple() + public function testSetOptionsToSelectMultiple(): void { $element = new SelectElement(null, [ 'label' => 'Importance', @@ -273,7 +273,7 @@ public function testSetOptionsToSelectMultiple() $this->assertEquals('empty', $element->getUnselectedValue()); } - public function testProvidesInputSpecificationForMultipleSelectWithUseHiddenElement() + public function testProvidesInputSpecificationForMultipleSelectWithUseHiddenElement(): void { $element = new SelectElement(); $element diff --git a/test/Element/TelTest.php b/test/Element/TelTest.php index 61e92460e..c973fab44 100644 --- a/test/Element/TelTest.php +++ b/test/Element/TelTest.php @@ -13,14 +13,14 @@ class TelTest extends TestCase { - public function testType() + public function testType(): void { $element = new Tel('test'); $this->assertSame('tel', $element->getAttribute('type')); } - public function testInputSpecification() + public function testInputSpecification(): void { $name = 'test'; $element = new Tel($name); @@ -38,7 +38,7 @@ public function testInputSpecification() * @param string[] $expectedFilters * @param array $inputSpec */ - private function assertInputSpecContainsFilters(array $expectedFilters, array $inputSpec) + private function assertInputSpecContainsFilters(array $expectedFilters, array $inputSpec): void { $actualFilters = array_map(static function (array $filterSpec): string { return $filterSpec['name']; @@ -50,7 +50,7 @@ private function assertInputSpecContainsFilters(array $expectedFilters, array $i /** * @param array $inputSpec */ - private function assertInputSpecContainsRegexValidator(array $inputSpec) + private function assertInputSpecContainsRegexValidator(array $inputSpec): void { $regexValidatorFound = false; foreach ($inputSpec['validators'] as $validator) { diff --git a/test/Element/TimeTest.php b/test/Element/TimeTest.php index 1964e7162..52742c092 100644 --- a/test/Element/TimeTest.php +++ b/test/Element/TimeTest.php @@ -15,7 +15,7 @@ class TimeTest extends TestCase { - public function testProvidesInputSpecificationThatIncludesValidatorsBasedOnAttributes() + public function testProvidesInputSpecificationThatIncludesValidatorsBasedOnAttributes(): void { $element = new TimeElement('foo'); $element->setAttributes([ @@ -60,7 +60,7 @@ public function testProvidesInputSpecificationThatIncludesValidatorsBasedOnAttri } } - public function testFailsWithInvalidMinSpecification() + public function testFailsWithInvalidMinSpecification(): void { $element = new TimeElement('foo'); $element->setAttributes([ @@ -73,7 +73,7 @@ public function testFailsWithInvalidMinSpecification() $element->getInputSpecification(); } - public function testFailsWithInvalidMaxSpecification() + public function testFailsWithInvalidMaxSpecification(): void { $element = new TimeElement('foo'); $element->setAttributes([ diff --git a/test/Element/UrlTest.php b/test/Element/UrlTest.php index 72393d66a..bf6c00490 100644 --- a/test/Element/UrlTest.php +++ b/test/Element/UrlTest.php @@ -10,7 +10,7 @@ class UrlTest extends TestCase { - public function testProvidesInputSpecificationThatIncludesValidatorsBasedOnAttributes() + public function testProvidesInputSpecificationThatIncludesValidatorsBasedOnAttributes(): void { $element = new UrlElement(); $element->setAttributes([ diff --git a/test/Element/WeekTest.php b/test/Element/WeekTest.php index 6000ce710..99fe60acc 100644 --- a/test/Element/WeekTest.php +++ b/test/Element/WeekTest.php @@ -14,7 +14,7 @@ class WeekTest extends TestCase { - public function testProvidesInputSpecificationThatIncludesValidatorsBasedOnAttributes() + public function testProvidesInputSpecificationThatIncludesValidatorsBasedOnAttributes(): void { $element = new WeekElement('foo'); $element->setAttributes([ @@ -72,7 +72,7 @@ public function weekValuesDataProvider(): array /** * @dataProvider weekValuesDataProvider */ - public function testHTML5WeekValidation(string $value, bool $expected) + public function testHTML5WeekValidation(string $value, bool $expected): void { $element = new WeekElement('foo'); $inputSpec = $element->getInputSpecification(); diff --git a/test/ElementFactoryTest.php b/test/ElementFactoryTest.php index 3d5546670..a37c87955 100644 --- a/test/ElementFactoryTest.php +++ b/test/ElementFactoryTest.php @@ -26,7 +26,7 @@ public function validCreationOptions(): Generator * @param mixed $creationOptions * @param array $expectedValue */ - public function testValidCreationOptions($creationOptions, array $expectedValue) + public function testValidCreationOptions($creationOptions, array $expectedValue): void { $container = $this->prophesize(ServiceLocatorInterface::class) ->willImplement(ContainerInterface::class) diff --git a/test/ElementTest.php b/test/ElementTest.php index 122153179..c766770ae 100644 --- a/test/ElementTest.php +++ b/test/ElementTest.php @@ -10,26 +10,26 @@ class ElementTest extends TestCase { - public function testAttributesAreEmptyByDefault() + public function testAttributesAreEmptyByDefault(): void { $element = new Element(); $this->assertEquals([], $element->getAttributes()); } - public function testLabelAttributesAreEmptyByDefault() + public function testLabelAttributesAreEmptyByDefault(): void { $element = new Element(); $this->assertEquals([], $element->getLabelAttributes()); } - public function testCanAddAttributesSingly() + public function testCanAddAttributesSingly(): void { $element = new Element(); $element->setAttribute('data-foo', 'bar'); $this->assertEquals('bar', $element->getAttribute('data-foo')); } - public function testCanAddManyAttributesAtOnce() + public function testCanAddManyAttributesAtOnce(): void { $element = new Element(); $attributes = [ @@ -42,7 +42,7 @@ public function testCanAddManyAttributesAtOnce() $this->assertEquals($attributes, $element->getAttributes()); } - public function testAddingAttributesMerges() + public function testAddingAttributesMerges(): void { $element = new Element(); $attributes = [ @@ -60,7 +60,7 @@ public function testAddingAttributesMerges() $this->assertEquals($expected, $element->getAttributes()); } - public function testCanClearAllAttributes() + public function testCanClearAllAttributes(): void { $element = new Element(); $attributes = [ @@ -73,7 +73,7 @@ public function testCanClearAllAttributes() $this->assertEquals([], $element->getAttributes()); } - public function testCanRemoveSingleAttribute() + public function testCanRemoveSingleAttribute(): void { $element = new Element(); $attributes = [ @@ -86,7 +86,7 @@ public function testCanRemoveSingleAttribute() $this->assertFalse($element->hasAttribute('type')); } - public function testCanRemoveMultipleAttributes() + public function testCanRemoveMultipleAttributes(): void { $element = new Element(); $attributes = [ @@ -100,27 +100,27 @@ public function testCanRemoveMultipleAttributes() $this->assertFalse($element->hasAttribute('class')); } - public function testSettingNameSetsNameAttribute() + public function testSettingNameSetsNameAttribute(): void { $element = new Element(); $element->setName('foo'); $this->assertEquals('foo', $element->getAttribute('name')); } - public function testSettingNameAttributeAllowsRetrievingName() + public function testSettingNameAttributeAllowsRetrievingName(): void { $element = new Element(); $element->setAttribute('name', 'foo'); $this->assertEquals('foo', $element->getName()); } - public function testCanPassNameToConstructor() + public function testCanPassNameToConstructor(): void { $element = new Element('foo'); $this->assertEquals('foo', $element->getName()); } - public function testCanSetCustomOptionFromConstructor() + public function testCanSetCustomOptionFromConstructor(): void { $element = new Element('foo', [ 'custom' => 'option', @@ -130,7 +130,7 @@ public function testCanSetCustomOptionFromConstructor() $this->assertEquals('option', $options['custom']); } - public function testCanSetCustomOptionFromMethod() + public function testCanSetCustomOptionFromMethod(): void { $element = new Element('foo'); $element->setOptions([ @@ -142,7 +142,7 @@ public function testCanSetCustomOptionFromMethod() $this->assertEquals('option', $options['custom']); } - public function testCanRetrieveSpecificOption() + public function testCanRetrieveSpecificOption(): void { $element = new Element('foo'); $element->setOptions([ @@ -152,7 +152,7 @@ public function testCanRetrieveSpecificOption() $this->assertEquals('option', $option); } - public function testSpecificOptionsSetLabelAttributes() + public function testSpecificOptionsSetLabelAttributes(): void { $element = new Element('foo'); $element->setOptions([ @@ -163,7 +163,7 @@ public function testSpecificOptionsSetLabelAttributes() $this->assertEquals(['bar' => 'baz'], $option); } - public function testLabelOptionsAccessors() + public function testLabelOptionsAccessors(): void { $element = new Element('foo'); $element->setOptions([ @@ -174,7 +174,7 @@ public function testLabelOptionsAccessors() $this->assertEquals(['moar' => 'foo'], $labelOptions); } - public function testCanSetSingleOptionForLabel() + public function testCanSetSingleOptionForLabel(): void { $element = new Element('foo'); $element->setOption('label', 'foo'); @@ -182,7 +182,7 @@ public function testCanSetSingleOptionForLabel() $this->assertEquals('foo', $option); } - public function testSetOptionsIsTraversable() + public function testSetOptionsIsTraversable(): void { $element = new Element('foo'); $element->setOptions(new ArrayObject(['foo' => 'bar'])); @@ -190,19 +190,19 @@ public function testSetOptionsIsTraversable() $this->assertEquals(['foo' => 'bar'], $element->getOptions()); } - public function testGetOption() + public function testGetOption(): void { $element = new Element('foo'); $this->assertNull($element->getOption('foo')); } - public function testLabelOptionsAreEmptyByDefault() + public function testLabelOptionsAreEmptyByDefault(): void { $element = new Element(); $this->assertEquals([], $element->getLabelOptions()); } - public function testLabelOptionsCanBeSetViaOptionsArray() + public function testLabelOptionsCanBeSetViaOptionsArray(): void { $element = new Element('foo'); $element->setOptions([ @@ -212,14 +212,14 @@ public function testLabelOptionsCanBeSetViaOptionsArray() $this->assertEquals('foo', $element->getLabelOption('moar')); } - public function testCanAddLabelOptionSingly() + public function testCanAddLabelOptionSingly(): void { $element = new Element(); $element->setLabelOption('foo', 'bar'); $this->assertEquals('bar', $element->getLabelOption('foo')); } - public function testCanAddManyLabelOptionsAtOnce() + public function testCanAddManyLabelOptionsAtOnce(): void { $element = new Element(); $options = [ @@ -234,7 +234,7 @@ public function testCanAddManyLabelOptionsAtOnce() } } - public function testSettingLabelOptionsMerges() + public function testSettingLabelOptionsMerges(): void { $element = new Element(); $options = [ @@ -255,7 +255,7 @@ public function testSettingLabelOptionsMerges() } } - public function testCanClearAllLabelOptions() + public function testCanClearAllLabelOptions(): void { $element = new Element(); $options = [ @@ -267,7 +267,7 @@ public function testCanClearAllLabelOptions() $this->assertEquals([], $element->getLabelOptions()); } - public function testCanRemoveSingleLabelOption() + public function testCanRemoveSingleLabelOption(): void { $element = new Element(); $options = [ @@ -279,7 +279,7 @@ public function testCanRemoveSingleLabelOption() $this->assertFalse($element->hasLabelOption('foo2')); } - public function testCanRemoveMultipleLabelOptions() + public function testCanRemoveMultipleLabelOptions(): void { $element = new Element(); $options = [ @@ -294,7 +294,7 @@ public function testCanRemoveMultipleLabelOptions() $this->assertTrue($element->hasLabelOption('foo3')); } - public function testCanAddMultipleAriaAttributes() + public function testCanAddMultipleAriaAttributes(): void { $element = new Element(); $attributes = [ @@ -309,7 +309,7 @@ public function testCanAddMultipleAriaAttributes() $this->assertTrue($element->hasAttribute('aria-orientation')); } - public function testCanRemoveMultipleAriaAttributes() + public function testCanRemoveMultipleAriaAttributes(): void { $element = new Element(); $attributes = [ @@ -325,14 +325,14 @@ public function testCanRemoveMultipleAriaAttributes() $this->assertFalse($element->hasAttribute('aria-orientation')); } - public function testHasValueGettingSetInSetValueMethod() + public function testHasValueGettingSetInSetValueMethod(): void { $element = new Element(); $element->setValue('some value'); $this->assertTrue($element->hasValue()); } - public function testHasValueIsFalseAtTheTimeOfCreation() + public function testHasValueIsFalseAtTheTimeOfCreation(): void { $element = new Element(); $this->assertFalse($element->hasValue()); diff --git a/test/FactoryTest.php b/test/FactoryTest.php index 7743ba84b..e7eeaf422 100644 --- a/test/FactoryTest.php +++ b/test/FactoryTest.php @@ -43,7 +43,7 @@ protected function setUp(): void $this->factory = new FormFactory($elementManager); } - public function testCanCreateElements() + public function testCanCreateElements(): void { $element = $this->factory->createElement([ 'name' => 'foo', @@ -60,7 +60,7 @@ public function testCanCreateElements() $this->assertEquals('my.form.text', $element->getAttribute('data-js-type')); } - public function testCanCreateFieldsets() + public function testCanCreateFieldsets(): void { $fieldset = $this->factory->createFieldset([ 'name' => 'foo', @@ -79,7 +79,7 @@ public function testCanCreateFieldsets() $this->assertEquals(new Model(), $fieldset->getObject()); } - public function testCanCreateFieldsetsWithElements() + public function testCanCreateFieldsetsWithElements(): void { $fieldset = $this->factory->createFieldset([ 'name' => 'foo', @@ -152,7 +152,7 @@ public function testCanCreateFieldsetsWithElements() $this->assertEquals('bat', $test); } - public function testCanCreateNestedFieldsets() + public function testCanCreateNestedFieldsets(): void { $masterFieldset = $this->factory->createFieldset([ 'name' => 'foo', @@ -233,7 +233,7 @@ public function testCanCreateNestedFieldsets() $this->assertEquals('bat', $test); } - public function testCanCreateForms() + public function testCanCreateForms(): void { $form = $this->factory->createForm([ 'name' => 'foo', @@ -248,7 +248,7 @@ public function testCanCreateForms() $this->assertEquals(new Model(), $form->getObject()); } - public function testCanCreateFormsWithNamedInputFilters() + public function testCanCreateFormsWithNamedInputFilters(): void { $form = $this->factory->createForm([ 'name' => 'foo', @@ -259,7 +259,7 @@ public function testCanCreateFormsWithNamedInputFilters() $this->assertInstanceOf(InputFilter::class, $filter); } - public function testCanCreateFormsWithInputFilterSpecifications() + public function testCanCreateFormsWithInputFilterSpecifications(): void { $form = $this->factory->createForm([ 'name' => 'foo', @@ -318,7 +318,7 @@ public function testCanCreateFormsWithInputFilterSpecifications() } } - public function testCanCreateFormsWithInputFilterInstances() + public function testCanCreateFormsWithInputFilterInstances(): void { $filter = new InputFilter(); $form = $this->factory->createForm([ @@ -330,7 +330,7 @@ public function testCanCreateFormsWithInputFilterInstances() $this->assertSame($filter, $test); } - public function testCanCreateFormsAndSpecifyHydrator() + public function testCanCreateFormsAndSpecifyHydrator(): void { $hydratorType = class_exists(ObjectPropertyHydrator::class) ? ObjectPropertyHydrator::class @@ -345,7 +345,7 @@ public function testCanCreateFormsAndSpecifyHydrator() $this->assertInstanceOf($hydratorType, $hydrator); } - public function testCanCreateFormsAndSpecifyHydratorManagedByHydratorManager() + public function testCanCreateFormsAndSpecifyHydratorManagedByHydratorManager(): void { if (class_exists(ObjectPropertyHydrator::class)) { $hydratorShortName = 'ObjectPropertyHydrator'; @@ -366,7 +366,7 @@ public function testCanCreateFormsAndSpecifyHydratorManagedByHydratorManager() $this->assertInstanceOf($hydratorType, $hydrator); } - public function testCanCreateHydratorFromArray() + public function testCanCreateHydratorFromArray(): void { $form = $this->factory->createForm([ 'name' => 'foo', @@ -383,7 +383,7 @@ public function testCanCreateHydratorFromArray() $this->assertFalse($hydrator->getUnderscoreSeparatedKeys()); } - public function testCanCreateHydratorFromConcreteClass() + public function testCanCreateHydratorFromConcreteClass(): void { $hydratorType = class_exists(ObjectPropertyHydrator::class) ? ObjectPropertyHydrator::class @@ -399,7 +399,7 @@ public function testCanCreateHydratorFromConcreteClass() $this->assertInstanceOf($hydratorType, $hydrator); } - public function testCanCreateFormsAndSpecifyFactory() + public function testCanCreateFormsAndSpecifyFactory(): void { $form = $this->factory->createForm([ 'name' => 'foo', @@ -410,7 +410,7 @@ public function testCanCreateFormsAndSpecifyFactory() $this->assertInstanceOf(FormFactory::class, $factory); } - public function testCanCreateFactoryFromArray() + public function testCanCreateFactoryFromArray(): void { $form = $this->factory->createForm([ 'name' => 'foo', @@ -424,7 +424,7 @@ public function testCanCreateFactoryFromArray() $this->assertInstanceOf(FormFactory::class, $factory); } - public function testCanCreateFactoryFromConcreteClass() + public function testCanCreateFactoryFromConcreteClass(): void { $factory = new FormFactory(); $form = $this->factory->createForm([ @@ -437,7 +437,7 @@ public function testCanCreateFactoryFromConcreteClass() $this->assertSame($factory, $test); } - public function testCanCreateFormFromConcreteClassAndSpecifyCustomValidatorByName() + public function testCanCreateFormFromConcreteClassAndSpecifyCustomValidatorByName(): void { $validatorManager = new ValidatorPluginManager($this->services); $validatorManager->setInvokableClass('baz', Digits::class); @@ -492,7 +492,7 @@ public function testCanCreateFormFromConcreteClassAndSpecifyCustomValidatorByNam $this->assertTrue($found); } - public function testCanCreateFormFromConcreteClassWithCustomValidatorByNameAndInputFilterFactoryInConstructor() + public function testCanCreateFormFromConcreteClassWithCustomValidatorByNameAndInputFilterFactoryInConstructor(): void { $validatorManager = new ValidatorPluginManager($this->services); $validatorManager->setInvokableClass('baz', Digits::class); @@ -546,7 +546,7 @@ public function testCanCreateFormFromConcreteClassWithCustomValidatorByNameAndIn $this->assertTrue($found); } - public function testCanCreateFormWithHydratorAndInputFilterAndElementsAndFieldsets() + public function testCanCreateFormWithHydratorAndInputFilterAndElementsAndFieldsets(): void { $hydratorType = class_exists(ObjectPropertyHydrator::class) ? ObjectPropertyHydrator::class @@ -709,7 +709,7 @@ public function testCanCreateFormWithHydratorAndInputFilterAndElementsAndFieldse $this->assertInstanceOf($hydratorType, $hydrator); } - public function testCanCreateFormUsingCreate() + public function testCanCreateFormUsingCreate(): void { $form = $this->factory->create([ 'type' => \Laminas\Form\Form::class, @@ -723,7 +723,7 @@ public function testCanCreateFormUsingCreate() $this->assertEquals('get', $form->getAttribute('method')); } - public function testCanCreateFieldsetUsingCreate() + public function testCanCreateFieldsetUsingCreate(): void { $fieldset = $this->factory->create([ 'type' => Fieldset::class, @@ -741,7 +741,7 @@ public function testCanCreateFieldsetUsingCreate() $this->assertEquals('my.form.fieldset', $fieldset->getAttribute('data-js-type')); } - public function testCanCreateElementUsingCreate() + public function testCanCreateElementUsingCreate(): void { $element = $this->factory->create([ 'name' => 'foo', @@ -758,21 +758,21 @@ public function testCanCreateElementUsingCreate() $this->assertEquals('my.form.text', $element->getAttribute('data-js-type')); } - public function testAutomaticallyAddFieldsetTypeWhenCreateFieldset() + public function testAutomaticallyAddFieldsetTypeWhenCreateFieldset(): void { $fieldset = $this->factory->createFieldset(['name' => 'myFieldset']); $this->assertInstanceOf(Fieldset::class, $fieldset); $this->assertEquals('myFieldset', $fieldset->getName()); } - public function testAutomaticallyAddFormTypeWhenCreateForm() + public function testAutomaticallyAddFormTypeWhenCreateForm(): void { $form = $this->factory->createForm(['name' => 'myForm']); $this->assertInstanceOf(\Laminas\Form\Form::class, $form); $this->assertEquals('myForm', $form->getName()); } - public function testCanPullHydratorThroughServiceManager() + public function testCanPullHydratorThroughServiceManager(): void { $hydratorType = class_exists(ObjectPropertyHydrator::class) ? ObjectPropertyHydrator::class @@ -795,7 +795,7 @@ public function testCanPullHydratorThroughServiceManager() $this->assertInstanceOf($hydratorType, $fieldset->getHydrator()); } - public function testCreatedFieldsetsHaveFactoryAndFormElementManagerInjected() + public function testCreatedFieldsetsHaveFactoryAndFormElementManagerInjected(): void { $fieldset = $this->factory->createFieldset(['name' => 'myFieldset']); $this->assertInstanceOf(Fieldset::class, $fieldset); @@ -808,7 +808,7 @@ public function testCreatedFieldsetsHaveFactoryAndFormElementManagerInjected() /** * @group issue-6949 */ - public function testPrepareAndInjectWillThrowAndException() + public function testPrepareAndInjectWillThrowAndException(): void { $fieldset = $this->factory->createFieldset(['name' => 'myFieldset']); @@ -816,7 +816,7 @@ public function testPrepareAndInjectWillThrowAndException() $this->factory->configureFieldset($fieldset, ['hydrator' => 0]); } - public function testCanCreateFormWithNullElements() + public function testCanCreateFormWithNullElements(): void { $form = $this->factory->createForm([ 'name' => 'foo', @@ -843,7 +843,7 @@ public function testCanCreateFormWithNullElements() $this->assertTrue($form->has('bat')); } - public function testCanCreateWithConstructionLogicInOptions() + public function testCanCreateWithConstructionLogicInOptions(): void { $formManager = $this->factory->getFormElementManager(); $formManager->setFactory( diff --git a/test/FieldsetTest.php b/test/FieldsetTest.php index 425370411..f54fb6746 100644 --- a/test/FieldsetTest.php +++ b/test/FieldsetTest.php @@ -24,7 +24,7 @@ protected function setUp(): void $this->fieldset = new Fieldset(); } - public function populateFieldset() + public function populateFieldset(): void { $this->fieldset->add(new Element('foo')); $this->fieldset->add(new Element('bar')); @@ -83,7 +83,7 @@ public function getMessages(): array ]; } - public function testExtractOnAnEmptyRelationship() + public function testExtractOnAnEmptyRelationship(): void { $form = new TestAsset\FormCollection(); $form->populateValues(['fieldsets' => []]); @@ -91,7 +91,7 @@ public function testExtractOnAnEmptyRelationship() $this->addToAssertionCount(1); } - public function testExtractOnAnEmptyTraversable() + public function testExtractOnAnEmptyTraversable(): void { $form = new TestAsset\FormCollection(); $form->populateValues(new ArrayObject(['fieldsets' => new ArrayObject()])); @@ -99,7 +99,7 @@ public function testExtractOnAnEmptyTraversable() $this->addToAssertionCount(1); } - public function testTraversableAcceptedValueForFieldset() + public function testTraversableAcceptedValueForFieldset(): void { $subValue = new ArrayObject(['field' => 'value']); $subFieldset = new TestAsset\ValueStoringFieldset('subFieldset'); @@ -108,18 +108,18 @@ public function testTraversableAcceptedValueForFieldset() $this->assertEquals($subValue, $subFieldset->getStoredValue()); } - public function testFieldsetIsEmptyByDefault() + public function testFieldsetIsEmptyByDefault(): void { $this->assertCount(0, $this->fieldset); } - public function testCanAddElementsToFieldset() + public function testCanAddElementsToFieldset(): void { $this->fieldset->add(new Element('foo')); $this->assertCount(1, $this->fieldset); } - public function testCanSetCustomOptionFromConstructor() + public function testCanSetCustomOptionFromConstructor(): void { $fieldset = new Fieldset('foo', [ 'custom' => 'option', @@ -129,55 +129,55 @@ public function testCanSetCustomOptionFromConstructor() $this->assertEquals('option', $options['custom']); } - public function testAddWithInvalidElementRaisesException() + public function testAddWithInvalidElementRaisesException(): void { $this->expectException(InvalidArgumentException::class); $this->fieldset->add(null); } - public function testCanGrabElementByNameWhenNotProvidedWithAlias() + public function testCanGrabElementByNameWhenNotProvidedWithAlias(): void { $element = new Element('foo'); $this->fieldset->add($element); $this->assertSame($element, $this->fieldset->get('foo')); } - public function testElementMayBeRetrievedByAliasProvidedWhenAdded() + public function testElementMayBeRetrievedByAliasProvidedWhenAdded(): void { $element = new Element('foo'); $this->fieldset->add($element, ['name' => 'bar']); $this->assertSame($element, $this->fieldset->get('bar')); } - public function testElementNameIsChangedToAliasWhenAdded() + public function testElementNameIsChangedToAliasWhenAdded(): void { $element = new Element('foo'); $this->fieldset->add($element, ['name' => 'bar']); $this->assertEquals('bar', $element->getName()); } - public function testCannotRetrieveElementByItsNameWhenProvidingAnAliasDuringAddition() + public function testCannotRetrieveElementByItsNameWhenProvidingAnAliasDuringAddition(): void { $element = new Element('foo'); $this->fieldset->add($element, ['name' => 'bar']); $this->assertFalse($this->fieldset->has('foo')); } - public function testAddingAnElementWithNoNameOrAliasWillRaiseException() + public function testAddingAnElementWithNoNameOrAliasWillRaiseException(): void { $element = new Element(); $this->expectException(InvalidArgumentException::class); $this->fieldset->add($element); } - public function testCanAddFieldsetsToFieldset() + public function testCanAddFieldsetsToFieldset(): void { $fieldset = new Fieldset('foo'); $this->fieldset->add($fieldset); $this->assertCount(1, $this->fieldset); } - public function testCanRemoveElementsByName() + public function testCanRemoveElementsByName(): void { $element = new Element('foo'); $this->fieldset->add($element); @@ -186,7 +186,7 @@ public function testCanRemoveElementsByName() $this->assertFalse($this->fieldset->has('foo')); } - public function testCanRemoveFieldsetsByName() + public function testCanRemoveFieldsetsByName(): void { $fieldset = new Fieldset('foo'); $this->fieldset->add($fieldset); @@ -195,7 +195,7 @@ public function testCanRemoveFieldsetsByName() $this->assertFalse($this->fieldset->has('foo')); } - public function testCanRemoveElementsByWrongName() + public function testCanRemoveElementsByWrongName(): void { $element = new Element('foo'); $this->fieldset->add($element); @@ -214,7 +214,7 @@ public function testCanRemoveElementsByWrongName() $this->assertFalse($this->fieldset->has('bar')); } - public function testCanRetrieveAllAttachedElementsSeparateFromFieldsetsAtOnce() + public function testCanRetrieveAllAttachedElementsSeparateFromFieldsetsAtOnce(): void { $this->populateFieldset(); $elements = $this->fieldset->getElements(); @@ -226,7 +226,7 @@ public function testCanRetrieveAllAttachedElementsSeparateFromFieldsetsAtOnce() } } - public function testCanRetrieveAllAttachedFieldsetsSeparateFromElementsAtOnce() + public function testCanRetrieveAllAttachedFieldsetsSeparateFromElementsAtOnce(): void { $this->populateFieldset(); $fieldsets = $this->fieldset->getFieldsets(); @@ -238,7 +238,7 @@ public function testCanRetrieveAllAttachedFieldsetsSeparateFromElementsAtOnce() } } - public function testCanSetAndRetrieveErrorMessagesForAllElementsAndFieldsets() + public function testCanSetAndRetrieveErrorMessagesForAllElementsAndFieldsets(): void { $this->populateFieldset(); $messages = $this->getMessages(); @@ -247,7 +247,7 @@ public function testCanSetAndRetrieveErrorMessagesForAllElementsAndFieldsets() $this->assertEquals($messages, $test); } - public function testOnlyElementsWithErrorsInMessages() + public function testOnlyElementsWithErrorsInMessages(): void { $fieldset = new TestAsset\FieldsetWithInputFilter('set'); $fieldset->add(new Element('foo')); @@ -264,7 +264,7 @@ public function testOnlyElementsWithErrorsInMessages() $this->assertArrayNotHasKey('bar', $messages['set']); } - public function testCanRetrieveMessagesForSingleElementsAfterMessagesHaveBeenSet() + public function testCanRetrieveMessagesForSingleElementsAfterMessagesHaveBeenSet(): void { $this->populateFieldset(); $messages = $this->getMessages(); @@ -274,7 +274,7 @@ public function testCanRetrieveMessagesForSingleElementsAfterMessagesHaveBeenSet $this->assertEquals($messages['bar'], $test); } - public function testCanRetrieveMessagesForSingleFieldsetsAfterMessagesHaveBeenSet() + public function testCanRetrieveMessagesForSingleFieldsetsAfterMessagesHaveBeenSet(): void { $this->populateFieldset(); $messages = $this->getMessages(); @@ -284,19 +284,19 @@ public function testCanRetrieveMessagesForSingleFieldsetsAfterMessagesHaveBeenSe $this->assertEquals($messages['barbaz'], $test); } - public function testGetMessagesWithInvalidElementRaisesException() + public function testGetMessagesWithInvalidElementRaisesException(): void { $this->expectException(InvalidArgumentException::class); $this->fieldset->getMessages('foo'); } - public function testCountGivesCountOfAttachedElementsAndFieldsets() + public function testCountGivesCountOfAttachedElementsAndFieldsets(): void { $this->populateFieldset(); $this->assertCount(5, $this->fieldset); } - public function testCanIterateOverElementsAndFieldsetsInOrderAttached() + public function testCanIterateOverElementsAndFieldsetsInOrderAttached(): void { $this->populateFieldset(); $expected = ['foo', 'bar', 'baz', 'foobar', 'barbaz']; @@ -307,7 +307,7 @@ public function testCanIterateOverElementsAndFieldsetsInOrderAttached() $this->assertEquals($expected, $test); } - public function testIteratingRespectsOrderPriorityProvidedWhenAttaching() + public function testIteratingRespectsOrderPriorityProvidedWhenAttaching(): void { $this->fieldset->add(new Element('foo'), ['priority' => 10]); $this->fieldset->add(new Element('bar'), ['priority' => 20]); @@ -322,7 +322,7 @@ public function testIteratingRespectsOrderPriorityProvidedWhenAttaching() $this->assertEquals($expected, $test); } - public function testIteratingRespectsOrderPriorityProvidedWhenSetLater() + public function testIteratingRespectsOrderPriorityProvidedWhenSetLater(): void { $this->fieldset->add(new Element('foo'), ['priority' => 10]); $this->fieldset->add(new Element('bar'), ['priority' => 20]); @@ -338,7 +338,7 @@ public function testIteratingRespectsOrderPriorityProvidedWhenSetLater() $this->assertEquals($expected, $test); } - public function testIteratingRespectsOrderPriorityWhenCloned() + public function testIteratingRespectsOrderPriorityWhenCloned(): void { $this->fieldset->add(new Element('foo'), ['priority' => 10]); $this->fieldset->add(new Element('bar'), ['priority' => 20]); @@ -364,7 +364,7 @@ public function testIteratingRespectsOrderPriorityWhenCloned() $this->assertEquals($testOrig, $testClone); } - public function testCloneDeepClonesElementsAndObject() + public function testCloneDeepClonesElementsAndObject(): void { $this->fieldset->add(new Element('foo')); $this->fieldset->add(new Element('bar')); @@ -377,7 +377,7 @@ public function testCloneDeepClonesElementsAndObject() $this->assertNotSame($this->fieldset->getObject(), $fieldsetClone->getObject()); } - public function testSubFieldsetsBindObject() + public function testSubFieldsetsBindObject(): void { $form = new Form(); $fieldset = new Fieldset('foobar'); @@ -392,7 +392,7 @@ public function testSubFieldsetsBindObject() $this->assertSame($fieldset, $form->get('foobar')); } - public function testBindEmptyValue() + public function testBindEmptyValue(): void { $value = new ArrayObject([ 'foo' => 'abc', @@ -418,7 +418,7 @@ public function testBindEmptyValue() $this->assertSame('ghi', $value['bar']); } - public function testFieldsetExposesFluentInterface() + public function testFieldsetExposesFluentInterface(): void { $fieldset = $this->fieldset->add(new Element('foo')); $this->assertSame($this->fieldset, $fieldset); @@ -426,7 +426,7 @@ public function testFieldsetExposesFluentInterface() $this->assertSame($this->fieldset, $fieldset); } - public function testSetOptions() + public function testSetOptions(): void { $this->fieldset->setOptions([ 'foo' => 'bar', @@ -436,7 +436,7 @@ public function testSetOptions() $this->assertEquals('bar', $option); } - public function testSetOptionsUseAsBaseFieldset() + public function testSetOptionsUseAsBaseFieldset(): void { $this->fieldset->setOptions([ 'use_as_base_fieldset' => 'bar', @@ -446,7 +446,7 @@ public function testSetOptionsUseAsBaseFieldset() $this->assertEquals('bar', $option); } - public function testSetOptionAllowedObjectBindingClass() + public function testSetOptionAllowedObjectBindingClass(): void { $this->fieldset->setOptions([ 'allowed_object_binding_class' => 'bar', @@ -456,19 +456,19 @@ public function testSetOptionAllowedObjectBindingClass() $this->assertEquals('bar', $option); } - public function testShouldThrowExceptionWhenGetInvalidElement() + public function testShouldThrowExceptionWhenGetInvalidElement(): void { $this->expectException(InvalidArgumentException::class); $this->fieldset->get('doesnt_exist'); } - public function testBindValuesHasNoName() + public function testBindValuesHasNoName(): void { $bindValues = $this->fieldset->bindValues(['foo']); $this->assertNull($bindValues); } - public function testBindValuesSkipDisabled() + public function testBindValuesSkipDisabled(): void { $object = new stdClass(); $object->disabled = 'notModified'; @@ -497,7 +497,7 @@ class_exists(Hydrator\ObjectPropertyHydrator::class) /** * @group issue-7109 */ - public function testBindValuesDoesNotSkipElementsWithFalsyDisabledValues() + public function testBindValuesDoesNotSkipElementsWithFalsyDisabledValues(): void { $object = new stdClass(); $object->disabled = 'notModified'; @@ -523,13 +523,13 @@ class_exists(Hydrator\ObjectPropertyHydrator::class) $this->assertEquals('modified', $object->disabled); } - public function testSetObjectWithStringRaisesException() + public function testSetObjectWithStringRaisesException(): void { $this->expectException(InvalidArgumentException::class); $this->fieldset->setObject('foo'); } - public function testShouldValidateAllowObjectBindingByClassname() + public function testShouldValidateAllowObjectBindingByClassname(): void { $object = new stdClass(); $this->fieldset->setAllowedObjectBindingClass('stdClass'); @@ -538,7 +538,7 @@ public function testShouldValidateAllowObjectBindingByClassname() $this->assertTrue($allowed); } - public function testShouldValidateAllowObjectBindingByObject() + public function testShouldValidateAllowObjectBindingByObject(): void { $object = new stdClass(); $this->fieldset->setObject($object); @@ -551,7 +551,7 @@ public function testShouldValidateAllowObjectBindingByObject() * @group issue-6585 * @group issue-6614 */ - public function testBindValuesPreservesNewValueAfterValidation() + public function testBindValuesPreservesNewValueAfterValidation(): void { $form = new Form(); $form->add(new Element('foo')); @@ -579,7 +579,7 @@ class_exists(Hydrator\ObjectPropertyHydrator::class) /** * Error test for https://github.com/zendframework/zend-form/issues/135 */ - public function testSetAndGetErrorMessagesForNonExistentElements() + public function testSetAndGetErrorMessagesForNonExistentElements(): void { $messages = [ 'foo' => [ @@ -596,7 +596,7 @@ public function testSetAndGetErrorMessagesForNonExistentElements() $this->assertEquals($messages, $fieldset->getMessages()); } - public function testSetNullValueWhenArrayProvided() + public function testSetNullValueWhenArrayProvided(): void { $subValue = 'sub-element-value'; $subElement = new Element('subElement'); @@ -608,7 +608,7 @@ public function testSetNullValueWhenArrayProvided() $this->assertNull($subElement->getValue()); } - public function testSetNullValueWhenTraversableProvided() + public function testSetNullValueWhenTraversableProvided(): void { $subValue = 'sub-element-value'; $subElement = new Element('subElement'); diff --git a/test/FormAbstractServiceFactoryTest.php b/test/FormAbstractServiceFactoryTest.php index ac0be6323..62a3b3c10 100644 --- a/test/FormAbstractServiceFactoryTest.php +++ b/test/FormAbstractServiceFactoryTest.php @@ -46,36 +46,36 @@ protected function setUp(): void $services->addAbstractFactory($forms); } - public function testMissingConfigServiceIndicatesCannotCreateForm() + public function testMissingConfigServiceIndicatesCannotCreateForm(): void { $this->assertFalse($this->forms->canCreate($this->services, 'foo')); } - public function testMissingFormServicePrefixIndicatesCannotCreateForm() + public function testMissingFormServicePrefixIndicatesCannotCreateForm(): void { $this->services->setService('config', []); $this->assertFalse($this->forms->canCreate($this->services, 'foo')); } - public function testMissingFormManagerConfigIndicatesCannotCreateForm() + public function testMissingFormManagerConfigIndicatesCannotCreateForm(): void { $this->services->setService('config', []); $this->assertFalse($this->forms->canCreate($this->services, 'Form\Foo')); } - public function testInvalidFormManagerConfigIndicatesCannotCreateForm() + public function testInvalidFormManagerConfigIndicatesCannotCreateForm(): void { $this->services->setService('config', ['forms' => 'string']); $this->assertFalse($this->forms->canCreate($this->services, 'Form\Foo')); } - public function testEmptyFormManagerConfigIndicatesCannotCreateForm() + public function testEmptyFormManagerConfigIndicatesCannotCreateForm(): void { $this->services->setService('config', ['forms' => []]); $this->assertFalse($this->forms->canCreate($this->services, 'Form\Foo')); } - public function testMissingFormConfigIndicatesCannotCreateForm() + public function testMissingFormConfigIndicatesCannotCreateForm(): void { $this->services->setService('config', [ 'forms' => [ @@ -85,7 +85,7 @@ public function testMissingFormConfigIndicatesCannotCreateForm() $this->assertFalse($this->forms->canCreate($this->services, 'Form\Foo')); } - public function testInvalidFormConfigIndicatesCannotCreateForm() + public function testInvalidFormConfigIndicatesCannotCreateForm(): void { $this->services->setService('config', [ 'forms' => [ @@ -95,7 +95,7 @@ public function testInvalidFormConfigIndicatesCannotCreateForm() $this->assertFalse($this->forms->canCreate($this->services, 'Foo')); } - public function testEmptyFormConfigIndicatesCannotCreateForm() + public function testEmptyFormConfigIndicatesCannotCreateForm(): void { $this->services->setService('config', [ 'forms' => [ @@ -105,7 +105,7 @@ public function testEmptyFormConfigIndicatesCannotCreateForm() $this->assertFalse($this->forms->canCreate($this->services, 'Foo')); } - public function testPopulatedFormConfigIndicatesFormCanBeCreated() + public function testPopulatedFormConfigIndicatesFormCanBeCreated(): void { $this->services->setService('config', [ 'forms' => [ @@ -118,7 +118,7 @@ public function testPopulatedFormConfigIndicatesFormCanBeCreated() $this->assertTrue($this->forms->canCreate($this->services, 'Foo')); } - public function testFormCanBeCreatedViaInteractionOfAllManagers() + public function testFormCanBeCreatedViaInteractionOfAllManagers(): void { $formConfig = [ 'hydrator' => class_exists(ObjectPropertyHydrator::class) @@ -157,7 +157,7 @@ public function testFormCanBeCreatedViaInteractionOfAllManagers() $this->assertSame($validators, $inputFactory->getDefaultValidatorChain()->getPluginManager()); } - public function testFormCanBeCreatedViaInteractionOfAllManagersExceptInputFilterManager() + public function testFormCanBeCreatedViaInteractionOfAllManagersExceptInputFilterManager(): void { $formConfig = [ 'hydrator' => class_exists(ObjectPropertyHydrator::class) diff --git a/test/FormElementManagerFactoryTest.php b/test/FormElementManagerFactoryTest.php index 9b1f7a4c6..2562c6c11 100644 --- a/test/FormElementManagerFactoryTest.php +++ b/test/FormElementManagerFactoryTest.php @@ -15,7 +15,7 @@ class FormElementManagerFactoryTest extends TestCase { use ProphecyTrait; - public function testFactoryReturnsPluginManager() + public function testFactoryReturnsPluginManager(): void { $container = $this->prophesize(ContainerInterface::class)->reveal(); $factory = new FormElementManagerFactory(); @@ -29,7 +29,7 @@ public function testFactoryReturnsPluginManager() /** * @depends testFactoryReturnsPluginManager */ - public function testFactoryConfiguresPluginManagerUnderContainerInterop() + public function testFactoryConfiguresPluginManagerUnderContainerInterop(): void { $container = $this->prophesize(ContainerInterface::class)->reveal(); $element = $this->prophesize(ElementInterface::class)->reveal(); @@ -43,7 +43,7 @@ public function testFactoryConfiguresPluginManagerUnderContainerInterop() $this->assertSame($element, $elements->get('test')); } - public function testConfiguresFormElementsServicesWhenFound() + public function testConfiguresFormElementsServicesWhenFound(): void { $element = $this->prophesize(ElementInterface::class)->reveal(); $config = [ @@ -52,7 +52,7 @@ public function testConfiguresFormElementsServicesWhenFound() 'test' => Number::class, ], 'factories' => [ - 'test-too' => function ($container) use ($element) { + 'test-too' => function ($container) use ($element): ElementInterface { return $element; }, ], @@ -76,7 +76,7 @@ public function testConfiguresFormElementsServicesWhenFound() $this->assertSame($element, $elements->get('test-too')); } - public function testDoesNotConfigureFormElementsServicesWhenServiceListenerPresent() + public function testDoesNotConfigureFormElementsServicesWhenServiceListenerPresent(): void { $element = $this->prophesize(ElementInterface::class)->reveal(); $config = [ @@ -85,7 +85,7 @@ public function testDoesNotConfigureFormElementsServicesWhenServiceListenerPrese 'test' => Number::class, ], 'factories' => [ - 'test-too' => function ($container) use ($element) { + 'test-too' => function ($container) use ($element): ElementInterface { return $element; }, ], @@ -107,7 +107,7 @@ public function testDoesNotConfigureFormElementsServicesWhenServiceListenerPrese $this->assertFalse($elements->has('test-too')); } - public function testDoesNotConfigureFormElementsServicesWhenConfigServiceNotPresent() + public function testDoesNotConfigureFormElementsServicesWhenConfigServiceNotPresent(): void { $container = $this->prophesize(ServiceLocatorInterface::class); $container->willImplement(ContainerInterface::class); @@ -122,7 +122,7 @@ public function testDoesNotConfigureFormElementsServicesWhenConfigServiceNotPres $this->assertInstanceOf(FormElementManager::class, $elements); } - public function testDoesNotConfigureFormElementServicesWhenConfigServiceDoesNotContainFormElementsConfig() + public function testDoesNotConfigureFormElementServicesWhenConfigServiceDoesNotContainFormElementsConfig(): void { $container = $this->prophesize(ServiceLocatorInterface::class); $container->willImplement(ContainerInterface::class); diff --git a/test/FormElementManagerTest.php b/test/FormElementManagerTest.php index 0b130a22c..22816b996 100644 --- a/test/FormElementManagerTest.php +++ b/test/FormElementManagerTest.php @@ -33,7 +33,7 @@ protected function setUp(): void $this->manager = new FormElementManager(new ServiceManager()); } - public function testInjectToFormFactoryAware() + public function testInjectToFormFactoryAware(): void { $form = $this->manager->get('Form'); $this->assertSame($this->manager, $form->getFormFactory()->getFormElementManager()); @@ -42,7 +42,7 @@ public function testInjectToFormFactoryAware() /** * @group issue-3735 */ - public function testInjectsFormElementManagerToFormComposedByFormFactoryAwareElement() + public function testInjectsFormElementManagerToFormComposedByFormFactoryAwareElement(): void { $factory = new Factory(); $this->manager->setFactory('my-form', function ($elements) use ($factory) { @@ -55,13 +55,13 @@ public function testInjectsFormElementManagerToFormComposedByFormFactoryAwareEle $this->assertSame($this->manager, $form->getFormFactory()->getFormElementManager()); } - public function testRegisteringInvalidElementRaisesException() + public function testRegisteringInvalidElementRaisesException(): void { $this->expectException($this->getInvalidServiceException()); $this->manager->setService('test', $this); } - public function testLoadingInvalidElementRaisesException() + public function testLoadingInvalidElementRaisesException(): void { $this->manager->setInvokableClass('test', static::class); $this->expectException($this->getInvalidServiceException()); @@ -76,7 +76,7 @@ protected function getInvalidServiceException(): string return InvalidElementException::class; } - public function testArrayCreationOptions() + public function testArrayCreationOptions(): void { $args = [ 'name' => 'foo', @@ -89,7 +89,7 @@ public function testArrayCreationOptions() $this->assertEquals('bar', $element->getLabel(), 'Specified options in array[options]'); } - public function testOptionsCreationOptions() + public function testOptionsCreationOptions(): void { $args = [ 'label' => 'bar', @@ -99,7 +99,7 @@ public function testOptionsCreationOptions() $this->assertEquals('bar', $element->getLabel(), 'Specified options in array'); } - public function testArrayOptionsCreationOptions() + public function testArrayOptionsCreationOptions(): void { $args = [ 'options' => [ @@ -114,7 +114,7 @@ public function testArrayOptionsCreationOptions() /** * @group issue-6132 */ - public function testSharedFormElementsAreNotInitializedMultipleTimes() + public function testSharedFormElementsAreNotInitializedMultipleTimes(): void { $element = $this->getMockBuilder(Element::class) ->setMethods(['init']) @@ -132,7 +132,7 @@ public function testSharedFormElementsAreNotInitializedMultipleTimes() $this->manager->get('sharedElement'); } - public function testWillInstantiateFormFromInvokable() + public function testWillInstantiateFormFromInvokable(): void { $form = $this->manager->get('form'); $this->assertInstanceof(Form::class, $form); @@ -142,12 +142,12 @@ public function testWillInstantiateFormFromInvokable() * @group issue-58 * @group issue-64 */ - public function testInjectFactoryInitializerShouldBeRegisteredFirst() + public function testInjectFactoryInitializerShouldBeRegisteredFirst(): void { // @codingStandardsIgnoreStart $initializers = [ - function () {}, - function () {}, + function (): void {}, + function (): void {}, ]; // @codingStandardsIgnoreEnd @@ -168,12 +168,12 @@ function () {}, * @group issue-58 * @group issue-64 */ - public function testCallElementInitInitializerShouldBeRegisteredLast() + public function testCallElementInitInitializerShouldBeRegisteredLast(): void { // @codingStandardsIgnoreStart $initializers = [ - function () {}, - function () {}, + function (): void {}, + function (): void {}, ]; // @codingStandardsIgnoreEnd @@ -193,7 +193,7 @@ function () {}, /** * @group issue-62 */ - public function testAddingInvokableCreatesAliasAndMapsClassToElementFactory() + public function testAddingInvokableCreatesAliasAndMapsClassToElementFactory(): void { $this->manager->setInvokableClass('foo', TestAsset\ElementWithFilter::class); @@ -212,7 +212,7 @@ public function testAddingInvokableCreatesAliasAndMapsClassToElementFactory() $this->assertEquals(ElementFactory::class, $factories[TestAsset\ElementWithFilter::class]); } - public function testAllAliasesShouldBeCanonicalized() + public function testAllAliasesShouldBeCanonicalized(): void { if (method_exists($this->manager, 'configure')) { $this->markTestSkipped('Check canonicalized makes sense only on v2'); diff --git a/test/FormFactoryAwareTraitTest.php b/test/FormFactoryAwareTraitTest.php index 1c65cc2e7..8d547e0d6 100644 --- a/test/FormFactoryAwareTraitTest.php +++ b/test/FormFactoryAwareTraitTest.php @@ -11,7 +11,7 @@ */ class FormFactoryAwareTraitTest extends TestCase { - public function testSetFormFactory() + public function testSetFormFactory(): void { $object = new class { use FormFactoryAwareTrait; diff --git a/test/FormTest.php b/test/FormTest.php index d80007db9..0c485802e 100644 --- a/test/FormTest.php +++ b/test/FormTest.php @@ -76,12 +76,12 @@ private function getOneToManyEntity(): TestAsset\Entity\Product return $product; } - public function populateHydratorStrategyForm() + public function populateHydratorStrategyForm(): void { $this->form->add(new Element('entities')); } - public function populateForm() + public function populateForm(): void { $this->form->add(new Element('foo')); $this->form->add(new Element('bar')); @@ -160,25 +160,25 @@ public function populateForm() $this->form->setInputFilter($inputFilter); } - public function testInputFilterPresentByDefault() + public function testInputFilterPresentByDefault(): void { $this->assertNotNull($this->form->getInputFilter()); } - public function testCanComposeAnInputFilter() + public function testCanComposeAnInputFilter(): void { $filter = new InputFilter(); $this->form->setInputFilter($filter); $this->assertSame($filter, $this->form->getInputFilter()); } - public function testShouldThrowExceptionWhenGetInvalidElement() + public function testShouldThrowExceptionWhenGetInvalidElement(): void { $this->expectException(InvalidArgumentException::class); $this->form->get('doesnt_exist'); } - public function testDefaultNonRequiredInputFilterIsSet() + public function testDefaultNonRequiredInputFilterIsSet(): void { $this->form->add(new Element('foo')); $inputFilter = $this->form->getInputFilter(); @@ -186,7 +186,7 @@ public function testDefaultNonRequiredInputFilterIsSet() $this->assertFalse($fooInput->isRequired()); } - public function testInputProviderInterfaceAddsInputFilters() + public function testInputProviderInterfaceAddsInputFilters(): void { $form = new TestAsset\InputFilterProvider(); @@ -195,7 +195,7 @@ public function testInputProviderInterfaceAddsInputFilters() $this->assertTrue($fooInput->isRequired()); } - public function testInputProviderInterfaceAddsInputFiltersOnlyForSelf() + public function testInputProviderInterfaceAddsInputFiltersOnlyForSelf(): void { $form = new TestAsset\InputFilterProviderWithFieldset(); @@ -204,13 +204,13 @@ public function testInputProviderInterfaceAddsInputFiltersOnlyForSelf() $this->assertFalse($fieldsetInputFilter->has('foo')); } - public function testCallingIsValidRaisesExceptionIfNoDataSet() + public function testCallingIsValidRaisesExceptionIfNoDataSet(): void { $this->expectException(DomainException::class); $this->form->isValid(); } - public function testHasValidatedFlag() + public function testHasValidatedFlag(): void { if (! extension_loaded('intl')) { // Required by \Laminas\I18n\Validator\IsFloat @@ -227,7 +227,7 @@ public function testHasValidatedFlag() $this->assertTrue($form->hasValidated()); } - public function testValidatesEntireDataSetByDefault() + public function testValidatesEntireDataSetByDefault(): void { $this->populateForm(); $invalidSet = [ @@ -253,7 +253,7 @@ public function testValidatesEntireDataSetByDefault() $this->assertTrue($this->form->isValid()); } - public function testSpecifyingValidationGroupForcesPartialValidation() + public function testSpecifyingValidationGroupForcesPartialValidation(): void { if (! extension_loaded('intl')) { // Required by \Laminas\I18n\Validator\IsFloat @@ -275,7 +275,7 @@ public function testSpecifyingValidationGroupForcesPartialValidation() $this->assertTrue($this->form->isValid()); } - public function testSpecifyingValidationGroupForNestedFieldsetsForcesPartialValidation() + public function testSpecifyingValidationGroupForNestedFieldsetsForcesPartialValidation(): void { if (! extension_loaded('intl')) { // Required by \Laminas\I18n\Validator\IsFloat @@ -300,7 +300,7 @@ public function testSpecifyingValidationGroupForNestedFieldsetsForcesPartialVali $this->assertTrue($form->isValid()); } - public function testSettingValidateAllFlagAfterPartialValidationForcesFullValidation() + public function testSettingValidateAllFlagAfterPartialValidationForcesFullValidation(): void { $this->populateForm(); $this->form->setValidationGroup('foo'); @@ -315,25 +315,25 @@ public function testSettingValidateAllFlagAfterPartialValidationForcesFullValida $this->assertArrayHasKey('foobar', $messages, var_export($messages, true)); } - public function testSetValidationGroupWithNoArgumentsRaisesException() + public function testSetValidationGroupWithNoArgumentsRaisesException(): void { $this->expectException(InvalidArgumentException::class); $this->form->setValidationGroup(); } - public function testCallingGetDataPriorToValidationRaisesException() + public function testCallingGetDataPriorToValidationRaisesException(): void { $this->expectException(DomainException::class); $this->form->getData(); } - public function testAttemptingToValidateWithNoInputFilterAttachedRaisesException() + public function testAttemptingToValidateWithNoInputFilterAttachedRaisesException(): void { $this->expectException(DomainException::class); $this->form->isValid(); } - public function testCanRetrieveDataWithoutErrorsFollowingValidation() + public function testCanRetrieveDataWithoutErrorsFollowingValidation(): void { $this->populateForm(); $validSet = [ @@ -354,7 +354,7 @@ public function testCanRetrieveDataWithoutErrorsFollowingValidation() /** * @group Laminas-336 */ - public function testCanAddFileEnctypeAttribute() + public function testCanAddFileEnctypeAttribute(): void { $file = new Element\File('file_resource'); $file @@ -371,7 +371,7 @@ public function testCanAddFileEnctypeAttribute() /** * @group Laminas-336 */ - public function testCanAddFileEnctypeFromCollectionAttribute() + public function testCanAddFileEnctypeFromCollectionAttribute(): void { $file = new Element\File('file_resource'); $file @@ -393,7 +393,7 @@ public function testCanAddFileEnctypeFromCollectionAttribute() $this->assertEquals($enctype, 'multipart/form-data'); } - public function testCallingGetDataReturnsNormalizedDataByDefault() + public function testCallingGetDataReturnsNormalizedDataByDefault(): void { $this->populateForm(); $validSet = [ @@ -419,7 +419,7 @@ public function testCallingGetDataReturnsNormalizedDataByDefault() $this->assertEquals($expected, $data); } - public function testAllowsReturningRawValuesViaGetData() + public function testAllowsReturningRawValuesViaGetData(): void { $this->populateForm(); $validSet = [ @@ -436,7 +436,7 @@ public function testAllowsReturningRawValuesViaGetData() $this->assertEquals($validSet, $data); } - public function testGetDataReturnsBoundModel() + public function testGetDataReturnsBoundModel(): void { $model = new stdClass(); $this->form->setHydrator(new ObjectPropertyHydrator()); @@ -448,7 +448,7 @@ public function testGetDataReturnsBoundModel() $this->assertSame($model, $data); } - public function testGetDataCanReturnValuesAsArrayWhenModelIsBound() + public function testGetDataCanReturnValuesAsArrayWhenModelIsBound(): void { $model = new stdClass(); $validSet = [ @@ -468,7 +468,7 @@ public function testGetDataCanReturnValuesAsArrayWhenModelIsBound() $this->assertEquals($validSet, $data); } - public function testValuesBoundToModelAreNormalizedByDefault() + public function testValuesBoundToModelAreNormalizedByDefault(): void { $model = new stdClass(); $validSet = [ @@ -496,7 +496,7 @@ public function testValuesBoundToModelAreNormalizedByDefault() ], $model->foobar); } - public function testCanBindRawValuesToModel() + public function testCanBindRawValuesToModel(): void { $model = new stdClass(); $validSet = [ @@ -524,7 +524,7 @@ public function testCanBindRawValuesToModel() ], $model->foobar); } - public function testGetDataReturnsSubsetOfDataWhenValidationGroupSet() + public function testGetDataReturnsSubsetOfDataWhenValidationGroupSet(): void { $validSet = [ 'foo' => 'abcde', @@ -545,7 +545,7 @@ public function testGetDataReturnsSubsetOfDataWhenValidationGroupSet() $this->assertEquals('abcde', $data['foo']); } - public function testSettingValidationGroupBindsOnlyThoseValuesToModel() + public function testSettingValidationGroupBindsOnlyThoseValuesToModel(): void { $model = new stdClass(); $validSet = [ @@ -569,7 +569,7 @@ public function testSettingValidationGroupBindsOnlyThoseValuesToModel() $this->assertObjectNotHasAttribute('foobar', $model); } - public function testFormWithCollectionAndValidationGroupBindValuesToModel() + public function testFormWithCollectionAndValidationGroupBindValuesToModel(): void { $model = new stdClass(); $data = [ @@ -610,7 +610,7 @@ public function testFormWithCollectionAndValidationGroupBindValuesToModel() $this->assertObjectNotHasAttribute('foobar', $model); } - public function testSettingValidationGroupWithoutCollectionBindsOnlyThoseValuesToModel() + public function testSettingValidationGroupWithoutCollectionBindsOnlyThoseValuesToModel(): void { $model = new stdClass(); $dataWithoutCollection = [ @@ -639,7 +639,7 @@ public function testSettingValidationGroupWithoutCollectionBindsOnlyThoseValuesT $this->assertObjectNotHasAttribute('foobar', $model); } - public function testCanBindModelsToArraySerializableObjects() + public function testCanBindModelsToArraySerializableObjects(): void { $model = new TestAsset\Model(); $validSet = [ @@ -664,7 +664,7 @@ public function testCanBindModelsToArraySerializableObjects() ], $model->foobar); } - public function testSetsInputFilterToFilterFromBoundModelIfModelImplementsInputLocatorAware() + public function testSetsInputFilterToFilterFromBoundModelIfModelImplementsInputLocatorAware(): void { $model = new TestAsset\ValidatingModel(); $model->setInputFilter(new InputFilter()); @@ -673,7 +673,7 @@ public function testSetsInputFilterToFilterFromBoundModelIfModelImplementsInputL $this->assertSame($model->getInputFilter(), $this->form->getInputFilter()); } - public function testSettingDataShouldSetElementValues() + public function testSettingDataShouldSetElementValues(): void { $this->populateForm(); $data = [ @@ -696,7 +696,7 @@ public function testSettingDataShouldSetElementValues() } } - public function testElementValuesArePopulatedFollowingBind() + public function testElementValuesArePopulatedFollowingBind(): void { $this->populateForm(); $object = new stdClass(); @@ -711,7 +711,7 @@ public function testElementValuesArePopulatedFollowingBind() $this->assertEquals('barbaz', $bar->getValue()); } - public function testUsesBoundObjectAsDataSourceWhenNoDataSet() + public function testUsesBoundObjectAsDataSourceWhenNoDataSet(): void { $this->populateForm(); $object = new stdClass(); @@ -727,7 +727,7 @@ public function testUsesBoundObjectAsDataSourceWhenNoDataSet() $this->assertTrue($this->form->isValid()); } - public function testUsesBoundObjectHydratorToPopulateForm() + public function testUsesBoundObjectHydratorToPopulateForm(): void { $this->populateForm(); $object = new TestAsset\HydratorAwareModel(); @@ -741,18 +741,18 @@ public function testUsesBoundObjectHydratorToPopulateForm() $this->assertEquals('barValue', $bar->getValue()); } - public function testBindOnValidateIsTrueByDefault() + public function testBindOnValidateIsTrueByDefault(): void { $this->assertTrue($this->form->bindOnValidate()); } - public function testCanDisableBindOnValidateFunctionality() + public function testCanDisableBindOnValidateFunctionality(): void { $this->form->setBindOnValidate(false); $this->assertFalse($this->form->bindOnValidate()); } - public function testCallingBindValuesWhenBindOnValidateIsDisabledPopulatesBoundObject() + public function testCallingBindValuesWhenBindOnValidateIsDisabledPopulatesBoundObject(): void { $model = new stdClass(); $validSet = [ @@ -787,7 +787,7 @@ public function testCallingBindValuesWhenBindOnValidateIsDisabledPopulatesBoundO ], $model->foobar); } - public function testBindValuesWithWrappingPopulatesBoundObject() + public function testBindValuesWithWrappingPopulatesBoundObject(): void { $model = new stdClass(); $validSet = [ @@ -820,7 +820,7 @@ public function testBindValuesWithWrappingPopulatesBoundObject() ], $model->foobar); } - public function testFormBaseFieldsetBindValuesWithoutInputs() + public function testFormBaseFieldsetBindValuesWithoutInputs(): void { $baseFieldset = new Fieldset('base_fieldset'); $baseFieldset->setUseAsBaseFieldset(true); @@ -842,20 +842,20 @@ public function testFormBaseFieldsetBindValuesWithoutInputs() $this->assertObjectNotHasAttribute('submit', $model); } - public function testHasFactoryComposedByDefault() + public function testHasFactoryComposedByDefault(): void { $factory = $this->form->getFormFactory(); $this->assertInstanceOf(Factory::class, $factory); } - public function testCanComposeFactory() + public function testCanComposeFactory(): void { $factory = new Factory(); $this->form->setFormFactory($factory); $this->assertSame($factory, $this->form->getFormFactory()); } - public function testCanAddElementsUsingSpecs() + public function testCanAddElementsUsingSpecs(): void { $this->form->add([ 'name' => 'foo', @@ -874,7 +874,7 @@ public function testCanAddElementsUsingSpecs() $this->assertEquals('my.form.text', $element->getAttribute('data-js-type')); } - public function testCanAddFieldsetsUsingSpecs() + public function testCanAddFieldsetsUsingSpecs(): void { $this->form->add([ 'type' => Fieldset::class, @@ -894,7 +894,7 @@ public function testCanAddFieldsetsUsingSpecs() $this->assertEquals('my.form.fieldset', $fieldset->getAttribute('data-js-type')); } - public function testFormAsFieldsetWillBindValuesToObject() + public function testFormAsFieldsetWillBindValuesToObject(): void { $parentForm = new Form('parent'); $parentFormObject = new ArrayObject(['parentId' => null]); @@ -923,7 +923,7 @@ public function testFormAsFieldsetWillBindValuesToObject() $this->assertEquals($data['child']['childId'], $childFormObject['childId']); } - public function testWillUseInputSpecificationFromElementInInputFilterIfNoMatchingInputFound() + public function testWillUseInputSpecificationFromElementInInputFilterIfNoMatchingInputFound(): void { $element = new TestAsset\ElementWithFilter('foo'); $filter = new InputFilter(); @@ -942,7 +942,7 @@ public function testWillUseInputSpecificationFromElementInInputFilterIfNoMatchin $this->assertEquals('foo', $input->getName()); } - public function testWillUseInputFilterSpecificationFromFieldsetInInputFilterIfNoMatchingInputFilterFound() + public function testWillUseInputFilterSpecificationFromFieldsetInInputFilterIfNoMatchingInputFilterFound(): void { $fieldset = new TestAsset\FieldsetWithInputFilter('set'); $filter = new InputFilter(); @@ -959,7 +959,7 @@ public function testWillUseInputFilterSpecificationFromFieldsetInInputFilterIfNo $this->assertTrue($input->has('bar')); } - public function testWillPopulateSubInputFilterFromInputSpecificationsOnFieldsetElements() + public function testWillPopulateSubInputFilterFromInputSpecificationsOnFieldsetElements(): void { $element = new TestAsset\ElementWithFilter('foo'); $fieldset = new Fieldset('set'); @@ -988,7 +988,7 @@ public function testWillPopulateSubInputFilterFromInputSpecificationsOnFieldsetE $this->assertEquals('foo', $input->getName()); } - public function testWillUseFormInputFilterOverrideOverInputSpecificationFromElement() + public function testWillUseFormInputFilterOverrideOverInputSpecificationFromElement(): void { $element = new TestAsset\ElementWithFilter('foo'); $filter = new InputFilter(); @@ -1015,7 +1015,7 @@ public function testWillUseFormInputFilterOverrideOverInputSpecificationFromElem $this->assertEquals('foo', $input->getName()); } - public function testDisablingUseInputFilterDefaultsFlagDisablesInputFilterScanning() + public function testDisablingUseInputFilterDefaultsFlagDisablesInputFilterScanning(): void { $element = new TestAsset\ElementWithFilter('foo'); $fieldset = new Fieldset('set'); @@ -1033,7 +1033,7 @@ public function testDisablingUseInputFilterDefaultsFlagDisablesInputFilterScanni $this->assertCount(0, $fieldsetFilter); } - public function testCallingPrepareEnsuresInputFilterRetrievesDefaults() + public function testCallingPrepareEnsuresInputFilterRetrievesDefaults(): void { $element = new TestAsset\ElementWithFilter('foo'); $filter = new InputFilter(); @@ -1061,7 +1061,7 @@ public function testCallingPrepareEnsuresInputFilterRetrievesDefaults() $this->assertCount(2, $validators); } - public function testCanProperlyPrepareNestedFieldsets() + public function testCanProperlyPrepareNestedFieldsets(): void { $this->form->add([ 'name' => 'foo', @@ -1088,7 +1088,7 @@ public function testCanProperlyPrepareNestedFieldsets() ); } - public function testCanCorrectlyExtractDataFromComposedEntities() + public function testCanCorrectlyExtractDataFromComposedEntities(): void { $address = $this->getComposedEntity(); @@ -1100,7 +1100,7 @@ public function testCanCorrectlyExtractDataFromComposedEntities() $this->assertEquals($address, $form->getData()); } - public function testCanCorrectlyPopulateDataToComposedEntities() + public function testCanCorrectlyPopulateDataToComposedEntities(): void { $address = $this->getComposedEntity(); $emptyAddress = new TestAsset\Entity\Address(); @@ -1132,7 +1132,7 @@ public function testCanCorrectlyPopulateDataToComposedEntities() ); } - public function testCanCorrectlyExtractDataFromOneToManyRelationship() + public function testCanCorrectlyExtractDataFromOneToManyRelationship(): void { if (! extension_loaded('intl')) { // Required by \Laminas\I18n\Validator\IsFloat @@ -1149,7 +1149,7 @@ public function testCanCorrectlyExtractDataFromOneToManyRelationship() $this->assertEquals($product, $form->getData()); } - public function testCanCorrectlyPopulateDataToOneToManyEntites() + public function testCanCorrectlyPopulateDataToOneToManyEntites(): void { if (! extension_loaded('intl')) { $this->markTestSkipped('The Intl extension is not loaded'); @@ -1185,7 +1185,7 @@ public function testCanCorrectlyPopulateDataToOneToManyEntites() ); } - public function testCanCorrectlyPopulateOrphanedEntities() + public function testCanCorrectlyPopulateOrphanedEntities(): void { if (! extension_loaded('intl')) { $this->markTestSkipped('The Intl extension is not loaded'); @@ -1243,7 +1243,7 @@ public function testCanCorrectlyPopulateOrphanedEntities() ); } - public function testAssertElementsNamesAreNotWrappedAroundFormNameByDefault() + public function testAssertElementsNamesAreNotWrappedAroundFormNameByDefault(): void { $form = new TestAsset\FormCollection(); $form->prepare(); @@ -1252,7 +1252,7 @@ public function testAssertElementsNamesAreNotWrappedAroundFormNameByDefault() $this->assertEquals('fieldsets[0][field]', $form->get('fieldsets')->get('0')->get('field')->getName()); } - public function testAssertElementsNamesCanBeWrappedAroundFormName() + public function testAssertElementsNamesCanBeWrappedAroundFormName(): void { $form = new TestAsset\FormCollection(); $form->setWrapElements(true); @@ -1263,7 +1263,7 @@ public function testAssertElementsNamesCanBeWrappedAroundFormName() $this->assertEquals('foo[fieldsets][0][field]', $form->get('fieldsets')->get('0')->get('field')->getName()); } - public function testUnsetValuesNotBound() + public function testUnsetValuesNotBound(): void { $model = new stdClass(); $validSet = [ @@ -1283,7 +1283,7 @@ public function testUnsetValuesNotBound() $this->assertObjectHasAttribute('bar', $data); } - public function testRemoveCollectionFromValidationGroupWhenZeroCountAndNoData() + public function testRemoveCollectionFromValidationGroupWhenZeroCountAndNoData(): void { $dataWithoutCollection = [ 'foo' => 'bar', @@ -1309,7 +1309,7 @@ public function testRemoveCollectionFromValidationGroupWhenZeroCountAndNoData() $this->assertTrue($this->form->isValid()); } - public function testFieldsetValidationGroupStillPreparedWhenEmptyData() + public function testFieldsetValidationGroupStillPreparedWhenEmptyData(): void { $emptyData = []; @@ -1337,7 +1337,7 @@ public function testFieldsetValidationGroupStillPreparedWhenEmptyData() $this->assertFalse($this->form->isValid()); } - public function testApplyObjectInputFilterToBaseFieldsetAndApplyValidationGroup() + public function testApplyObjectInputFilterToBaseFieldsetAndApplyValidationGroup(): void { $fieldset = new Fieldset('foobar'); $fieldset->add(new Element('foo')); @@ -1372,7 +1372,7 @@ public function testApplyObjectInputFilterToBaseFieldsetAndApplyValidationGroup( $this->assertTrue($this->form->isValid()); } - public function testDoNotApplyEmptyInputFiltersToSubFieldsetOfCollectionElementsWithCollectionInputFilters() + public function testDoNotApplyEmptyInputFiltersToSubFieldsetOfCollectionElementsWithCollectionInputFilters(): void { $collectionFieldset = new Fieldset('item'); $collectionFieldset->add(new Element('foo')); @@ -1397,7 +1397,7 @@ public function testDoNotApplyEmptyInputFiltersToSubFieldsetOfCollectionElements $this->assertCount(1, $itemsInputFilter->getInputFilter()->getInputs()); } - public function testFormValidationCanHandleNonConsecutiveKeysOfCollectionInData() + public function testFormValidationCanHandleNonConsecutiveKeysOfCollectionInData(): void { $dataWithCollection = [ 'foo' => 'bar', @@ -1429,7 +1429,7 @@ public function testFormValidationCanHandleNonConsecutiveKeysOfCollectionInData( $this->assertTrue($this->form->isValid()); } - public function testAddNonBaseFieldsetObjectInputFilterToFormInputFilter() + public function testAddNonBaseFieldsetObjectInputFilterToFormInputFilter(): void { $fieldset = new Fieldset('foobar'); $fieldset->add(new Element('foo')); @@ -1451,7 +1451,7 @@ public function testAddNonBaseFieldsetObjectInputFilterToFormInputFilter() $this->assertInstanceOf(InputFilterInterface::class, $this->form->getInputFilter()->get('foobar')); } - public function testExtractDataHydratorStrategy() + public function testExtractDataHydratorStrategy(): void { $this->populateHydratorStrategyForm(); @@ -1485,7 +1485,7 @@ public function testExtractDataHydratorStrategy() $this->assertEquals('CCC', $entities[1]->getField2()); } - public function testSetDataWithNullValues() + public function testSetDataWithNullValues(): void { $this->populateForm(); @@ -1501,7 +1501,7 @@ public function testSetDataWithNullValues() $this->assertTrue($this->form->isValid()); } - public function testHydratorAppliedToBaseFieldset() + public function testHydratorAppliedToBaseFieldset(): void { $fieldset = new Fieldset('foobar'); $fieldset->add(new Element('foo')); @@ -1513,32 +1513,32 @@ public function testHydratorAppliedToBaseFieldset() $this->assertInstanceOf(ArraySerializableHydrator::class, $baseHydrator); } - public function testBindWithWrongFlagRaisesException() + public function testBindWithWrongFlagRaisesException(): void { $model = new stdClass(); $this->expectException(InvalidArgumentException::class); $this->form->bind($model, Form::VALUES_AS_ARRAY); } - public function testSetBindOnValidateWrongFlagRaisesException() + public function testSetBindOnValidateWrongFlagRaisesException(): void { $this->expectException(InvalidArgumentException::class); $this->form->setBindOnValidate(Form::VALUES_AS_ARRAY); } - public function testSetDataOnValidateWrongFlagRaisesException() + public function testSetDataOnValidateWrongFlagRaisesException(): void { $this->expectException(InvalidArgumentException::class); $this->form->setData(null); } - public function testSetDataIsTraversable() + public function testSetDataIsTraversable(): void { $this->form->setData(new ArrayObject(['foo' => 'bar'])); $this->assertTrue($this->form->isValid()); } - public function testResetPasswordValueIfFormIsNotValid() + public function testResetPasswordValueIfFormIsNotValid(): void { $this->form->add([ 'type' => Element\Password::class, @@ -1561,7 +1561,7 @@ public function testResetPasswordValueIfFormIsNotValid() $this->assertEquals('', $this->form->get('password')->getValue()); } - public function testCorrectlyHydrateBaseFieldsetWhenHydratorThatDoesNotIgnoreInvalidDataIsUsed() + public function testCorrectlyHydrateBaseFieldsetWhenHydratorThatDoesNotIgnoreInvalidDataIsUsed(): void { $fieldset = new Fieldset('example'); $fieldset->add([ @@ -1598,7 +1598,7 @@ public function testCorrectlyHydrateBaseFieldsetWhenHydratorThatDoesNotIgnoreInv $this->assertFalse(isset($object->submit)); } - public function testPrepareBindDataAllowsFilterToConvertStringToArray() + public function testPrepareBindDataAllowsFilterToConvertStringToArray(): void { $data = [ 'foo' => '1,2', @@ -1621,19 +1621,19 @@ public function testPrepareBindDataAllowsFilterToConvertStringToArray() $this->addToAssertionCount(1); } - public function testGetValidationGroup() + public function testGetValidationGroup(): void { $group = ['foo']; $this->form->setValidationGroup($group); $this->assertEquals($group, $this->form->getValidationGroup()); } - public function testGetValidationGroupReturnsNullWhenNoneSet() + public function testGetValidationGroupReturnsNullWhenNoneSet(): void { $this->assertNull($this->form->getValidationGroup()); } - public function testPreserveEntitiesBoundToCollectionAfterValidation() + public function testPreserveEntitiesBoundToCollectionAfterValidation(): void { if (! extension_loaded('intl')) { // Required by \Laminas\I18n\Validator\IsFloat @@ -1682,7 +1682,7 @@ public function testPreserveEntitiesBoundToCollectionAfterValidation() $this->assertEquals($hash1, $hash2); } - public function testAddRemove() + public function testAddRemove(): void { $form = clone $this->form; $this->assertEquals($form, $this->form); @@ -1697,7 +1697,7 @@ public function testAddRemove() $this->assertEquals($form, $this->form); } - public function testNestedFormElementNameWrapping() + public function testNestedFormElementNameWrapping(): void { //build form $rootForm = new Form(); @@ -1715,7 +1715,7 @@ public function testNestedFormElementNameWrapping() /** * @group issue-4996 */ - public function testCanOverrideDefaultInputSettings() + public function testCanOverrideDefaultInputSettings(): void { $myFieldset = new TestAsset\MyFieldset(); $myFieldset->setUseAsBaseFieldset(true); @@ -1729,7 +1729,7 @@ public function testCanOverrideDefaultInputSettings() /** * @group issue-5007 */ - public function testComplexFormInputFilterMergesIntoExisting() + public function testComplexFormInputFilterMergesIntoExisting(): void { $this->form->setPreferFormInputFilter(true); $this->form->add([ @@ -1762,7 +1762,7 @@ public function testComplexFormInputFilterMergesIntoExisting() /** * @group issue-5007 */ - public function testInputFilterOrderOfPrecedence1() + public function testInputFilterOrderOfPrecedence1(): void { $spec = [ 'name' => 'test', @@ -1814,7 +1814,7 @@ public function testInputFilterOrderOfPrecedence1() /** * @group issue-5015 */ - public function testCanSetPreferFormInputFilterFlagViaSetOptions() + public function testCanSetPreferFormInputFilterFlagViaSetOptions(): void { $flag = ! $this->form->getPreferFormInputFilter(); $this->form->setOptions([ @@ -1826,7 +1826,7 @@ public function testCanSetPreferFormInputFilterFlagViaSetOptions() /** * @group issue-5015 */ - public function testFactoryCanSetPreferFormInputFilterFlag() + public function testFactoryCanSetPreferFormInputFilterFlag(): void { $factory = new Factory(); foreach ([true, false] as $flag) { @@ -1844,7 +1844,7 @@ public function testFactoryCanSetPreferFormInputFilterFlag() /** * @group issue-5028 */ - public function testPreferFormInputFilterFlagIsEnabledByDefault() + public function testPreferFormInputFilterFlagIsEnabledByDefault(): void { $this->assertTrue($this->form->getPreferFormInputFilter()); } @@ -1852,7 +1852,7 @@ public function testPreferFormInputFilterFlagIsEnabledByDefault() /** * @group issue-5050 */ - public function testFileInputFilterNotOverwritten() + public function testFileInputFilterNotOverwritten(): void { $form = new TestAsset\FileInputFilterProviderForm(); @@ -1866,7 +1866,7 @@ public function testFileInputFilterNotOverwritten() $this->assertCount(1, $chain, (string) print_r($chain, true)); } - public function testInputFilterNotAddedTwiceWhenUsingFieldsets() + public function testInputFilterNotAddedTwiceWhenUsingFieldsets(): void { $form = new Form(); @@ -1876,7 +1876,7 @@ public function testInputFilterNotAddedTwiceWhenUsingFieldsets() $this->assertEquals(1, $filters->count()); } - public function testFormWithNestedCollections() + public function testFormWithNestedCollections(): void { $spec = [ 'name' => 'test', @@ -2012,7 +2012,7 @@ public function testFormWithNestedCollections() $this->assertEquals($data, $this->form->getData()); } - public function testFormWithCollectionsAndNestedFieldsetsWithInputFilterProviderInterface() + public function testFormWithCollectionsAndNestedFieldsetsWithInputFilterProviderInterface(): void { $this->form->add([ 'type' => Element\Collection::class, @@ -2032,7 +2032,7 @@ public function testFormWithCollectionsAndNestedFieldsetsWithInputFilterProvider $this->assertInstanceOf(Input::class, $nestedInputFilter->getInputFilter()->get('foo')); } - public function testFormElementValidatorsMergeIntoAppliedInputFilter() + public function testFormElementValidatorsMergeIntoAppliedInputFilter(): void { $this->form->add([ 'name' => 'importance', @@ -2082,7 +2082,7 @@ public function testFormWithSelectMultipleAndEmptyUnselectedValue( array $data, $unselectedValue, $useHiddenElement - ) { + ): void { $this->form->add([ 'name' => 'multipleSelect', 'type' => Element\Select::class, @@ -2156,7 +2156,7 @@ public function formWithSelectMultipleAndEmptyUnselectedValueDataProvider() ]; } - public function testCanSetUseInputFilterDefaultsViaArray() + public function testCanSetUseInputFilterDefaultsViaArray(): void { $spec = [ 'name' => 'test', @@ -2174,7 +2174,7 @@ public function testCanSetUseInputFilterDefaultsViaArray() /** * Error test for https://github.com/zendframework/zf2/issues/6363 comment #1 */ - public function testSetValidationGroupOnFormWithNestedCollectionsRaisesInvalidArgumentException() + public function testSetValidationGroupOnFormWithNestedCollectionsRaisesInvalidArgumentException(): void { $this->form = new TestAsset\NestedCollectionsForm(); @@ -2217,7 +2217,7 @@ public function testSetValidationGroupOnFormWithNestedCollectionsRaisesInvalidAr /** * Test for https://github.com/zendframework/zf2/issues/6363 comment #2 */ - public function testSetValidationGroupOnFormWithNestedCollectionsPopulatesOnlyFirstNestedCollectionElement() + public function testSetValidationGroupOnFormWithNestedCollectionsPopulatesOnlyFirstNestedCollectionElement(): void { $this->form = new TestAsset\NestedCollectionsForm(); @@ -2270,7 +2270,7 @@ public function testSetValidationGroupOnFormWithNestedCollectionsPopulatesOnlyFi /** * Test for https://github.com/zendframework/zend-form/pull/24#issue-119023527 */ - public function testGetInputFilterInjectsFormInputFilterFactoryInstanceObjectIsNull() + public function testGetInputFilterInjectsFormInputFilterFactoryInstanceObjectIsNull(): void { $inputFilterFactory = $this->form->getFormFactory()->getInputFilterFactory(); $inputFilter = $this->form->getInputFilter(); @@ -2281,7 +2281,7 @@ public function testGetInputFilterInjectsFormInputFilterFactoryInstanceObjectIsN /** * Test for https://github.com/zendframework/zend-form/pull/24#issuecomment-159905491 */ - public function testGetInputFilterInjectsFormInputFilterFactoryInstanceWhenObjectIsInputFilterAware() + public function testGetInputFilterInjectsFormInputFilterFactoryInstanceWhenObjectIsInputFilterAware(): void { $this->form->setBaseFieldset(new Fieldset()); $this->form->setHydrator(new ClassMethodsHydrator()); @@ -2292,7 +2292,7 @@ public function testGetInputFilterInjectsFormInputFilterFactoryInstanceWhenObjec $this->assertSame($inputFilterFactory, $inputFilter->getFactory()); } - public function testShouldHydrateEmptyCollection() + public function testShouldHydrateEmptyCollection(): void { $fieldset = new Fieldset('example'); $fieldset->add([ @@ -2330,7 +2330,7 @@ public function testShouldHydrateEmptyCollection() /** * Test for https://github.com/zendframework/zend-form/issues/83 */ - public function testCanBindNestedCollectionAfterPrepare() + public function testCanBindNestedCollectionAfterPrepare(): void { $collection = new Element\Collection('numbers'); $collection->setOptions([ diff --git a/test/InputFilterProviderFieldsetTest.php b/test/InputFilterProviderFieldsetTest.php index 246d985ee..24e349dce 100644 --- a/test/InputFilterProviderFieldsetTest.php +++ b/test/InputFilterProviderFieldsetTest.php @@ -15,7 +15,7 @@ protected function setUp(): void $this->fieldset = new InputFilterProviderFieldset(); } - public function testCanSetInputFilterSpec() + public function testCanSetInputFilterSpec(): void { $filterSpec = ['filter' => ['filter_options']]; @@ -23,7 +23,7 @@ public function testCanSetInputFilterSpec() $this->assertEquals($filterSpec, $this->fieldset->getInputFilterSpecification()); } - public function testCanSetInputFilterSpecViaOptions() + public function testCanSetInputFilterSpecViaOptions(): void { $filterSpec = ['filter' => ['filter_options']]; @@ -31,7 +31,7 @@ public function testCanSetInputFilterSpecViaOptions() $this->assertEquals($filterSpec, $this->fieldset->getInputFilterSpecification()); } - public function testFilterSpecIsInitiallyEmpty() + public function testFilterSpecIsInitiallyEmpty(): void { $this->assertEmpty($this->fieldset->getInputFilterSpecification()); } diff --git a/test/Integration/FormCreatesCollectionInputFilterTest.php b/test/Integration/FormCreatesCollectionInputFilterTest.php index f527baab9..653106716 100644 --- a/test/Integration/FormCreatesCollectionInputFilterTest.php +++ b/test/Integration/FormCreatesCollectionInputFilterTest.php @@ -74,7 +74,7 @@ public function testCollectionInputFilterContainsExpectedValidators(): Form /** * @depends testCollectionInputFilterContainsExpectedValidators */ - public function testCollectionElementDoesNotCreateDiscreteElementInInputFilter(Form $form) + public function testCollectionElementDoesNotCreateDiscreteElementInInputFilter(Form $form): void { $inputFilter = $form->getInputFilter(); $this->assertFalse($inputFilter->has('date')); diff --git a/test/Integration/ServiceManagerTest.php b/test/Integration/ServiceManagerTest.php index d15571f98..100ab8eb2 100644 --- a/test/Integration/ServiceManagerTest.php +++ b/test/Integration/ServiceManagerTest.php @@ -16,7 +16,7 @@ class ServiceManagerTest extends TestCase { use ProphecyTrait; - public function testInitInitializerShouldBeCalledAfterAllOtherInitializers() + public function testInitInitializerShouldBeCalledAfterAllOtherInitializers(): void { // Reproducing the behaviour of a full stack MVC + ModuleManager $serviceManagerConfig = new Config([ @@ -31,7 +31,7 @@ public function testInitInitializerShouldBeCalledAfterAllOtherInitializers() $formElementManager = $serviceManager->get('FormElementManager'); $test = 0; - $spy = function () use (&$test) { + $spy = function () use (&$test): void { TestCase::assertEquals(1, $test); }; @@ -39,7 +39,7 @@ public function testInitInitializerShouldBeCalledAfterAllOtherInitializers() $element->init()->will($spy); $initializer = $this->prophesize(InitializerInterface::class); - $incrementTest = function () use (&$test) { + $incrementTest = function () use (&$test): void { $test += 1; }; @@ -64,7 +64,7 @@ public function testInitInitializerShouldBeCalledAfterAllOtherInitializers() $formElementManager->get('InitializableElement'); } - public function testInjectFactoryInitializerShouldTriggerBeforeInitInitializer() + public function testInjectFactoryInitializerShouldTriggerBeforeInitInitializer(): void { // Reproducing the behaviour of a full stack MVC + ModuleManager $serviceManagerConfig = new Config([ @@ -79,7 +79,10 @@ public function testInjectFactoryInitializerShouldTriggerBeforeInitInitializer() $formElementManager = $serviceManager->get('FormElementManager'); $initializer = $this->prophesize(InitializerInterface::class); - $formElementManagerAssertion = function ($form) use ($formElementManager) { + $formElementManagerAssertion = /** + * @return true + */ + function ($form) use ($formElementManager): bool { TestCase::assertInstanceOf(Form::class, $form); TestCase::assertSame($formElementManager, $form->getFormFactory()->getFormElementManager()); return true; diff --git a/test/LabelAwareTraitTest.php b/test/LabelAwareTraitTest.php index dbc4b4987..5980ce910 100644 --- a/test/LabelAwareTraitTest.php +++ b/test/LabelAwareTraitTest.php @@ -16,7 +16,7 @@ */ class LabelAwareTraitTest extends TestCase { - public function testSetLabelAttributes() + public function testSetLabelAttributes(): void { $object = new class { use LabelAwareTrait; @@ -34,7 +34,7 @@ public function testSetLabelAttributes() $this->assertSame($labelAttributes, $object->getLabelAttributes()); } - public function testGetEmptyLabelAttributes() + public function testGetEmptyLabelAttributes(): void { $object = new class { use LabelAwareTrait; @@ -45,7 +45,7 @@ public function testGetEmptyLabelAttributes() $this->assertEquals(null, $labelAttributes); } - public function testGetLabelAttributes() + public function testGetLabelAttributes(): void { $object = new class { use LabelAwareTrait; @@ -63,7 +63,7 @@ public function testGetLabelAttributes() $this->assertEquals($labelAttributes, $getLabelAttributes); } - public function testSetEmptyLabelOptions() + public function testSetEmptyLabelOptions(): void { $object = new class { use LabelAwareTrait; @@ -76,7 +76,7 @@ public function testSetEmptyLabelOptions() $this->assertEquals($labelOptions, []); } - public function testSetLabelOptions() + public function testSetLabelOptions(): void { $object = new class { use LabelAwareTrait; @@ -94,7 +94,7 @@ public function testSetLabelOptions() $this->assertEquals($retrievedLabelOptions, $labelOptions); } - public function testSetLabelOptionsTraversable() + public function testSetLabelOptionsTraversable(): void { $object = new class { use LabelAwareTrait; @@ -112,7 +112,7 @@ public function testSetLabelOptionsTraversable() $this->assertEquals($retrievedLabelOptions, $labelOptions); } - public function testGetEmptyLabelOptions() + public function testGetEmptyLabelOptions(): void { $object = new class { use LabelAwareTrait; @@ -123,7 +123,7 @@ public function testGetEmptyLabelOptions() $this->assertEquals($labelOptions, []); } - public function testGetLabelOptions() + public function testGetLabelOptions(): void { $object = new class { use LabelAwareTrait; @@ -141,7 +141,7 @@ public function testGetLabelOptions() $this->assertEquals($labelOptions, $retrievedLabelOptions); } - public function testClearLabelOptions() + public function testClearLabelOptions(): void { $object = new class { use LabelAwareTrait; @@ -161,7 +161,7 @@ public function testClearLabelOptions() $this->assertEquals([], $retrievedLabelOptions); } - public function testRemoveLabelOptions() + public function testRemoveLabelOptions(): void { $object = new class { use LabelAwareTrait; @@ -189,7 +189,7 @@ public function testRemoveLabelOptions() $this->assertEquals($expectedLabelOptions, $retrievedLabelOptions); } - public function testSetLabelOption() + public function testSetLabelOption(): void { $object = new class { use LabelAwareTrait; @@ -206,7 +206,7 @@ public function testSetLabelOption() $this->assertEquals($expectedLabelOptions, $retrievedLabelOptions); } - public function testGetInvalidLabelOption() + public function testGetInvalidLabelOption(): void { $object = new class { use LabelAwareTrait; @@ -219,7 +219,7 @@ public function testGetInvalidLabelOption() $this->assertEquals(null, $retrievedOption); } - public function testGetLabelOption() + public function testGetLabelOption(): void { $object = new class { use LabelAwareTrait; @@ -235,7 +235,7 @@ public function testGetLabelOption() $this->assertEquals($retrievedValue, $value); } - public function testRemoveLabelOption() + public function testRemoveLabelOption(): void { $object = new class { use LabelAwareTrait; @@ -253,7 +253,7 @@ public function testRemoveLabelOption() $this->assertEquals(null, $retrievedValue); } - public function testHasValidLabelOption() + public function testHasValidLabelOption(): void { $object = new class { use LabelAwareTrait; @@ -268,7 +268,7 @@ public function testHasValidLabelOption() $this->assertTrue($hasLabelOptionResult); } - public function testHasInvalidLabelOption() + public function testHasInvalidLabelOption(): void { $object = new class { use LabelAwareTrait; diff --git a/test/TestAsset/Entity/Orphan.php b/test/TestAsset/Entity/Orphan.php index c51c74915..c28efe210 100644 --- a/test/TestAsset/Entity/Orphan.php +++ b/test/TestAsset/Entity/Orphan.php @@ -14,7 +14,7 @@ public function getArrayCopy(): array return get_object_vars($this); } - public function exchangeArray(array $data = []) + public function exchangeArray(array $data = []): void { $this->name = $data['name']; } diff --git a/test/TestAsset/Entity/Product.php b/test/TestAsset/Entity/Product.php index fffbaf68e..39d6139f9 100644 --- a/test/TestAsset/Entity/Product.php +++ b/test/TestAsset/Entity/Product.php @@ -103,7 +103,7 @@ public function getMadeInCountry() /** * @param Country $country */ - public function setMadeInCountry($country) + public function setMadeInCountry($country): void { $this->madeInCountry = $country; } diff --git a/test/TestAsset/FieldsetWithDependency.php b/test/TestAsset/FieldsetWithDependency.php index 308c25af5..3aadaf587 100644 --- a/test/TestAsset/FieldsetWithDependency.php +++ b/test/TestAsset/FieldsetWithDependency.php @@ -34,7 +34,7 @@ public function getDependency() /** * @param InputFilter $dependency */ - public function setDependency($dependency) + public function setDependency($dependency): void { $this->dependency = $dependency; } diff --git a/test/TestAsset/HydratorStrategyEntityA.php b/test/TestAsset/HydratorStrategyEntityA.php index 458279413..b15c8cec4 100644 --- a/test/TestAsset/HydratorStrategyEntityA.php +++ b/test/TestAsset/HydratorStrategyEntityA.php @@ -16,7 +16,7 @@ class HydratorStrategyEntityA implements InputFilterAwareInterface /** @var null|InputFilterInterface */ private $inputFilter; // used to test forms - public function addEntity(HydratorStrategyEntityB $entity) + public function addEntity(HydratorStrategyEntityB $entity): void { $this->entities[] = $entity; } diff --git a/test/View/Helper/AbstractCommonTestCase.php b/test/View/Helper/AbstractCommonTestCase.php index 377f3c64c..4d1f0e7a4 100644 --- a/test/View/Helper/AbstractCommonTestCase.php +++ b/test/View/Helper/AbstractCommonTestCase.php @@ -37,7 +37,7 @@ protected function setUp(): void $this->helper->setView($this->renderer); } - public function testUsesUtf8ByDefault() + public function testUsesUtf8ByDefault(): void { if (! extension_loaded('intl')) { $this->markTestSkipped('ext/intl not enabled'); @@ -46,7 +46,7 @@ public function testUsesUtf8ByDefault() $this->assertEquals('UTF-8', $this->helper->getEncoding()); } - public function testCanInjectEncoding() + public function testCanInjectEncoding(): void { if (! extension_loaded('intl')) { $this->markTestSkipped('ext/intl not enabled'); @@ -56,7 +56,7 @@ public function testCanInjectEncoding() $this->assertEquals('iso-8859-1', $this->helper->getEncoding()); } - public function testInjectingEncodingProxiesToEscapeHelper() + public function testInjectingEncodingProxiesToEscapeHelper(): void { if (! extension_loaded('intl')) { $this->markTestSkipped('ext/intl not enabled'); @@ -68,7 +68,7 @@ public function testInjectingEncodingProxiesToEscapeHelper() $this->assertEquals('iso-8859-1', $escape->getEncoding()); } - public function testInjectingEncodingProxiesToAttrEscapeHelper() + public function testInjectingEncodingProxiesToAttrEscapeHelper(): void { if (! extension_loaded('intl')) { $this->markTestSkipped('ext/intl not enabled'); @@ -80,7 +80,7 @@ public function testInjectingEncodingProxiesToAttrEscapeHelper() $this->assertEquals('iso-8859-1', $escape->getEncoding()); } - public function testAssumesHtml4LooseDoctypeByDefault() + public function testAssumesHtml4LooseDoctypeByDefault(): void { if (! extension_loaded('intl')) { $this->markTestSkipped('ext/intl not enabled'); @@ -91,7 +91,7 @@ public function testAssumesHtml4LooseDoctypeByDefault() $this->assertEquals(Doctype::HTML4_LOOSE, $helper->getDoctype()); } - public function testCanInjectDoctype() + public function testCanInjectDoctype(): void { if (! extension_loaded('intl')) { $this->markTestSkipped('ext/intl not enabled'); @@ -101,7 +101,7 @@ public function testCanInjectDoctype() $this->assertEquals(Doctype::HTML5, $this->helper->getDoctype()); } - public function testCanGetDoctypeFromDoctypeHelper() + public function testCanGetDoctypeFromDoctypeHelper(): void { if (! extension_loaded('intl')) { $this->markTestSkipped('ext/intl not enabled'); diff --git a/test/View/Helper/AbstractHelperTest.php b/test/View/Helper/AbstractHelperTest.php index 44f1e0835..4516ac787 100644 --- a/test/View/Helper/AbstractHelperTest.php +++ b/test/View/Helper/AbstractHelperTest.php @@ -23,7 +23,7 @@ protected function setUp(): void /** * @group issue-5991 */ - public function testWillEscapeValueAttributeValuesCorrectly() + public function testWillEscapeValueAttributeValuesCorrectly(): void { $this->assertSame( 'data-value="breaking your HTML like a boss! \"', @@ -31,7 +31,7 @@ public function testWillEscapeValueAttributeValuesCorrectly() ); } - public function testWillEncodeValueAttributeValuesCorrectly() + public function testWillEncodeValueAttributeValuesCorrectly(): void { $escaper = new Escaper('iso-8859-1'); @@ -43,7 +43,7 @@ public function testWillEncodeValueAttributeValuesCorrectly() ); } - public function testWillNotEncodeValueAttributeValuesCorrectly() + public function testWillNotEncodeValueAttributeValuesCorrectly(): void { $escaper = new Escaper('iso-8859-1'); @@ -78,7 +78,7 @@ public function testWillIncludeAdditionalAttributes( string $attribute, ?string $expected = null, ?bool $exception = null - ) { + ): void { if ($exception) { $this->expectException(InvalidArgumentException::class); } @@ -117,7 +117,7 @@ public function testWillIncludeAdditionalAttributesByPrefix( string $prefix, ?string $expected = null, ?bool $exception = null - ) { + ): void { if ($exception) { $this->expectException(InvalidArgumentException::class); } @@ -130,7 +130,7 @@ public function testWillIncludeAdditionalAttributesByPrefix( ); } - public function testWillTranslateAttributeValuesCorrectly() + public function testWillTranslateAttributeValuesCorrectly(): void { $translator = self::getMockBuilder(Translator::class) ->disableOriginalConstructor() @@ -171,7 +171,7 @@ public function testWillTranslateAttributeValuesCorrectly() ); } - public function testWillTranslateDefaultAttributeValuesCorrectly() + public function testWillTranslateDefaultAttributeValuesCorrectly(): void { $translator = self::getMockBuilder(Translator::class) ->disableOriginalConstructor() @@ -213,7 +213,7 @@ public function testWillTranslateDefaultAttributeValuesCorrectly() ); } - public function testWillInsulateAgainstBadAttributes() + public function testWillInsulateAgainstBadAttributes(): void { $this->assertSame( 'data-value=""', diff --git a/test/View/Helper/Captcha/DumbTest.php b/test/View/Helper/Captcha/DumbTest.php index c81c8d020..ae4e2605d 100644 --- a/test/View/Helper/Captcha/DumbTest.php +++ b/test/View/Helper/Captcha/DumbTest.php @@ -33,7 +33,7 @@ public function getElement(): CaptchaElement return $element; } - public function testMissingCaptchaAttributeThrowsDomainException() + public function testMissingCaptchaAttributeThrowsDomainException(): void { $element = new CaptchaElement('foo'); @@ -41,7 +41,7 @@ public function testMissingCaptchaAttributeThrowsDomainException() $this->helper->render($element); } - public function testRendersHiddenInputForId() + public function testRendersHiddenInputForId(): void { $element = $this->getElement(); $markup = $this->helper->render($element); @@ -56,7 +56,7 @@ public function testRendersHiddenInputForId() ); } - public function testRendersTextInputForInput() + public function testRendersTextInputForInput(): void { $element = $this->getElement(); $markup = $this->helper->render($element); @@ -67,7 +67,7 @@ public function testRendersTextInputForInput() ); } - public function testRendersLabelPriorToInputByDefault() + public function testRendersLabelPriorToInputByDefault(): void { $element = $this->getElement(); $markup = $this->helper->render($element); @@ -78,7 +78,7 @@ public function testRendersLabelPriorToInputByDefault() ); } - public function testCanRenderLabelFollowingInput() + public function testCanRenderLabelFollowingInput(): void { $this->helper->setCaptchaPosition('prepend'); $element = $this->getElement(); @@ -90,13 +90,13 @@ public function testCanRenderLabelFollowingInput() ); } - public function testSetCaptchaPositionWithNullRaisesException() + public function testSetCaptchaPositionWithNullRaisesException(): void { $this->expectException(InvalidArgumentException::class); $this->helper->setCaptchaPosition(null); } - public function testSetSeparator() + public function testSetSeparator(): void { $this->helper->setCaptchaPosition('prepend'); $element = $this->getElement(); @@ -106,7 +106,7 @@ public function testSetSeparator() $this->assertEquals('-', $this->helper->getSeparator()); } - public function testRenderSeparatorOneTimeAfterText() + public function testRenderSeparatorOneTimeAfterText(): void { $element = $this->getElement(); $this->helper->setSeparator('
'); diff --git a/test/View/Helper/Captcha/FigletTest.php b/test/View/Helper/Captcha/FigletTest.php index 27ebde38c..6246164d6 100644 --- a/test/View/Helper/Captcha/FigletTest.php +++ b/test/View/Helper/Captcha/FigletTest.php @@ -30,7 +30,7 @@ public function getElement(): CaptchaElement return $element; } - public function testMissingCaptchaAttributeThrowsDomainException() + public function testMissingCaptchaAttributeThrowsDomainException(): void { $element = new CaptchaElement('foo'); @@ -38,7 +38,7 @@ public function testMissingCaptchaAttributeThrowsDomainException() $this->helper->render($element); } - public function testRendersHiddenInputForId() + public function testRendersHiddenInputForId(): void { $element = $this->getElement(); $markup = $this->helper->render($element); @@ -52,7 +52,7 @@ public function testRendersHiddenInputForId() ); } - public function testRendersTextInputForInput() + public function testRendersTextInputForInput(): void { $element = $this->getElement(); $markup = $this->helper->render($element); @@ -62,7 +62,7 @@ public function testRendersTextInputForInput() ); } - public function testRendersFigletPriorToInputByDefault() + public function testRendersFigletPriorToInputByDefault(): void { $element = $this->getElement(); $markup = $this->helper->render($element); @@ -73,7 +73,7 @@ public function testRendersFigletPriorToInputByDefault() ); } - public function testCanRenderFigletFollowingInput() + public function testCanRenderFigletFollowingInput(): void { $this->helper->setCaptchaPosition('prepend'); $element = $this->getElement(); diff --git a/test/View/Helper/Captcha/ImageTest.php b/test/View/Helper/Captcha/ImageTest.php index 17e715dd8..6e9225846 100644 --- a/test/View/Helper/Captcha/ImageTest.php +++ b/test/View/Helper/Captcha/ImageTest.php @@ -95,7 +95,7 @@ public function getElement(): CaptchaElement return $element; } - public function testMissingCaptchaAttributeThrowsDomainException() + public function testMissingCaptchaAttributeThrowsDomainException(): void { $element = new CaptchaElement('foo'); @@ -103,7 +103,7 @@ public function testMissingCaptchaAttributeThrowsDomainException() $this->helper->render($element); } - public function testRendersHiddenInputForId() + public function testRendersHiddenInputForId(): void { $element = $this->getElement(); $markup = $this->helper->render($element); @@ -117,7 +117,7 @@ public function testRendersHiddenInputForId() ); } - public function testRendersTextInputForInput() + public function testRendersTextInputForInput(): void { $element = $this->getElement(); $markup = $this->helper->render($element); @@ -127,14 +127,14 @@ public function testRendersTextInputForInput() ); } - public function testRendersImageTagPriorToInputByDefault() + public function testRendersImageTagPriorToInputByDefault(): void { $element = $this->getElement(); $markup = $this->helper->render($element); $this->assertMatchesRegularExpression('#]+>helper->setCaptchaPosition('prepend'); $element = $this->getElement(); diff --git a/test/View/Helper/Captcha/ReCaptchaTest.php b/test/View/Helper/Captcha/ReCaptchaTest.php index 24a50771a..48569de7b 100644 --- a/test/View/Helper/Captcha/ReCaptchaTest.php +++ b/test/View/Helper/Captcha/ReCaptchaTest.php @@ -46,7 +46,7 @@ public function getElement(): CaptchaElement return $element; } - public function testMissingCaptchaAttributeThrowsDomainException() + public function testMissingCaptchaAttributeThrowsDomainException(): void { $element = new CaptchaElement('foo'); @@ -54,7 +54,7 @@ public function testMissingCaptchaAttributeThrowsDomainException() $this->helper->render($element); } - public function testRendersHiddenInputWhenNameIsNotRecaptchaDefault() + public function testRendersHiddenInputWhenNameIsNotRecaptchaDefault(): void { $element = $this->getElement(); $markup = $this->helper->render($element); @@ -62,7 +62,7 @@ public function testRendersHiddenInputWhenNameIsNotRecaptchaDefault() $this->assertStringContainsString('value="g-recaptcha-response"', $markup); } - public function testDoesNotRenderHiddenInputWhenNameIsRecaptchaDefault() + public function testDoesNotRenderHiddenInputWhenNameIsRecaptchaDefault(): void { $element = $this->getElement(); $element->setName('g-recaptcha-response'); @@ -70,7 +70,7 @@ public function testDoesNotRenderHiddenInputWhenNameIsRecaptchaDefault() $this->assertStringNotContainsString('type="hidden"', $markup); } - public function testRendersReCaptchaMarkup() + public function testRendersReCaptchaMarkup(): void { $element = $this->getElement(); $markup = $this->helper->render($element); diff --git a/test/View/Helper/File/FormFileApcProgressTest.php b/test/View/Helper/File/FormFileApcProgressTest.php index bc635c5e8..223631f6b 100644 --- a/test/View/Helper/File/FormFileApcProgressTest.php +++ b/test/View/Helper/File/FormFileApcProgressTest.php @@ -18,7 +18,7 @@ protected function setUp(): void parent::setUp(); } - public function testReturnsNameIdAndValueAttributes() + public function testReturnsNameIdAndValueAttributes(): void { $name = ini_get('apc.rfc1867_name'); if (false === $name) { diff --git a/test/View/Helper/File/FormFileSessionProgressTest.php b/test/View/Helper/File/FormFileSessionProgressTest.php index 4c255068b..9b3a1406b 100644 --- a/test/View/Helper/File/FormFileSessionProgressTest.php +++ b/test/View/Helper/File/FormFileSessionProgressTest.php @@ -18,7 +18,7 @@ protected function setUp(): void parent::setUp(); } - public function testReturnsNameIdAndValueAttributes() + public function testReturnsNameIdAndValueAttributes(): void { $name = ini_get('session.upload_progress.name'); if (false === $name) { diff --git a/test/View/Helper/File/FormFileUploadProgressTest.php b/test/View/Helper/File/FormFileUploadProgressTest.php index 0f25c49bc..ed5e7f35f 100644 --- a/test/View/Helper/File/FormFileUploadProgressTest.php +++ b/test/View/Helper/File/FormFileUploadProgressTest.php @@ -16,7 +16,7 @@ protected function setUp(): void parent::setUp(); } - public function testReturnsNameIdAndValueAttributes() + public function testReturnsNameIdAndValueAttributes(): void { $markup = $this->helper->__invoke(); $this->assertStringContainsString('helper->openTag(); $this->assertEquals('', $markup); } - public function testPassingElementToOpenTagWillUseNameAttribute() + public function testPassingElementToOpenTagWillUseNameAttribute(): void { $element = new Element('foo'); $markup = $this->helper->openTag($element); $this->assertStringContainsString('name="foo"', $markup); } - public function testRaisesExceptionWhenNameIsNotPresentInElementWhenPassedToOpenTag() + public function testRaisesExceptionWhenNameIsNotPresentInElementWhenPassedToOpenTag(): void { $element = new Element(); $this->expectException(DomainException::class); @@ -63,7 +63,7 @@ public function testRaisesExceptionWhenNameIsNotPresentInElementWhenPassedToOpen $this->helper->openTag($element); } - public function testOpenTagWithWrongElementRaisesException() + public function testOpenTagWithWrongElementRaisesException(): void { $element = new ArrayObject(); $this->expectException(InvalidArgumentException::class); @@ -71,7 +71,7 @@ public function testOpenTagWithWrongElementRaisesException() $this->helper->openTag($element); } - public function testGeneratesSubmitTypeWhenProvidedAnElementWithNoTypeAttribute() + public function testGeneratesSubmitTypeWhenProvidedAnElementWithNoTypeAttribute(): void { $element = new Element('foo'); $markup = $this->helper->openTag($element); @@ -79,7 +79,7 @@ public function testGeneratesSubmitTypeWhenProvidedAnElementWithNoTypeAttribute( $this->assertStringContainsString('type="submit"', $markup); } - public function testGeneratesButtonTagWithElementsTypeAttribute() + public function testGeneratesButtonTagWithElementsTypeAttribute(): void { $element = new Element('foo'); $element->setAttribute('type', 'button'); @@ -105,7 +105,7 @@ public function inputTypes(): array /** * @dataProvider inputTypes */ - public function testOpenTagOnlyAllowsValidButtonTypes(string $type, string $assertion) + public function testOpenTagOnlyAllowsValidButtonTypes(string $type, string $assertion): void { $element = new Element('foo'); $element->setAttribute('type', $type); @@ -190,7 +190,7 @@ public function getCompleteElement(): Element /** * @dataProvider validAttributes */ - public function testAllValidFormMarkupAttributesPresentInElementAreRendered(string $attribute, string $assertion) + public function testAllValidFormMarkupAttributesPresentInElementAreRendered(string $attribute, string $assertion): void { $element = $this->getCompleteElement(); $element->setLabel('{button_content}'); @@ -206,7 +206,7 @@ public function testAllValidFormMarkupAttributesPresentInElementAreRendered(stri $this->$assertion($expect, $markup); } - public function testRaisesExceptionWhenLabelAttributeIsNotPresentInElement() + public function testRaisesExceptionWhenLabelAttributeIsNotPresentInElement(): void { $element = new Element('foo'); $this->expectException(DomainException::class); @@ -214,7 +214,7 @@ public function testRaisesExceptionWhenLabelAttributeIsNotPresentInElement() $markup = $this->helper->render($element); } - public function testPassingElementToRenderGeneratesButtonMarkup() + public function testPassingElementToRenderGeneratesButtonMarkup(): void { $element = new Element('foo'); $element->setLabel('{button_content}'); @@ -225,7 +225,7 @@ public function testPassingElementToRenderGeneratesButtonMarkup() $this->assertStringContainsString('', $markup); } - public function testPassingElementAndContentToRenderUsesContent() + public function testPassingElementAndContentToRenderUsesContent(): void { $element = new Element('foo'); $markup = $this->helper->render($element, '{button_content}'); @@ -235,7 +235,7 @@ public function testPassingElementAndContentToRenderUsesContent() $this->assertStringContainsString('', $markup); } - public function testCallingFromViewHelperCanHandleOpenTagAndCloseTag() + public function testCallingFromViewHelperCanHandleOpenTagAndCloseTag(): void { $helper = $this->helper; $markup = $helper()->openTag(); @@ -244,7 +244,7 @@ public function testCallingFromViewHelperCanHandleOpenTagAndCloseTag() $this->assertEquals('', $markup); } - public function testInvokeProxiesToRender() + public function testInvokeProxiesToRender(): void { $element = new Element('foo'); $markup = $this->helper->__invoke($element, '{button_content}'); @@ -253,20 +253,20 @@ public function testInvokeProxiesToRender() $this->assertStringContainsString('>{button_content}<', $markup); } - public function testInvokeWithNoElementChainsHelper() + public function testInvokeWithNoElementChainsHelper(): void { $element = new Element('foo'); $this->assertSame($this->helper, $this->helper->__invoke()); } - public function testDoesNotThrowExceptionIfNameIsZero() + public function testDoesNotThrowExceptionIfNameIsZero(): void { $element = new Element(0); $markup = $this->helper->__invoke($element, '{button_content}'); $this->assertStringContainsString('name="0"', $markup); } - public function testCanTranslateContent() + public function testCanTranslateContent(): void { $element = new Element('foo'); $element->setLabel('The value for foo:'); @@ -283,7 +283,7 @@ public function testCanTranslateContent() $this->assertStringContainsString('>translated content<', $markup); } - public function testCanTranslateButtonContentParameter() + public function testCanTranslateButtonContentParameter(): void { $element = new Element('foo'); @@ -299,7 +299,7 @@ public function testCanTranslateButtonContentParameter() $this->assertStringContainsString('>translated content<', $markup); } - public function testTranslatorMethods() + public function testTranslatorMethods(): void { $translatorMock = $this->createMock(Translator::class); $this->helper->setTranslator($translatorMock, 'foo'); @@ -313,7 +313,7 @@ public function testTranslatorMethods() $this->assertFalse($this->helper->isTranslatorEnabled()); } - public function testLabelIsEscapedByDefault() + public function testLabelIsEscapedByDefault(): void { $element = new Element('foo'); $element->setLabel('Click me'); @@ -324,7 +324,7 @@ public function testLabelIsEscapedByDefault() ); } - public function testCanDisableLabelHtmlEscape() + public function testCanDisableLabelHtmlEscape(): void { $element = new Element('foo'); $element->setLabel('Click me'); diff --git a/test/View/Helper/FormCaptchaTest.php b/test/View/Helper/FormCaptchaTest.php index 4fa06a7ac..993dec9e7 100644 --- a/test/View/Helper/FormCaptchaTest.php +++ b/test/View/Helper/FormCaptchaTest.php @@ -76,7 +76,7 @@ public function getElement(): CaptchaElement return new CaptchaElement('foo'); } - public function testRaisesExceptionIfElementHasNoCaptcha() + public function testRaisesExceptionIfElementHasNoCaptcha(): void { $element = $this->getElement(); $this->expectException(DomainException::class); @@ -84,7 +84,7 @@ public function testRaisesExceptionIfElementHasNoCaptcha() $this->helper->render($element); } - public function testPassingElementWithDumbCaptchaRendersCorrectly() + public function testPassingElementWithDumbCaptchaRendersCorrectly(): void { $captcha = new Captcha\Dumb(); $element = $this->getElement(); @@ -102,7 +102,7 @@ public function testPassingElementWithDumbCaptchaRendersCorrectly() ); } - public function testPassingElementWithFigletCaptchaRendersCorrectly() + public function testPassingElementWithFigletCaptchaRendersCorrectly(): void { $captcha = new Captcha\Figlet(); $element = $this->getElement(); @@ -123,7 +123,7 @@ public function testPassingElementWithFigletCaptchaRendersCorrectly() ); } - public function testPassingElementWithImageCaptchaRendersCorrectly() + public function testPassingElementWithImageCaptchaRendersCorrectly(): void { if (! extension_loaded('gd')) { $this->markTestSkipped('The GD extension is not available.'); @@ -167,7 +167,7 @@ public function testPassingElementWithImageCaptchaRendersCorrectly() ); } - public function testPassingElementWithReCaptchaRendersCorrectly() + public function testPassingElementWithReCaptchaRendersCorrectly(): void { if (! getenv('TESTS_LAMINAS_FORM_RECAPTCHA_SUPPORT')) { $this->markTestSkipped('Enable TESTS_LAMINAS_FORM_RECAPTCHA_SUPPORT to test PDF render'); diff --git a/test/View/Helper/FormCheckboxTest.php b/test/View/Helper/FormCheckboxTest.php index bcf749bf8..1a942ba7b 100644 --- a/test/View/Helper/FormCheckboxTest.php +++ b/test/View/Helper/FormCheckboxTest.php @@ -29,7 +29,7 @@ public function getElement(): Element\Checkbox return $element; } - public function testRaisesExceptionWhenNameIsNotPresentInElement() + public function testRaisesExceptionWhenNameIsNotPresentInElement(): void { $element = new Element\Checkbox(); $this->expectException(DomainException::class); @@ -37,7 +37,7 @@ public function testRaisesExceptionWhenNameIsNotPresentInElement() $this->helper->render($element); } - public function testUsesOptionsAttributeToGenerateCheckedAndUnCheckedValues() + public function testUsesOptionsAttributeToGenerateCheckedAndUnCheckedValues(): void { $element = $this->getElement(); $markup = $this->helper->render($element); @@ -48,7 +48,7 @@ public function testUsesOptionsAttributeToGenerateCheckedAndUnCheckedValues() $this->assertStringContainsString('value="unchecked"', $markup); } - public function testUsesElementValueToDetermineCheckboxStatus() + public function testUsesElementValueToDetermineCheckboxStatus(): void { $element = $this->getElement(); $element->setValue('checked'); @@ -58,7 +58,7 @@ public function testUsesElementValueToDetermineCheckboxStatus() $this->assertDoesNotMatchRegularExpression('#value="unchecked"\s+checked="checked"#', $markup); } - public function testNoOptionsAttributeCreatesDefaultCheckedAndUncheckedValues() + public function testNoOptionsAttributeCreatesDefaultCheckedAndUncheckedValues(): void { $element = new Element\Checkbox('foo'); $markup = $this->helper->render($element); @@ -66,7 +66,7 @@ public function testNoOptionsAttributeCreatesDefaultCheckedAndUncheckedValues() $this->assertMatchesRegularExpression('#type="hidden"\s+name="foo"\s+value="0"#', $markup); } - public function testSetUseHiddenElementAttributeDoesNotRenderHiddenInput() + public function testSetUseHiddenElementAttributeDoesNotRenderHiddenInput(): void { $element = new Element\Checkbox('foo'); $element->setUseHiddenElement(false); @@ -75,7 +75,7 @@ public function testSetUseHiddenElementAttributeDoesNotRenderHiddenInput() $this->assertDoesNotMatchRegularExpression('#type="hidden"\s+name="foo"\s+value="0"#', $markup); } - public function testDoesNotThrowExceptionIfNameIsZero() + public function testDoesNotThrowExceptionIfNameIsZero(): void { $element = new Element\Checkbox(0); $markup = $this->helper->__invoke($element); @@ -85,7 +85,7 @@ public function testDoesNotThrowExceptionIfNameIsZero() /** * @group Laminas-457 */ - public function testBaseElementType() + public function testBaseElementType(): void { $element = new Element('foo'); $this->expectException(InvalidArgumentException::class); @@ -95,7 +95,7 @@ public function testBaseElementType() /** * @group issue-7286 */ - public function testDisabledOptionIssetOnHiddenElement() + public function testDisabledOptionIssetOnHiddenElement(): void { $element = new Element\Checkbox('foo'); $element->setUseHiddenElement(true); diff --git a/test/View/Helper/FormCollectionTest.php b/test/View/Helper/FormCollectionTest.php index 3d0040f88..afbfc75dd 100644 --- a/test/View/Helper/FormCollectionTest.php +++ b/test/View/Helper/FormCollectionTest.php @@ -29,12 +29,12 @@ public function getForm(): FormCollection return $form; } - public function testInvokeWithNoElementChainsHelper() + public function testInvokeWithNoElementChainsHelper(): void { $this->assertSame($this->helper, $this->helper->__invoke()); } - public function testCanGenerateTemplate() + public function testCanGenerateTemplate(): void { $form = $this->getForm(); $collection = $form->get('colors'); @@ -46,7 +46,7 @@ public function testCanGenerateTemplate() $this->assertStringContainsString($collection->getTemplatePlaceholder(), $markup); } - public function testDoesNotGenerateTemplateByDefault() + public function testDoesNotGenerateTemplateByDefault(): void { $form = $this->getForm(); $collection = $form->get('colors'); @@ -57,7 +57,7 @@ public function testDoesNotGenerateTemplateByDefault() $this->assertStringNotContainsString('getForm(); $collection = $form->get('colors'); @@ -67,7 +67,7 @@ public function testCorrectlyIndexElementsInCollection() $this->assertStringContainsString('name="colors[1]"', $markup); } - public function testCorrectlyIndexNestedElementsInCollection() + public function testCorrectlyIndexNestedElementsInCollection(): void { $form = $this->getForm(); $collection = $form->get('fieldsets'); @@ -81,7 +81,7 @@ public function testCorrectlyIndexNestedElementsInCollection() ); } - public function testRenderWithCustomHelper() + public function testRenderWithCustomHelper(): void { $form = $this->getForm(); @@ -98,7 +98,7 @@ public function testRenderWithCustomHelper() $this->assertStringContainsString('id="customcolors1"', $markup); } - public function testRenderWithCustomFieldsetHelper() + public function testRenderWithCustomFieldsetHelper(): void { $form = $this->getForm(); @@ -114,7 +114,7 @@ public function testRenderWithCustomFieldsetHelper() /** * @group issue-7167 */ - public function testShouldNotWrapAtSubInvokeHelper() + public function testShouldNotWrapAtSubInvokeHelper(): void { $this->assertStringNotContainsString( 'assertStringContainsString( 'assertTrue($this->helper->shouldWrap()); } - public function testSetShouldWrapReturnsFalse() + public function testSetShouldWrapReturnsFalse(): void { $this->helper->setShouldWrap(false); $this->assertFalse($this->helper->shouldWrap()); } - public function testGetDefaultElementHelperReturnsFormrow() + public function testGetDefaultElementHelperReturnsFormrow(): void { $defaultElement = $this->helper->getDefaultElementHelper(); $this->assertSame('formrow', $defaultElement); } - public function testSetDefaultElementHelperToFoo() + public function testSetDefaultElementHelperToFoo(): void { $this->helper->setDefaultElementHelper('foo'); $defaultElement = $this->helper->getDefaultElementHelper(); $this->assertSame('foo', $defaultElement); } - public function testCanRenderTemplateAlone() + public function testCanRenderTemplateAlone(): void { $form = $this->getForm(); $collection = $form->get('colors'); @@ -169,7 +169,7 @@ public function testCanRenderTemplateAlone() $this->assertStringContainsString($collection->getTemplatePlaceholder(), $markup); } - public function testCanTranslateLegend() + public function testCanTranslateLegend(): void { $form = $this->getForm(); $collection = $form->get('colors'); @@ -189,7 +189,7 @@ public function testCanTranslateLegend() $this->assertStringContainsString('>translated legend<', $markup); } - public function testShouldWrapWithoutLabel() + public function testShouldWrapWithoutLabel(): void { $form = $this->getForm(); $collection = $form->get('colors'); @@ -200,7 +200,7 @@ public function testShouldWrapWithoutLabel() $this->assertStringContainsString('
', $markup); } - public function testRenderCollectionAttributes() + public function testRenderCollectionAttributes(): void { $form = $this->getForm(); $collection = $form->get('colors'); @@ -212,14 +212,14 @@ public function testRenderCollectionAttributes() $this->assertStringContainsString(' id="some-identifier"', $markup); } - public function testCanRenderFieldsetWithoutAttributes() + public function testCanRenderFieldsetWithoutAttributes(): void { $form = $this->getForm(); $html = $this->helper->render($form); $this->assertStringContainsString('
', $html); } - public function testCanRenderFieldsetWithAttributes() + public function testCanRenderFieldsetWithAttributes(): void { $form = $this->getForm(); $form->setAttributes([ @@ -232,7 +232,7 @@ public function testCanRenderFieldsetWithAttributes() $this->assertStringContainsString('class="foo"', $html); } - public function testCanRenderWithoutLegend() + public function testCanRenderWithoutLegend(): void { $form = $this->getForm(); $html = $this->helper->render($form); @@ -240,7 +240,7 @@ public function testCanRenderWithoutLegend() $this->assertStringNotContainsString('', $html); } - public function testRendersLabelAsLegend() + public function testRendersLabelAsLegend(): void { $form = $this->getForm(); $form->setLabel('Foo'); @@ -249,7 +249,7 @@ public function testRendersLabelAsLegend() $this->assertStringContainsString('', $html); } - public function testCollectionIsWrappedByFieldsetWithoutLegend() + public function testCollectionIsWrappedByFieldsetWithoutLegend(): void { $form = $this->getForm(); $collection = $form->get('colors'); @@ -262,7 +262,7 @@ public function testCollectionIsWrappedByFieldsetWithoutLegend() $this->assertStringEndsWith('
', $markup); } - public function testCollectionIsWrappedByFieldsetWithLabel() + public function testCollectionIsWrappedByFieldsetWithLabel(): void { $form = $this->getForm(); $collection = $form->get('colors'); @@ -276,7 +276,7 @@ public function testCollectionIsWrappedByFieldsetWithLabel() $this->assertStringEndsWith('
', $markup); } - public function testCollectionIsWrappedByCustomElement() + public function testCollectionIsWrappedByCustomElement(): void { $form = $this->getForm(); $collection = $form->get('colors'); @@ -290,7 +290,7 @@ public function testCollectionIsWrappedByCustomElement() $this->assertStringEndsWith('', $markup); } - public function testCollectionContainsTemplateAtPos3() + public function testCollectionContainsTemplateAtPos3(): void { $form = $this->getForm(); $collection = $form->get('colors'); @@ -306,7 +306,7 @@ public function testCollectionContainsTemplateAtPos3() $this->assertStringEndsWith('', $markup); } - public function testCollectionRendersLabelCorrectly() + public function testCollectionRendersLabelCorrectly(): void { $form = $this->getForm(); $collection = $form->get('colors'); @@ -320,7 +320,7 @@ public function testCollectionRendersLabelCorrectly() $this->assertStringStartsWith('

foo

', $markup); } - public function testCollectionCollectionRendersTemplateCorrectly() + public function testCollectionCollectionRendersTemplateCorrectly(): void { $form = $this->getForm(); $collection = $form->get('colors'); @@ -334,7 +334,7 @@ public function testCollectionCollectionRendersTemplateCorrectly() $this->assertMatchesRegularExpression('/\
.*?<\/div>/', $markup); } - public function testCollectionRendersTemplateWithoutWrapper() + public function testCollectionRendersTemplateWithoutWrapper(): void { $form = $this->getForm(); $collection = $form->get('colors'); @@ -349,7 +349,7 @@ public function testCollectionRendersTemplateWithoutWrapper() $this->assertMatchesRegularExpression('/\
.*?<\/div>/', $markup); } - public function testCollectionRendersFieldsetCorrectly() + public function testCollectionRendersFieldsetCorrectly(): void { $form = $this->getForm(); $collection = $form->get('fieldsets'); @@ -365,7 +365,7 @@ public function testCollectionRendersFieldsetCorrectly() $this->assertMatchesRegularExpression('/\
.*?<\/div>/', $markup); } - public function testGetterAndSetter() + public function testGetterAndSetter(): void { $this->assertSame($this->helper, $this->helper->setWrapper('foo')); $this->assertSame('foo', $this->helper->getWrapper()); @@ -378,7 +378,7 @@ public function testGetterAndSetter() $this->assertEquals('foo', $this->helper->getTemplateWrapper()); } - public function testLabelIsEscapedByDefault() + public function testLabelIsEscapedByDefault(): void { $form = $this->getForm(); $collection = $form->get('colors'); @@ -390,7 +390,7 @@ public function testLabelIsEscapedByDefault() ); } - public function testCanDisableLabelHtmlEscape() + public function testCanDisableLabelHtmlEscape(): void { $form = $this->getForm(); $collection = $form->get('colors'); @@ -404,7 +404,7 @@ public function testCanDisableLabelHtmlEscape() ); } - public function testForElementHelperNotInstanceOfHelperInterface() + public function testForElementHelperNotInstanceOfHelperInterface(): void { $method = new ReflectionMethod(FormCollectionHelper::class, 'getElementHelper'); $method->setAccessible(true); diff --git a/test/View/Helper/FormColorTest.php b/test/View/Helper/FormColorTest.php index 653118d91..ecb42e31c 100644 --- a/test/View/Helper/FormColorTest.php +++ b/test/View/Helper/FormColorTest.php @@ -19,7 +19,7 @@ protected function setUp(): void parent::setUp(); } - public function testRaisesExceptionWhenNameIsNotPresentInElement() + public function testRaisesExceptionWhenNameIsNotPresentInElement(): void { $element = new Element(); $this->expectException(DomainException::class); @@ -27,7 +27,7 @@ public function testRaisesExceptionWhenNameIsNotPresentInElement() $this->helper->render($element); } - public function testGeneratesColorInputTagWithElement() + public function testGeneratesColorInputTagWithElement(): void { $element = new Element('foo'); $markup = $this->helper->render($element); @@ -35,7 +35,7 @@ public function testGeneratesColorInputTagWithElement() $this->assertStringContainsString('type="color"', $markup); } - public function testGeneratesColorInputTagRegardlessOfElementType() + public function testGeneratesColorInputTagRegardlessOfElementType(): void { $element = new Element('foo'); $element->setAttribute('type', 'email'); @@ -120,7 +120,7 @@ public function getCompleteElement(): Element /** * @dataProvider validAttributes */ - public function testAllValidFormMarkupAttributesPresentInElementAreRendered(string $attribute, string $assertion) + public function testAllValidFormMarkupAttributesPresentInElementAreRendered(string $attribute, string $assertion): void { $element = $this->getCompleteElement(); $markup = $this->helper->render($element); @@ -135,7 +135,7 @@ public function testAllValidFormMarkupAttributesPresentInElementAreRendered(stri $this->$assertion($expect, $markup); } - public function testInvokeProxiesToRender() + public function testInvokeProxiesToRender(): void { $element = new Element('foo'); $markup = $this->helper->__invoke($element); @@ -144,7 +144,7 @@ public function testInvokeProxiesToRender() $this->assertStringContainsString('type="color"', $markup); } - public function testInvokeWithNoElementChainsHelper() + public function testInvokeWithNoElementChainsHelper(): void { $this->assertSame($this->helper, $this->helper->__invoke()); } diff --git a/test/View/Helper/FormDateSelectTest.php b/test/View/Helper/FormDateSelectTest.php index 0a92e5bcb..feb07e100 100644 --- a/test/View/Helper/FormDateSelectTest.php +++ b/test/View/Helper/FormDateSelectTest.php @@ -25,7 +25,7 @@ protected function setUp(): void parent::setUp(); } - public function testRaisesExceptionWhenNameIsNotPresentInElement() + public function testRaisesExceptionWhenNameIsNotPresentInElement(): void { $element = new DateSelect(); $this->expectException(DomainException::class); @@ -33,7 +33,7 @@ public function testRaisesExceptionWhenNameIsNotPresentInElement() $this->helper->render($element); } - public function testGeneratesThreeSelectsWithElement() + public function testGeneratesThreeSelectsWithElement(): void { $element = new DateSelect('foo'); $markup = $this->helper->render($element); @@ -42,7 +42,7 @@ public function testGeneratesThreeSelectsWithElement() $this->assertStringContainsString('setShouldCreateEmptyOption(true); @@ -76,7 +76,7 @@ public function testCanRenderTextDelimiters() $this->assertStringMatchesFormat('%a de %a de %a', $markup); } - public function testInvokeProxiesToRender() + public function testInvokeProxiesToRender(): void { $element = new DateSelect('foo'); $markup = $this->helper->__invoke($element); @@ -85,12 +85,12 @@ public function testInvokeProxiesToRender() $this->assertStringContainsString('setShouldShowSeconds(true); @@ -58,7 +58,7 @@ public function testGeneratesSecondSelectIfAskedByElement() $this->assertStringContainsString('setShouldCreateEmptyOption(true); @@ -95,7 +95,7 @@ public function testCanRenderTextDelimiters() $this->assertStringMatchesFormat('%a de %a de %a %ah%amin%as%a', $markup); } - public function testInvokeProxiesToRender() + public function testInvokeProxiesToRender(): void { $element = new DateTimeSelect('foo'); $markup = $this->helper->__invoke($element); @@ -106,12 +106,12 @@ public function testInvokeProxiesToRender() $this->assertStringContainsString('', $markup); } - public function testCanAppendLabelContentUsingFlagToInvoke() + public function testCanAppendLabelContentUsingFlagToInvoke(): void { $element = new Element('foo'); $element->setLabel('The value for foo:'); @@ -130,7 +130,7 @@ public function testCanAppendLabelContentUsingFlagToInvoke() $this->assertStringContainsString('>', $markup); } - public function testsetLabelAttributes() + public function testsetLabelAttributes(): void { $element = new Element('foo'); $element->setLabel('The value for foo:'); @@ -142,7 +142,7 @@ public function testsetLabelAttributes() $this->assertStringContainsString('>', $markup); } - public function testPassingElementAndContextAndFlagToInvokeRaisesExceptionForMissingLabelAttribute() + public function testPassingElementAndContextAndFlagToInvokeRaisesExceptionForMissingLabelAttribute(): void { $element = new Element('foo'); $this->expectException(DomainException::class); @@ -150,7 +150,7 @@ public function testPassingElementAndContextAndFlagToInvokeRaisesExceptionForMis $markup = $this->helper->__invoke($element, '', FormLabelHelper::APPEND); } - public function testCallingFromViewHelperCanHandleOpenTagAndCloseTag() + public function testCallingFromViewHelperCanHandleOpenTagAndCloseTag(): void { $helper = $this->helper; $markup = $helper()->openTag(); @@ -159,7 +159,7 @@ public function testCallingFromViewHelperCanHandleOpenTagAndCloseTag() $this->assertEquals('', $markup); } - public function testCanTranslateContent() + public function testCanTranslateContent(): void { $element = new Element('foo'); $element->setLabel('The value for foo:'); @@ -176,7 +176,7 @@ public function testCanTranslateContent() $this->assertStringContainsString('>translated content<', $markup); } - public function testTranslatorMethods() + public function testTranslatorMethods(): void { $translatorMock = $this->createMock(Translator::class); $this->helper->setTranslator($translatorMock, 'foo'); @@ -190,7 +190,7 @@ public function testTranslatorMethods() $this->assertFalse($this->helper->isTranslatorEnabled()); } - public function testLabelIsEscapedByDefault() + public function testLabelIsEscapedByDefault(): void { $element = new Element('foo'); $element->setLabel('The value for foo:'); @@ -198,7 +198,7 @@ public function testLabelIsEscapedByDefault() $this->assertStringNotContainsString('for', $markup); } - public function testCanDisableLabelHtmlEscape() + public function testCanDisableLabelHtmlEscape(): void { $element = new Element('foo'); $element->setLabel('The value for foo:'); @@ -207,13 +207,13 @@ public function testCanDisableLabelHtmlEscape() $this->assertStringContainsString('for', $markup); } - public function testAlwaysWrapIsDisabledByDefault() + public function testAlwaysWrapIsDisabledByDefault(): void { $element = new Element('foo'); $this->assertEmpty($element->getLabelOption('always_wrap')); } - public function testCanSetAlwaysWrap() + public function testCanSetAlwaysWrap(): void { $element = new Element('foo'); $element->setLabelOption('always_wrap', true); diff --git a/test/View/Helper/FormMonthSelectTest.php b/test/View/Helper/FormMonthSelectTest.php index 8b0c5507f..4bf7845d3 100644 --- a/test/View/Helper/FormMonthSelectTest.php +++ b/test/View/Helper/FormMonthSelectTest.php @@ -25,7 +25,7 @@ protected function setUp(): void parent::setUp(); } - public function testRaisesExceptionWhenNameIsNotPresentInElement() + public function testRaisesExceptionWhenNameIsNotPresentInElement(): void { $element = new MonthSelect(); $this->expectException(DomainException::class); @@ -33,7 +33,7 @@ public function testRaisesExceptionWhenNameIsNotPresentInElement() $this->helper->render($element); } - public function testGeneratesTwoSelectsWithElement() + public function testGeneratesTwoSelectsWithElement(): void { $element = new MonthSelect('foo'); $markup = $this->helper->render($element); @@ -42,7 +42,7 @@ public function testGeneratesTwoSelectsWithElement() $this->assertStringContainsString('setShouldCreateEmptyOption(true); @@ -76,7 +76,7 @@ public function testCanRenderTextDelimiters() $this->assertStringMatchesFormat('%a de %a', $markup); } - public function testInvokeProxiesToRender() + public function testInvokeProxiesToRender(): void { $element = new MonthSelect('foo'); $markup = $this->helper->__invoke($element); @@ -85,12 +85,12 @@ public function testInvokeProxiesToRender() $this->assertStringContainsString(']*\/?>/', $markup); } - public function testIgnoreLabelForHidden() + public function testIgnoreLabelForHidden(): void { $element = new Element\Hidden('foo'); $element->setLabel('My label'); @@ -110,7 +110,7 @@ public function testIgnoreLabelForHidden() $this->assertMatchesRegularExpression('/]*\/?>/', $markup); } - public function testCanHandleMultiCheckboxesCorrectly() + public function testCanHandleMultiCheckboxesCorrectly(): void { $options = [ 'This is the first label' => 'value1', @@ -128,7 +128,7 @@ public function testCanHandleMultiCheckboxesCorrectly() $this->assertStringContainsString('', $markup); } - public function testTranslatorMethods() + public function testTranslatorMethods(): void { $translatorMock = $this->createMock(Translator::class); $this->helper->setTranslator($translatorMock, 'foo'); @@ -244,7 +244,7 @@ public function testTranslatorMethods() $this->assertFalse($this->helper->isTranslatorEnabled()); } - public function testLabelWillBeTranslatedOnceWithoutId() + public function testLabelWillBeTranslatedOnceWithoutId(): void { $element = new Element('foo'); $element->setLabel('The value for foo:'); @@ -263,7 +263,7 @@ public function testLabelWillBeTranslatedOnceWithoutId() $this->assertStringContainsString('', $markup); } - public function testLabelWillBeTranslatedOnceWithId() + public function testLabelWillBeTranslatedOnceWithId(): void { $element = new Element('foo'); $element->setLabel('The value for foo:'); @@ -283,45 +283,45 @@ public function testLabelWillBeTranslatedOnceWithId() $this->assertStringContainsString('', $markup); } - public function testSetLabelPositionInputRandomRaisesException() + public function testSetLabelPositionInputRandomRaisesException(): void { $this->expectException(InvalidArgumentException::class); $this->helper->setLabelPosition(uniqid('non_existant_')); } - public function testGetLabelPositionReturnsDefaultPrepend() + public function testGetLabelPositionReturnsDefaultPrepend(): void { $labelPosition = $this->helper->getLabelPosition(); $this->assertEquals('prepend', $labelPosition); } - public function testGetLabelPositionReturnsAppend() + public function testGetLabelPositionReturnsAppend(): void { $this->helper->setLabelPosition('append'); $labelPosition = $this->helper->getLabelPosition(); $this->assertEquals('append', $labelPosition); } - public function testGetRenderErrorsReturnsDefaultTrue() + public function testGetRenderErrorsReturnsDefaultTrue(): void { $renderErrors = $this->helper->getRenderErrors(); $this->assertTrue($renderErrors); } - public function testGetRenderErrorsSetToFalse() + public function testGetRenderErrorsSetToFalse(): void { $this->helper->setRenderErrors(false); $renderErrors = $this->helper->getRenderErrors(); $this->assertFalse($renderErrors); } - public function testSetLabelAttributes() + public function testSetLabelAttributes(): void { $this->helper->setLabelAttributes(['foo', 'bar']); $this->assertEquals([0 => 'foo', 1 => 'bar'], $this->helper->getLabelAttributes()); } - public function testWhenUsingIdAndLabelBecomesEmptyRemoveSpan() + public function testWhenUsingIdAndLabelBecomesEmptyRemoveSpan(): void { $element = new Element('foo'); $element->setLabel('The value for foo:'); @@ -337,7 +337,7 @@ public function testWhenUsingIdAndLabelBecomesEmptyRemoveSpan() $this->assertStringNotContainsString('', $markup); } - public function testShowErrorInMultiCheckbox() + public function testShowErrorInMultiCheckbox(): void { $element = new Element\MultiCheckbox('hobby'); $element->setLabel('Hobby'); @@ -353,7 +353,7 @@ public function testShowErrorInMultiCheckbox() $this->assertStringContainsString('
  • Error message
', $markup); } - public function testShowErrorInRadio() + public function testShowErrorInRadio(): void { $element = new Element\Radio('direction'); $element->setLabel('Direction'); @@ -369,7 +369,7 @@ public function testShowErrorInRadio() $this->assertStringContainsString('
  • Error message
', $markup); } - public function testErrorShowTwice() + public function testErrorShowTwice(): void { $element = new Element\Date('birth'); $element->setFormat('Y-m-d'); @@ -386,7 +386,7 @@ public function testErrorShowTwice() ); } - public function testInvokeWithNoRenderErrors() + public function testInvokeWithNoRenderErrors(): void { $mock = $this->getMockBuilder(get_class($this->helper)) ->setMethods(['setRenderErrors']) @@ -397,7 +397,7 @@ public function testInvokeWithNoRenderErrors() $mock->__invoke(new Element('foo')); } - public function testInvokeWithRenderErrorsTrue() + public function testInvokeWithRenderErrorsTrue(): void { $mock = $this->getMockBuilder(get_class($this->helper)) ->setMethods(['setRenderErrors']) @@ -409,7 +409,7 @@ public function testInvokeWithRenderErrorsTrue() $mock->__invoke(new Element('foo'), null, true); } - public function testAppendLabelEvenIfElementHasId() + public function testAppendLabelEvenIfElementHasId(): void { $element = new Element('foo'); $element->setAttribute('id', 'bar'); @@ -423,7 +423,7 @@ public function testAppendLabelEvenIfElementHasId() ); } - public function testUsePartialView() + public function testUsePartialView(): void { $element = new Element('fooname'); $element->setLabel('foolabel'); @@ -439,7 +439,7 @@ public function testUsePartialView() $this->assertSame($partial, $this->helper->getPartial()); } - public function testAssertButtonElementDoesNotRenderLabelTwice() + public function testAssertButtonElementDoesNotRenderLabelTwice(): void { $element = new Element\Button('button'); $element->setLabel('foo'); @@ -451,7 +451,7 @@ public function testAssertButtonElementDoesNotRenderLabelTwice() ); } - public function testAssertLabelHtmlEscapeIsOnByDefault() + public function testAssertLabelHtmlEscapeIsOnByDefault(): void { $element = new Element('fooname'); $escapeHelper = $this->renderer->getHelperPluginManager()->get('escapeHtml'); @@ -464,7 +464,7 @@ public function testAssertLabelHtmlEscapeIsOnByDefault() $this->assertStringContainsString($escapeHelper->__invoke($label), $markup); } - public function testCanDisableLabelHtmlEscape() + public function testCanDisableLabelHtmlEscape(): void { $label = 'foo'; $element = new Element('fooname'); @@ -476,7 +476,7 @@ public function testCanDisableLabelHtmlEscape() $this->assertStringContainsString($label, $markup); } - public function testCanSetLabelPositionBeforeInvoke() + public function testCanSetLabelPositionBeforeInvoke(): void { $element = new Element('foo'); @@ -489,7 +489,7 @@ public function testCanSetLabelPositionBeforeInvoke() /** * @covers \Laminas\Form\View\Helper\FormRow::render */ - public function testCanSetLabelPositionViaRender() + public function testCanSetLabelPositionViaRender(): void { $element = new Element('foo'); $element->setAttribute('id', 'bar'); @@ -508,7 +508,7 @@ public function testCanSetLabelPositionViaRender() ); } - public function testSetLabelPositionViaRenderIsNotCached() + public function testSetLabelPositionViaRenderIsNotCached(): void { $labelPositionBeforeRender = $this->helper->getLabelPosition(); $element = new Element('foo'); @@ -523,7 +523,7 @@ public function testSetLabelPositionViaRenderIsNotCached() /** * @covers \Laminas\Form\View\Helper\FormRow::__invoke */ - public function testCanSetLabelPositionViaInvoke() + public function testCanSetLabelPositionViaInvoke(): void { $element = new Element('foo'); $element->setAttribute('id', 'bar'); @@ -545,7 +545,7 @@ public function testCanSetLabelPositionViaInvoke() /** * @covers \Laminas\Form\View\Helper\FormRow::__invoke */ - public function testSetLabelPositionViaInvokeIsNotCached() + public function testSetLabelPositionViaInvokeIsNotCached(): void { $labelPositionBeforeRender = $this->helper->getLabelPosition(); $element = new Element('foo'); @@ -557,13 +557,13 @@ public function testSetLabelPositionViaInvokeIsNotCached() $this->assertSame($labelPositionBeforeRender, $this->helper->getLabelPosition()); } - public function testLabelOptionAlwaysWrapDefaultsToFalse() + public function testLabelOptionAlwaysWrapDefaultsToFalse(): void { $element = new Element('foo'); $this->assertEmpty($element->getLabelOption('always_wrap')); } - public function testCanSetOptionToWrapElementInLabel() + public function testCanSetOptionToWrapElementInLabel(): void { $element = new Element('foo', [ 'label_options' => [ @@ -583,7 +583,7 @@ public function testCanSetOptionToWrapElementInLabel() /** * @group issue-7030 */ - public function testWrapFieldsetAroundCaptchaWithLabel() + public function testWrapFieldsetAroundCaptchaWithLabel(): void { $this->assertMatchesRegularExpression( '#^
baz<\/legend>' diff --git a/test/View/Helper/FormSearchTest.php b/test/View/Helper/FormSearchTest.php index 9b0763f39..331d3689a 100644 --- a/test/View/Helper/FormSearchTest.php +++ b/test/View/Helper/FormSearchTest.php @@ -19,7 +19,7 @@ protected function setUp(): void parent::setUp(); } - public function testRaisesExceptionWhenNameIsNotPresentInElement() + public function testRaisesExceptionWhenNameIsNotPresentInElement(): void { $element = new Element(); $this->expectException(DomainException::class); @@ -27,7 +27,7 @@ public function testRaisesExceptionWhenNameIsNotPresentInElement() $this->helper->render($element); } - public function testGeneratesTextInputTagWithElement() + public function testGeneratesTextInputTagWithElement(): void { $element = new Element('foo'); $markup = $this->helper->render($element); @@ -35,7 +35,7 @@ public function testGeneratesTextInputTagWithElement() $this->assertStringContainsString('type="search"', $markup); } - public function testGeneratesTextInputTagRegardlessOfElementType() + public function testGeneratesTextInputTagRegardlessOfElementType(): void { $element = new Element('foo'); $element->setAttribute('type', 'email'); @@ -122,7 +122,7 @@ public function getCompleteElement(): Element /** * @dataProvider validAttributes */ - public function testAllValidFormMarkupAttributesPresentInElementAreRendered(string $attribute, string $assertion) + public function testAllValidFormMarkupAttributesPresentInElementAreRendered(string $attribute, string $assertion): void { $element = $this->getCompleteElement(); $markup = $this->helper->render($element); @@ -137,7 +137,7 @@ public function testAllValidFormMarkupAttributesPresentInElementAreRendered(stri $this->$assertion($expect, $markup); } - public function testInvokeProxiesToRender() + public function testInvokeProxiesToRender(): void { $element = new Element('foo'); $markup = $this->helper->__invoke($element); @@ -146,7 +146,7 @@ public function testInvokeProxiesToRender() $this->assertStringContainsString('type="search"', $markup); } - public function testInvokeWithNoElementChainsHelper() + public function testInvokeWithNoElementChainsHelper(): void { $this->assertSame($this->helper, $this->helper->__invoke()); } diff --git a/test/View/Helper/FormSelectTest.php b/test/View/Helper/FormSelectTest.php index 4e3be916c..0bc60fd00 100644 --- a/test/View/Helper/FormSelectTest.php +++ b/test/View/Helper/FormSelectTest.php @@ -49,7 +49,7 @@ public function getElement(): SelectElement return $element; } - public function testCreatesSelectWithOptionsFromAttribute() + public function testCreatesSelectWithOptionsFromAttribute(): void { $element = $this->getElement(); $markup = $this->helper->render($element); @@ -69,7 +69,7 @@ public function testCreatesSelectWithOptionsFromAttribute() $this->assertMatchesRegularExpression('#option .*?value="value3" class="test-class"#', $markup); } - public function testCanMarkSingleOptionAsSelected() + public function testCanMarkSingleOptionAsSelected(): void { $element = $this->getElement(); $element->setAttribute('value', 'value2'); @@ -80,7 +80,7 @@ public function testCanMarkSingleOptionAsSelected() $this->assertDoesNotMatchRegularExpression('#option .*?value="value3" selected="selected"#', $markup); } - public function testCanOnlyMarkSingleOptionAsSelectedIfMultipleAttributeIsDisabled() + public function testCanOnlyMarkSingleOptionAsSelectedIfMultipleAttributeIsDisabled(): void { $element = $this->getElement(); $element->setAttribute('value', ['value1', 'value2']); @@ -90,7 +90,7 @@ public function testCanOnlyMarkSingleOptionAsSelectedIfMultipleAttributeIsDisabl $markup = $this->helper->render($element); } - public function testCanMarkManyOptionsAsSelectedIfMultipleAttributeIsEnabled() + public function testCanMarkManyOptionsAsSelectedIfMultipleAttributeIsEnabled(): void { $element = $this->getElement(); $element->setAttribute('multiple', true); @@ -103,7 +103,7 @@ public function testCanMarkManyOptionsAsSelectedIfMultipleAttributeIsEnabled() $this->assertDoesNotMatchRegularExpression('#option .*?value="value3" selected="selected"#', $markup); } - public function testCanMarkOptionsAsDisabled() + public function testCanMarkOptionsAsDisabled(): void { $element = $this->getElement(); $options = $element->getValueOptions(); @@ -114,7 +114,7 @@ public function testCanMarkOptionsAsDisabled() $this->assertMatchesRegularExpression('#option .*?value="value2" .*?disabled="disabled"#', $markup); } - public function testCanMarkOptionsAsSelected() + public function testCanMarkOptionsAsSelected(): void { $element = $this->getElement(); $options = $element->getValueOptions(); @@ -125,7 +125,7 @@ public function testCanMarkOptionsAsSelected() $this->assertMatchesRegularExpression('#option .*?value="value2" .*?selected="selected"#', $markup); } - public function testOptgroupsAreCreatedWhenAnOptionHasAnOptionsKey() + public function testOptgroupsAreCreatedWhenAnOptionHasAnOptionsKey(): void { $element = $this->getElement(); $options = $element->getValueOptions(); @@ -143,7 +143,7 @@ public function testOptgroupsAreCreatedWhenAnOptionHasAnOptionsKey() // @codingStandardsIgnoreEnd } - public function testCanDisableAnOptgroup() + public function testCanDisableAnOptgroup(): void { $element = $this->getElement(); $options = $element->getValueOptions(); @@ -165,7 +165,7 @@ public function testCanDisableAnOptgroup() /** * @group Laminas-290 */ - public function testFalseDisabledValueWillNotRenderOptionsWithDisabledAttribute() + public function testFalseDisabledValueWillNotRenderOptionsWithDisabledAttribute(): void { $element = $this->getElement(); $element->setAttribute('disabled', false); @@ -177,7 +177,7 @@ public function testFalseDisabledValueWillNotRenderOptionsWithDisabledAttribute( /** * @group Laminas-290 */ - public function testOmittingDisabledValueWillNotRenderOptionsWithDisabledAttribute() + public function testOmittingDisabledValueWillNotRenderOptionsWithDisabledAttribute(): void { $element = $this->getElement(); $element->setAttribute('type', 'select'); @@ -186,7 +186,7 @@ public function testOmittingDisabledValueWillNotRenderOptionsWithDisabledAttribu $this->assertStringNotContainsString('disabled', $markup); } - public function testNameShouldHaveArrayNotationWhenMultipleIsSpecified() + public function testNameShouldHaveArrayNotationWhenMultipleIsSpecified(): void { $element = $this->getElement(); $element->setAttribute('multiple', true); @@ -210,7 +210,7 @@ public function getScalarOptionsDataProvider(): array * @group Laminas-338 * @dataProvider getScalarOptionsDataProvider */ - public function testScalarOptionValues(array $options) + public function testScalarOptionValues(array $options): void { $element = new SelectElement('foo'); $element->setValueOptions($options); @@ -219,13 +219,13 @@ public function testScalarOptionValues(array $options) $this->assertMatchesRegularExpression(sprintf('#option .*?value="%s"#', (string) $value), $markup); } - public function testInvokeWithNoElementChainsHelper() + public function testInvokeWithNoElementChainsHelper(): void { $element = $this->getElement(); $this->assertSame($this->helper, $this->helper->__invoke()); } - public function testCanTranslateContent() + public function testCanTranslateContent(): void { $element = new SelectElement('foo'); $element->setValueOptions([ @@ -248,7 +248,7 @@ public function testCanTranslateContent() $this->assertStringContainsString('>translated content<', $markup); } - public function testCanTranslateOptGroupLabel() + public function testCanTranslateOptGroupLabel(): void { $element = new SelectElement('test'); $element->setValueOptions([ @@ -285,7 +285,7 @@ public function testCanTranslateOptGroupLabel() $this->assertStringContainsString('>translated bar<', $markup); } - public function testTranslatorMethods() + public function testTranslatorMethods(): void { $translatorMock = $this->createMock(Translator::class); $this->helper->setTranslator($translatorMock, 'foo'); @@ -299,7 +299,7 @@ public function testTranslatorMethods() $this->assertFalse($this->helper->isTranslatorEnabled()); } - public function testDoesNotThrowExceptionIfNameIsZero() + public function testDoesNotThrowExceptionIfNameIsZero(): void { $element = $this->getElement(); $element->setName('0'); @@ -309,7 +309,7 @@ public function testDoesNotThrowExceptionIfNameIsZero() $this->assertStringContainsString('name="0"', $markup); } - public function testCanCreateEmptyOption() + public function testCanCreateEmptyOption(): void { $element = new SelectElement('foo'); $element->setEmptyOption('empty'); @@ -324,7 +324,7 @@ public function testCanCreateEmptyOption() $this->assertStringContainsString('', $markup); } - public function testCanCreateEmptyOptionWithEmptyString() + public function testCanCreateEmptyOptionWithEmptyString(): void { $element = new SelectElement('foo'); $element->setEmptyOption(''); @@ -339,7 +339,7 @@ public function testCanCreateEmptyOptionWithEmptyString() $this->assertStringContainsString('', $markup); } - public function testDoesNotRenderEmptyOptionByDefault() + public function testDoesNotRenderEmptyOptionByDefault(): void { $element = new SelectElement('foo'); $element->setValueOptions([ @@ -353,7 +353,7 @@ public function testDoesNotRenderEmptyOptionByDefault() $this->assertStringNotContainsString('', $markup); } - public function testNullEmptyOptionDoesNotRenderEmptyOption() + public function testNullEmptyOptionDoesNotRenderEmptyOption(): void { $element = new SelectElement('foo'); $element->setEmptyOption(null); @@ -368,7 +368,7 @@ public function testNullEmptyOptionDoesNotRenderEmptyOption() $this->assertStringNotContainsString('', $markup); } - public function testCanMarkOptionsAsSelectedWhenEmptyOptionOrZeroValueSelected() + public function testCanMarkOptionsAsSelectedWhenEmptyOptionOrZeroValueSelected(): void { $element = new SelectElement('foo'); $element->setEmptyOption('empty'); @@ -388,7 +388,7 @@ public function testCanMarkOptionsAsSelectedWhenEmptyOptionOrZeroValueSelected() $this->assertStringContainsString('', $markup); } - public function testHiddenElementWhenAttributeMultipleIsSet() + public function testHiddenElementWhenAttributeMultipleIsSet(): void { $element = new SelectElement('foo'); $element->setUseHiddenElement(true); @@ -398,14 +398,14 @@ public function testHiddenElementWhenAttributeMultipleIsSet() $this->assertStringContainsString('expectException(InvalidArgumentException::class); $this->helper->render($element); } - public function testRenderElementWithNoNameRaisesException() + public function testRenderElementWithNoNameRaisesException(): void { $element = new SelectElement(); @@ -430,7 +430,7 @@ public function getElementWithObjectIdentifiers(): SelectElement return $element; } - public function testRenderElementWithObjectIdentifiers() + public function testRenderElementWithObjectIdentifiers(): void { $element = $this->getElementWithObjectIdentifiers(); $element->setValue(new Identifier(42)); @@ -440,7 +440,7 @@ public function testRenderElementWithObjectIdentifiers() $this->assertDoesNotMatchRegularExpression('#option .*?value="43" selected="selected"#', $markup); } - public function testComparisonOfSelectedValuesIsPerformedInStrictMode() + public function testComparisonOfSelectedValuesIsPerformedInStrictMode(): void { $select = new SelectElement('language'); $select->setLabel('Which is your mother tongue?'); diff --git a/test/View/Helper/FormSubmitTest.php b/test/View/Helper/FormSubmitTest.php index 3e411fa47..7254ea6ef 100644 --- a/test/View/Helper/FormSubmitTest.php +++ b/test/View/Helper/FormSubmitTest.php @@ -20,7 +20,7 @@ protected function setUp(): void parent::setUp(); } - public function testRaisesExceptionWhenNameIsNotPresentInElement() + public function testRaisesExceptionWhenNameIsNotPresentInElement(): void { $element = new Element(); $this->expectException(DomainException::class); @@ -28,7 +28,7 @@ public function testRaisesExceptionWhenNameIsNotPresentInElement() $this->helper->render($element); } - public function testGeneratesSubmitInputTagWithElement() + public function testGeneratesSubmitInputTagWithElement(): void { $element = new Element('foo'); $markup = $this->helper->render($element); @@ -36,7 +36,7 @@ public function testGeneratesSubmitInputTagWithElement() $this->assertStringContainsString('type="submit"', $markup); } - public function testGeneratesSubmitInputTagRegardlessOfElementType() + public function testGeneratesSubmitInputTagRegardlessOfElementType(): void { $element = new Element('foo'); $element->setAttribute('type', 'email'); @@ -121,7 +121,7 @@ public function getCompleteElement(): Element /** * @dataProvider validAttributes */ - public function testAllValidFormMarkupAttributesPresentInElementAreRendered(string $attribute, string $assertion) + public function testAllValidFormMarkupAttributesPresentInElementAreRendered(string $attribute, string $assertion): void { $element = $this->getCompleteElement(); $markup = $this->helper->render($element); @@ -136,7 +136,7 @@ public function testAllValidFormMarkupAttributesPresentInElementAreRendered(stri $this->$assertion($expect, $markup); } - public function testInvokeProxiesToRender() + public function testInvokeProxiesToRender(): void { $element = new Element('foo'); $markup = $this->helper->__invoke($element); @@ -145,7 +145,7 @@ public function testInvokeProxiesToRender() $this->assertStringContainsString('type="submit"', $markup); } - public function testInvokeWithNoElementChainsHelper() + public function testInvokeWithNoElementChainsHelper(): void { $this->assertSame($this->helper, $this->helper->__invoke()); } @@ -153,7 +153,7 @@ public function testInvokeWithNoElementChainsHelper() /** * @group Laminas-450 */ - public function testCanTranslateValue() + public function testCanTranslateValue(): void { $element = new Element('foo'); $element->setValue('Submit Label'); diff --git a/test/View/Helper/FormTelTest.php b/test/View/Helper/FormTelTest.php index 5fce8547e..788841655 100644 --- a/test/View/Helper/FormTelTest.php +++ b/test/View/Helper/FormTelTest.php @@ -19,7 +19,7 @@ protected function setUp(): void parent::setUp(); } - public function testRaisesExceptionWhenNameIsNotPresentInElement() + public function testRaisesExceptionWhenNameIsNotPresentInElement(): void { $element = new Element(); $this->expectException(DomainException::class); @@ -27,7 +27,7 @@ public function testRaisesExceptionWhenNameIsNotPresentInElement() $this->helper->render($element); } - public function testGeneratesTelInputTagWithElement() + public function testGeneratesTelInputTagWithElement(): void { $element = new Element('foo'); $markup = $this->helper->render($element); @@ -35,7 +35,7 @@ public function testGeneratesTelInputTagWithElement() $this->assertStringContainsString('type="tel"', $markup); } - public function testGeneratesTelInputTagRegardlessOfElementType() + public function testGeneratesTelInputTagRegardlessOfElementType(): void { $element = new Element('foo'); $element->setAttribute('type', 'email'); @@ -122,7 +122,7 @@ public function getCompleteElement(): Element /** * @dataProvider validAttributes */ - public function testAllValidFormMarkupAttributesPresentInElementAreRendered(string $attribute, string $assertion) + public function testAllValidFormMarkupAttributesPresentInElementAreRendered(string $attribute, string $assertion): void { $element = $this->getCompleteElement(); $markup = $this->helper->render($element); @@ -137,7 +137,7 @@ public function testAllValidFormMarkupAttributesPresentInElementAreRendered(stri $this->$assertion($expect, $markup); } - public function testInvokeProxiesToRender() + public function testInvokeProxiesToRender(): void { $element = new Element('foo'); $markup = $this->helper->__invoke($element); @@ -146,7 +146,7 @@ public function testInvokeProxiesToRender() $this->assertStringContainsString('type="tel"', $markup); } - public function testInvokeWithNoElementChainsHelper() + public function testInvokeWithNoElementChainsHelper(): void { $this->assertSame($this->helper, $this->helper->__invoke()); } diff --git a/test/View/Helper/FormTest.php b/test/View/Helper/FormTest.php index c063ca4d6..eceb7174b 100644 --- a/test/View/Helper/FormTest.php +++ b/test/View/Helper/FormTest.php @@ -23,12 +23,12 @@ protected function setUp(): void parent::setUp(); } - public function testInvokeReturnsHelper() + public function testInvokeReturnsHelper(): void { $this->assertSame($this->helper, $this->helper->__invoke()); } - public function testCallingOpenTagWithoutProvidingFormResultsInEmptyActionAndGetMethod() + public function testCallingOpenTagWithoutProvidingFormResultsInEmptyActionAndGetMethod(): void { $markup = $this->helper->openTag(); $this->assertStringContainsString('assertStringContainsString('method="get"', $markup); } - public function testCallingCloseTagEmitsClosingFormTag() + public function testCallingCloseTagEmitsClosingFormTag(): void { $markup = $this->helper->closeTag(); $this->assertEquals('', $markup); } - public function testCallingOpenTagWithFormUsesFormAttributes() + public function testCallingOpenTagWithFormUsesFormAttributes(): void { $form = new Form(); $attributes = [ @@ -64,7 +64,7 @@ public function testCallingOpenTagWithFormUsesFormAttributes() } } - public function testOpenTagUsesNameAsIdIfNoIdAttributePresent() + public function testOpenTagUsesNameAsIdIfNoIdAttributePresent(): void { $form = new Form(); $attributes = [ @@ -77,7 +77,7 @@ public function testOpenTagUsesNameAsIdIfNoIdAttributePresent() $this->assertStringContainsString('id="login-form"', $markup); } - public function testRender() + public function testRender(): void { $form = new Form(); $attributes = ['name' => 'login-form']; @@ -95,7 +95,7 @@ public function testRender() $this->assertStringContainsString('', $markup); } - public function testRenderPreparesForm() + public function testRenderPreparesForm(): void { $form = $this->createMock(Form::class); $form->expects($this->once())->method('prepare'); @@ -108,7 +108,7 @@ public function testRenderPreparesForm() $this->assertStringContainsString('', $markup); } - public function testHtml5DoesNotAddEmptyActionAttributeToFormTag() + public function testHtml5DoesNotAddEmptyActionAttributeToFormTag(): void { $helper = new FormHelper(); @@ -124,7 +124,7 @@ public function testHtml5DoesNotAddEmptyActionAttributeToFormTag() $this->assertStringNotContainsString('action=""', $xhtml5Markup); } - public function testHtml5DoesNotSetDefaultMethodAttributeInFormTag() + public function testHtml5DoesNotSetDefaultMethodAttributeInFormTag(): void { $helper = new FormHelper(); diff --git a/test/View/Helper/FormTextTest.php b/test/View/Helper/FormTextTest.php index e752e588e..cefc270a4 100644 --- a/test/View/Helper/FormTextTest.php +++ b/test/View/Helper/FormTextTest.php @@ -19,7 +19,7 @@ protected function setUp(): void parent::setUp(); } - public function testRaisesExceptionWhenNameIsNotPresentInElement() + public function testRaisesExceptionWhenNameIsNotPresentInElement(): void { $element = new Element(); $this->expectException(DomainException::class); @@ -27,7 +27,7 @@ public function testRaisesExceptionWhenNameIsNotPresentInElement() $this->helper->render($element); } - public function testGeneratesTextInputTagWithElement() + public function testGeneratesTextInputTagWithElement(): void { $element = new Element('foo'); $markup = $this->helper->render($element); @@ -35,7 +35,7 @@ public function testGeneratesTextInputTagWithElement() $this->assertStringContainsString('type="text"', $markup); } - public function testGeneratesTextInputTagRegardlessOfElementType() + public function testGeneratesTextInputTagRegardlessOfElementType(): void { $element = new Element('foo'); $element->setAttribute('type', 'email'); @@ -124,7 +124,7 @@ public function getCompleteElement(): Element /** * @dataProvider validAttributes */ - public function testAllValidFormMarkupAttributesPresentInElementAreRendered(string $attribute, string $assertion) + public function testAllValidFormMarkupAttributesPresentInElementAreRendered(string $attribute, string $assertion): void { $element = $this->getCompleteElement(); $markup = $this->helper->render($element); @@ -139,7 +139,7 @@ public function testAllValidFormMarkupAttributesPresentInElementAreRendered(stri $this->$assertion($expect, $markup); } - public function testInvokeProxiesToRender() + public function testInvokeProxiesToRender(): void { $element = new Element('foo'); $markup = $this->helper->__invoke($element); @@ -148,7 +148,7 @@ public function testInvokeProxiesToRender() $this->assertStringContainsString('type="text"', $markup); } - public function testInvokeWithNoElementChainsHelper() + public function testInvokeWithNoElementChainsHelper(): void { $this->assertSame($this->helper, $this->helper->__invoke()); } diff --git a/test/View/Helper/FormTextareaTest.php b/test/View/Helper/FormTextareaTest.php index c73a29ec4..eccbb3b56 100644 --- a/test/View/Helper/FormTextareaTest.php +++ b/test/View/Helper/FormTextareaTest.php @@ -19,7 +19,7 @@ protected function setUp(): void parent::setUp(); } - public function testRaisesExceptionWhenNameIsNotPresentInElement() + public function testRaisesExceptionWhenNameIsNotPresentInElement(): void { $element = new Element(); $this->expectException(DomainException::class); @@ -27,7 +27,7 @@ public function testRaisesExceptionWhenNameIsNotPresentInElement() $this->helper->render($element); } - public function testGeneratesEmptyTextareaWhenNoValueAttributePresent() + public function testGeneratesEmptyTextareaWhenNoValueAttributePresent(): void { $element = new Element('foo'); $markup = $this->helper->render($element); @@ -239,7 +239,7 @@ public function getCompleteElement(): Element /** * @dataProvider validAttributes */ - public function testAllValidFormMarkupAttributesPresentInElementAreRendered(string $attribute, string $assertion) + public function testAllValidFormMarkupAttributesPresentInElementAreRendered(string $attribute, string $assertion): void { $element = $this->getCompleteElement(); $markup = $this->helper->render($element); @@ -261,7 +261,7 @@ public function booleanAttributeTypes(): array /** * @dataProvider booleanAttributeTypes */ - public function testBooleanAttributeTypesAreRenderedCorrectly(string $attribute, string $on, string $off) + public function testBooleanAttributeTypesAreRenderedCorrectly(string $attribute, string $on, string $off): void { $element = new Element('foo'); $element->setAttribute($attribute, true); @@ -326,7 +326,7 @@ public function testBooleanAttributeTypesAreRenderedCorrectlyWithoutValueForHtml string $attribute, string $on, string $off - ) { + ): void { $element = new Element('foo'); $this->renderer->doctype('HTML5'); $element->setAttribute($attribute, true); @@ -407,7 +407,7 @@ public function testBooleanAttributeTypesAreRenderedCorrectlyWithoutValueForHtml } } - public function testRendersValueAttributeAsTextareaContent() + public function testRendersValueAttributeAsTextareaContent(): void { $element = new Element('foo'); $element->setAttribute('value', 'Initial content'); @@ -415,7 +415,7 @@ public function testRendersValueAttributeAsTextareaContent() $this->assertStringContainsString('>Initial content', $markup); } - public function testInvokeProxiesToRender() + public function testInvokeProxiesToRender(): void { $element = new Element('foo'); $markup = $this->helper->__invoke($element); @@ -423,7 +423,7 @@ public function testInvokeProxiesToRender() $this->assertStringContainsString('name="foo"', $markup); } - public function testInvokeWithNoElementChainsHelper() + public function testInvokeWithNoElementChainsHelper(): void { $element = new Element('foo'); $this->assertSame($this->helper, $this->helper->__invoke()); diff --git a/test/View/Helper/FormTimeTest.php b/test/View/Helper/FormTimeTest.php index 168743674..f38c26a11 100644 --- a/test/View/Helper/FormTimeTest.php +++ b/test/View/Helper/FormTimeTest.php @@ -19,7 +19,7 @@ protected function setUp(): void parent::setUp(); } - public function testRaisesExceptionWhenNameIsNotPresentInElement() + public function testRaisesExceptionWhenNameIsNotPresentInElement(): void { $element = new Element(); $this->expectException(DomainException::class); @@ -27,7 +27,7 @@ public function testRaisesExceptionWhenNameIsNotPresentInElement() $this->helper->render($element); } - public function testGeneratesInputTagWithElement() + public function testGeneratesInputTagWithElement(): void { $element = new Element('foo'); $markup = $this->helper->render($element); @@ -35,7 +35,7 @@ public function testGeneratesInputTagWithElement() $this->assertStringContainsString('type="time"', $markup); } - public function testGeneratesInputTagRegardlessOfElementType() + public function testGeneratesInputTagRegardlessOfElementType(): void { $element = new Element('foo'); $element->setAttribute('type', 'email'); @@ -120,7 +120,7 @@ public function getCompleteElement(): Element /** * @dataProvider validAttributes */ - public function testAllValidFormMarkupAttributesPresentInElementAreRendered(string $attribute, string $assertion) + public function testAllValidFormMarkupAttributesPresentInElementAreRendered(string $attribute, string $assertion): void { $element = $this->getCompleteElement(); $markup = $this->helper->render($element); @@ -135,7 +135,7 @@ public function testAllValidFormMarkupAttributesPresentInElementAreRendered(stri $this->$assertion($expect, $markup); } - public function testInvokeProxiesToRender() + public function testInvokeProxiesToRender(): void { $element = new Element('foo'); $markup = $this->helper->__invoke($element); @@ -144,7 +144,7 @@ public function testInvokeProxiesToRender() $this->assertStringContainsString('type="time"', $markup); } - public function testInvokeWithNoElementChainsHelper() + public function testInvokeWithNoElementChainsHelper(): void { $this->assertSame($this->helper, $this->helper->__invoke()); } diff --git a/test/View/Helper/FormUrlTest.php b/test/View/Helper/FormUrlTest.php index d1833cfff..64043c081 100644 --- a/test/View/Helper/FormUrlTest.php +++ b/test/View/Helper/FormUrlTest.php @@ -19,7 +19,7 @@ protected function setUp(): void parent::setUp(); } - public function testRaisesExceptionWhenNameIsNotPresentInElement() + public function testRaisesExceptionWhenNameIsNotPresentInElement(): void { $element = new Element(); $this->expectException(DomainException::class); @@ -27,7 +27,7 @@ public function testRaisesExceptionWhenNameIsNotPresentInElement() $this->helper->render($element); } - public function testGeneratesUrlInputTagWithElement() + public function testGeneratesUrlInputTagWithElement(): void { $element = new Element('foo'); $markup = $this->helper->render($element); @@ -35,7 +35,7 @@ public function testGeneratesUrlInputTagWithElement() $this->assertStringContainsString('type="url"', $markup); } - public function testGeneratesUrlInputTagRegardlessOfElementType() + public function testGeneratesUrlInputTagRegardlessOfElementType(): void { $element = new Element('foo'); $element->setAttribute('type', 'email'); @@ -122,7 +122,7 @@ public function getCompleteElement(): Element /** * @dataProvider validAttributes */ - public function testAllValidFormMarkupAttributesPresentInElementAreRendered(string $attribute, string $assertion) + public function testAllValidFormMarkupAttributesPresentInElementAreRendered(string $attribute, string $assertion): void { $element = $this->getCompleteElement(); $markup = $this->helper->render($element); @@ -137,7 +137,7 @@ public function testAllValidFormMarkupAttributesPresentInElementAreRendered(stri $this->$assertion($expect, $markup); } - public function testInvokeProxiesToRender() + public function testInvokeProxiesToRender(): void { $element = new Element('foo'); $markup = $this->helper->__invoke($element); @@ -146,7 +146,7 @@ public function testInvokeProxiesToRender() $this->assertStringContainsString('type="url"', $markup); } - public function testInvokeWithNoElementChainsHelper() + public function testInvokeWithNoElementChainsHelper(): void { $this->assertSame($this->helper, $this->helper->__invoke()); } diff --git a/test/View/Helper/FormWeekTest.php b/test/View/Helper/FormWeekTest.php index 3c6d699c2..f5bd5f98f 100644 --- a/test/View/Helper/FormWeekTest.php +++ b/test/View/Helper/FormWeekTest.php @@ -19,7 +19,7 @@ protected function setUp(): void parent::setUp(); } - public function testRaisesExceptionWhenNameIsNotPresentInElement() + public function testRaisesExceptionWhenNameIsNotPresentInElement(): void { $element = new Element(); $this->expectException(DomainException::class); @@ -27,7 +27,7 @@ public function testRaisesExceptionWhenNameIsNotPresentInElement() $this->helper->render($element); } - public function testGeneratesInputTagWithElement() + public function testGeneratesInputTagWithElement(): void { $element = new Element('foo'); $markup = $this->helper->render($element); @@ -35,7 +35,7 @@ public function testGeneratesInputTagWithElement() $this->assertStringContainsString('type="week"', $markup); } - public function testGeneratesInputTagRegardlessOfElementType() + public function testGeneratesInputTagRegardlessOfElementType(): void { $element = new Element('foo'); $element->setAttribute('type', 'email'); @@ -120,7 +120,7 @@ public function getCompleteElement(): Element /** * @dataProvider validAttributes */ - public function testAllValidFormMarkupAttributesPresentInElementAreRendered(string $attribute, string $assertion) + public function testAllValidFormMarkupAttributesPresentInElementAreRendered(string $attribute, string $assertion): void { $element = $this->getCompleteElement(); $markup = $this->helper->render($element); @@ -135,7 +135,7 @@ public function testAllValidFormMarkupAttributesPresentInElementAreRendered(stri $this->$assertion($expect, $markup); } - public function testInvokeProxiesToRender() + public function testInvokeProxiesToRender(): void { $element = new Element('foo'); $markup = $this->helper->__invoke($element); @@ -144,7 +144,7 @@ public function testInvokeProxiesToRender() $this->assertStringContainsString('type="week"', $markup); } - public function testInvokeWithNoElementChainsHelper() + public function testInvokeWithNoElementChainsHelper(): void { $this->assertSame($this->helper, $this->helper->__invoke()); } diff --git a/test/View/Helper/MissingIntlExtensionTest.php b/test/View/Helper/MissingIntlExtensionTest.php index bdac1dcc6..052bc5d10 100644 --- a/test/View/Helper/MissingIntlExtensionTest.php +++ b/test/View/Helper/MissingIntlExtensionTest.php @@ -19,7 +19,7 @@ protected function setUp(): void } } - public function testFormDateSelectHelper() + public function testFormDateSelectHelper(): void { $this->expectException(ExtensionNotLoadedException::class); $this->expectExceptionMessage('Laminas\Form\View\Helper component requires the intl PHP extension'); @@ -27,7 +27,7 @@ public function testFormDateSelectHelper() $helper = new FormDateSelectHelper(); } - public function testFormDateTimeSelectHelper() + public function testFormDateTimeSelectHelper(): void { $this->expectException(ExtensionNotLoadedException::class); $this->expectExceptionMessage('Laminas\Form\View\Helper component requires the intl PHP extension'); @@ -35,7 +35,7 @@ public function testFormDateTimeSelectHelper() $helper = new FormDateTimeSelectHelper(); } - public function testFormMonthSelectHelper() + public function testFormMonthSelectHelper(): void { $this->expectException(ExtensionNotLoadedException::class); $this->expectExceptionMessage('Laminas\Form\View\Helper component requires the intl PHP extension'); From 6abe15db434aefa6b0c8a4922a08ab79d94e5375 Mon Sep 17 00:00:00 2001 From: Filippo Tessarotto Date: Wed, 26 May 2021 16:27:44 +0200 Subject: [PATCH 2/9] Fix emerged type Signed-off-by: Filippo Tessarotto --- src/Form.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Form.php b/src/Form.php index fefcff5dc..4d568888c 100644 --- a/src/Form.php +++ b/src/Form.php @@ -944,10 +944,13 @@ public function wrapElements() * {@inheritDoc} * * @param bool $onlyBase - * @param ArrayObject|array $data */ - public function populateValues($data, $onlyBase = false) + public function populateValues(iterable $data, $onlyBase = false) { + if ($data instanceof Traversable) { + $data = ArrayUtils::iteratorToArray($data); + } + if ($onlyBase && $this->baseFieldset !== null) { $name = $this->baseFieldset->getName(); if (array_key_exists($name, $data)) { From ba32d3ddeaf81f09375e7d6efdc6220d8d6afec4 Mon Sep 17 00:00:00 2001 From: Filippo Tessarotto Date: Thu, 27 May 2021 09:33:06 +0200 Subject: [PATCH 3/9] Tests ok Signed-off-by: Filippo Tessarotto --- .../AbstractAnnotationsListener.php | 2 +- src/Annotation/AbstractBuilder.php | 22 ++++++------- src/Annotation/BuilderAbstractFactory.php | 8 ++--- src/Annotation/ElementAnnotationsListener.php | 30 ++++++++--------- src/Annotation/FormAnnotationsListener.php | 14 ++++---- src/ConfigProvider.php | 6 ++-- src/Element.php | 18 +++++------ src/Element/Captcha.php | 4 +-- src/Element/Checkbox.php | 12 +++---- src/Element/Collection.php | 30 ++++++++--------- src/Element/Color.php | 4 +-- src/Element/Csrf.php | 8 ++--- src/Element/DateSelect.php | 14 ++++---- src/Element/DateTime.php | 8 ++--- src/Element/DateTimeSelect.php | 22 ++++++------- src/Element/Email.php | 6 ++-- src/Element/File.php | 4 +-- src/Element/MonthSelect.php | 26 +++++++-------- src/Element/MultiCheckbox.php | 8 ++--- src/Element/Number.php | 4 +-- src/Element/Password.php | 2 +- src/Element/Radio.php | 4 +-- src/Element/Range.php | 2 +- src/Element/Select.php | 18 +++++------ src/Element/Tel.php | 4 +-- src/Element/Url.php | 4 +-- src/Element/Week.php | 2 +- src/ElementFactory.php | 2 +- src/ElementInterface.php | 8 ++--- src/Factory.php | 32 +++++++++---------- src/Fieldset.php | 27 ++++++++-------- src/FieldsetInterface.php | 12 +++---- src/Form.php | 32 +++++++++---------- src/FormAbstractServiceFactory.php | 10 +++--- src/FormElementManager.php | 6 ++-- src/FormElementManagerFactory.php | 2 +- src/FormInterface.php | 4 +-- src/LabelAwareInterface.php | 8 ++--- src/LabelAwareTrait.php | 8 ++--- src/Module.php | 5 ++- src/View/Helper/AbstractHelper.php | 27 ++++++++-------- src/View/Helper/Captcha/AbstractWord.php | 10 +++--- src/View/Helper/Captcha/Dumb.php | 2 +- src/View/Helper/Captcha/Figlet.php | 2 +- src/View/Helper/Captcha/Image.php | 2 +- src/View/Helper/Captcha/ReCaptcha.php | 6 ++-- src/View/Helper/File/FormFileApcProgress.php | 5 +-- .../Helper/File/FormFileSessionProgress.php | 2 +- .../Helper/File/FormFileUploadProgress.php | 8 ++--- src/View/Helper/Form.php | 6 ++-- src/View/Helper/FormButton.php | 8 ++--- src/View/Helper/FormCaptcha.php | 2 +- src/View/Helper/FormCheckbox.php | 4 +-- src/View/Helper/FormCollection.php | 18 +++++------ src/View/Helper/FormColor.php | 2 +- src/View/Helper/FormDate.php | 4 +-- src/View/Helper/FormDateSelect.php | 4 +-- src/View/Helper/FormDateTime.php | 2 +- src/View/Helper/FormDateTimeLocal.php | 2 +- src/View/Helper/FormDateTimeSelect.php | 14 ++++---- src/View/Helper/FormElement.php | 8 ++--- src/View/Helper/FormElementErrors.php | 16 +++++----- src/View/Helper/FormEmail.php | 2 +- src/View/Helper/FormFile.php | 4 +-- src/View/Helper/FormHidden.php | 2 +- src/View/Helper/FormImage.php | 4 +-- src/View/Helper/FormInput.php | 4 +-- src/View/Helper/FormLabel.php | 4 +-- src/View/Helper/FormMonth.php | 2 +- src/View/Helper/FormMonthSelect.php | 16 +++++----- src/View/Helper/FormMultiCheckbox.php | 24 +++++++------- src/View/Helper/FormNumber.php | 2 +- src/View/Helper/FormPassword.php | 2 +- src/View/Helper/FormRadio.php | 4 +-- src/View/Helper/FormRange.php | 2 +- src/View/Helper/FormReset.php | 2 +- src/View/Helper/FormRow.php | 18 +++++------ src/View/Helper/FormSearch.php | 2 +- src/View/Helper/FormSelect.php | 10 +++--- src/View/Helper/FormSubmit.php | 3 +- src/View/Helper/FormTel.php | 2 +- src/View/Helper/FormText.php | 2 +- src/View/Helper/FormTextarea.php | 2 +- src/View/Helper/FormTime.php | 2 +- src/View/Helper/FormUrl.php | 2 +- src/View/Helper/FormWeek.php | 2 +- test/Integration/TestAsset/Form.php | 2 +- test/LabelAwareTraitTest.php | 6 ++-- test/TestAsset/FieldsetWithDependency.php | 2 +- test/TestAsset/ValueStoringFieldset.php | 2 +- test/View/Helper/FormTest.php | 3 +- 91 files changed, 359 insertions(+), 371 deletions(-) diff --git a/src/Annotation/AbstractAnnotationsListener.php b/src/Annotation/AbstractAnnotationsListener.php index 0098e716d..2f0c16556 100644 --- a/src/Annotation/AbstractAnnotationsListener.php +++ b/src/Annotation/AbstractAnnotationsListener.php @@ -51,7 +51,7 @@ public function handleNameAnnotation($e) * @param EventInterface $e * @return string */ - public function discoverFallbackName($e) + public function discoverFallbackName($e): string { $reflection = $e->getParam('reflection'); if ($reflection instanceof ReflectionClass) { diff --git a/src/Annotation/AbstractBuilder.php b/src/Annotation/AbstractBuilder.php index a33064d72..cebf1d857 100644 --- a/src/Annotation/AbstractBuilder.php +++ b/src/Annotation/AbstractBuilder.php @@ -59,7 +59,7 @@ public function setFormFactory(Factory $formFactory) * * @return void */ - public function setEventManager(EventManagerInterface $eventManager) + public function setEventManager(EventManagerInterface $eventManager): void { $eventManager->setIdentifiers([ self::class, @@ -77,7 +77,7 @@ public function setEventManager(EventManagerInterface $eventManager) * * @return Factory */ - public function getFormFactory() + public function getFormFactory(): Factory { if ($this->formFactory) { return $this->formFactory; @@ -92,7 +92,7 @@ public function getFormFactory() * * @return EventManagerInterface */ - public function getEventManager() + public function getEventManager(): EventManagerInterface { if (null === $this->eventManager) { $this->setEventManager(new EventManager()); @@ -107,7 +107,7 @@ public function getEventManager() * @throws Exception\InvalidArgumentException If $entity is not an object or class name. * @return ArrayObject */ - public function getFormSpecification($entity) + public function getFormSpecification($entity): ArrayObject { if (! is_object($entity)) { if ( @@ -151,7 +151,7 @@ abstract protected function getFormSpecificationInternal($entity): array; * @param string|object $entity * @return FormInterface */ - public function createForm($entity) + public function createForm($entity): FormInterface { $formSpec = ArrayUtils::iteratorToArray($this->getFormSpecification($entity)); $formFactory = $this->getFormFactory(); @@ -163,7 +163,7 @@ public function createForm($entity) * * @return object */ - public function getEntity() + public function getEntity(): object { return $this->entity; } @@ -179,7 +179,7 @@ public function getEntity() * @triggers discoverName * @triggers configureForm */ - protected function configureForm($annotations, $reflection, $formSpec, $filterSpec) + protected function configureForm($annotations, $reflection, $formSpec, $filterSpec): void { $name = $this->discoverName($annotations, $reflection); $formSpec['name'] = $name; @@ -210,7 +210,7 @@ protected function configureForm($annotations, $reflection, $formSpec, $filterSp * @triggers discoverName * @triggers configureElement */ - protected function configureElement($annotations, $reflection, $formSpec, $filterSpec) + protected function configureElement($annotations, $reflection, $formSpec, $filterSpec): void { // If the element is marked as exclude, return early if ($this->checkForExclude($annotations)) { @@ -283,7 +283,7 @@ public function setPreserveDefinedOrder($preserveDefinedOrder) /** * @return bool */ - public function preserveDefinedOrder() + public function preserveDefinedOrder(): bool { return $this->preserveDefinedOrder; } @@ -295,7 +295,7 @@ public function preserveDefinedOrder() * @param Reflector $reflection * @return string */ - protected function discoverName($annotations, $reflection) + protected function discoverName($annotations, $reflection): string { $event = new Event(); $event->setName(__FUNCTION__); @@ -323,7 +323,7 @@ static function ($r) { * @param AnnotationCollection $annotations * @return true|false */ - protected function checkForExclude($annotations) + protected function checkForExclude($annotations): bool { $event = new Event(); $event->setName(__FUNCTION__); diff --git a/src/Annotation/BuilderAbstractFactory.php b/src/Annotation/BuilderAbstractFactory.php index 761735043..da9ee0a28 100644 --- a/src/Annotation/BuilderAbstractFactory.php +++ b/src/Annotation/BuilderAbstractFactory.php @@ -27,7 +27,7 @@ class BuilderAbstractFactory implements AbstractFactoryInterface * @return AnnotationBuilder * @throws ServiceNotCreatedException For invalid listener configuration. */ - public function __invoke(ContainerInterface $container, $requestedName, ?array $options = null) + public function __invoke(ContainerInterface $container, $requestedName, ?array $options = null): AnnotationBuilder { // resolve aliases used in laminas servicemanager if (isset($this->aliases[$requestedName])) { @@ -55,7 +55,7 @@ public function __invoke(ContainerInterface $container, $requestedName, ?array $ * @param string $requestedName * @return bool */ - public function canCreate(ContainerInterface $container, $requestedName) + public function canCreate(ContainerInterface $container, $requestedName): bool { return isset($this->aliases[$requestedName]) || is_subclass_of($requestedName, AbstractBuilder::class); } @@ -73,7 +73,7 @@ public function canCreate(ContainerInterface $container, $requestedName) * * @return array */ - private function marshalConfig(ContainerInterface $container) + private function marshalConfig(ContainerInterface $container): array { if (! $container->has('config')) { return []; @@ -98,7 +98,7 @@ private function marshalConfig(ContainerInterface $container) * @return void * @throws ServiceNotCreatedException If any listener is not an event listener aggregate. */ - private function injectListeners(array $config, EventManagerInterface $events, ContainerInterface $container) + private function injectListeners(array $config, EventManagerInterface $events, ContainerInterface $container): void { if (! isset($config['listeners'])) { return; diff --git a/src/Annotation/ElementAnnotationsListener.php b/src/Annotation/ElementAnnotationsListener.php index 5487361c0..5ec939528 100644 --- a/src/Annotation/ElementAnnotationsListener.php +++ b/src/Annotation/ElementAnnotationsListener.php @@ -73,7 +73,7 @@ public function attach(EventManagerInterface $events, $priority = 1) * @param EventInterface $e * @return void */ - public function handleAllowEmptyAnnotation($e) + public function handleAllowEmptyAnnotation($e): void { $annotation = $e->getParam('annotation'); if (! $annotation instanceof AllowEmpty) { @@ -92,7 +92,7 @@ public function handleAllowEmptyAnnotation($e) * @param EventInterface $e * @return void */ - public function handleAttributesAnnotation($e) + public function handleAttributesAnnotation($e): void { $annotation = $e->getParam('annotation'); if (! $annotation instanceof Attributes) { @@ -117,7 +117,7 @@ public function handleAttributesAnnotation($e) * @param EventInterface $e * @return void */ - public function handleComposedObjectAnnotation($e) + public function handleComposedObjectAnnotation($e): void { $annotation = $e->getParam('annotation'); if (! $annotation instanceof ComposedObject) { @@ -191,7 +191,7 @@ public function handleComposedObjectAnnotation($e) * @param EventInterface $e * @return void */ - public function handleContinueIfEmptyAnnotation($e) + public function handleContinueIfEmptyAnnotation($e): void { $annotation = $e->getParam('annotation'); if (! $annotation instanceof ContinueIfEmpty) { @@ -210,7 +210,7 @@ public function handleContinueIfEmptyAnnotation($e) * @param EventInterface $e * @return void */ - public function handleErrorMessageAnnotation($e) + public function handleErrorMessageAnnotation($e): void { $annotation = $e->getParam('annotation'); if (! $annotation instanceof ErrorMessage) { @@ -227,7 +227,7 @@ public function handleErrorMessageAnnotation($e) * @param EventInterface $e * @return bool */ - public function handleExcludeAnnotation($e) + public function handleExcludeAnnotation($e): bool { $annotations = $e->getParam('annotations'); assert($annotations instanceof AnnotationCollection); @@ -246,7 +246,7 @@ public function handleExcludeAnnotation($e) * @param EventInterface $e * @return void */ - public function handleFilterAnnotation($e) + public function handleFilterAnnotation($e): void { $annotation = $e->getParam('annotation'); if (! $annotation instanceof Filter) { @@ -269,7 +269,7 @@ public function handleFilterAnnotation($e) * @param EventInterface $e * @return void */ - public function handleFlagsAnnotation($e) + public function handleFlagsAnnotation($e): void { $annotation = $e->getParam('annotation'); if (! $annotation instanceof Flags) { @@ -288,7 +288,7 @@ public function handleFlagsAnnotation($e) * @param EventInterface $e * @return void */ - public function handleHydratorAnnotation($e) + public function handleHydratorAnnotation($e): void { $annotation = $e->getParam('annotation'); if (! $annotation instanceof Hydrator) { @@ -308,7 +308,7 @@ public function handleHydratorAnnotation($e) * @param EventInterface $e * @return void */ - public function handleInputAnnotation($e) + public function handleInputAnnotation($e): void { $annotation = $e->getParam('annotation'); if (! $annotation instanceof Input) { @@ -343,7 +343,7 @@ public function handleInstanceAnnotation(EventInterface $e): void * @param EventInterface $e * @return void */ - public function handleOptionsAnnotation($e) + public function handleOptionsAnnotation($e): void { $annotation = $e->getParam('annotation'); if (! $annotation instanceof Options) { @@ -362,7 +362,7 @@ public function handleOptionsAnnotation($e) * @param EventInterface $e * @return void */ - public function handleRequiredAnnotation($e) + public function handleRequiredAnnotation($e): void { $annotation = $e->getParam('annotation'); if (! $annotation instanceof Required) { @@ -391,7 +391,7 @@ public function handleRequiredAnnotation($e) * @param EventInterface $e * @return void */ - public function handleTypeAnnotation($e) + public function handleTypeAnnotation($e): void { $annotation = $e->getParam('annotation'); if (! $annotation instanceof Type) { @@ -410,7 +410,7 @@ public function handleTypeAnnotation($e) * @param EventInterface $e * @return void */ - public function handleValidatorAnnotation($e) + public function handleValidatorAnnotation($e): void { $annotation = $e->getParam('annotation'); if (! $annotation instanceof Validator) { @@ -429,7 +429,7 @@ public function handleValidatorAnnotation($e) * @param ComposedObject|Options $annotation * @return array */ - private function mergeOptions($elementSpec, $annotation) + private function mergeOptions($elementSpec, $annotation): array { if (isset($elementSpec['spec']['options'])) { if (is_array($elementSpec['spec']['options'])) { diff --git a/src/Annotation/FormAnnotationsListener.php b/src/Annotation/FormAnnotationsListener.php index 1b964507e..c001fe335 100644 --- a/src/Annotation/FormAnnotationsListener.php +++ b/src/Annotation/FormAnnotationsListener.php @@ -53,7 +53,7 @@ public function attach(EventManagerInterface $events, $priority = 1) * @param EventInterface $e * @return void */ - public function handleAttributesAnnotation($e) + public function handleAttributesAnnotation($e): void { $annotation = $e->getParam('annotation'); if (! $annotation instanceof Attributes) { @@ -72,7 +72,7 @@ public function handleAttributesAnnotation($e) * @param EventInterface $e * @return void */ - public function handleFlagsAnnotation($e) + public function handleFlagsAnnotation($e): void { $annotation = $e->getParam('annotation'); if (! $annotation instanceof Flags) { @@ -91,7 +91,7 @@ public function handleFlagsAnnotation($e) * @param EventInterface $e * @return void */ - public function handleHydratorAnnotation($e) + public function handleHydratorAnnotation($e): void { $annotation = $e->getParam('annotation'); if (! $annotation instanceof Hydrator) { @@ -110,7 +110,7 @@ public function handleHydratorAnnotation($e) * @param EventInterface $e * @return void */ - public function handleInputFilterAnnotation($e) + public function handleInputFilterAnnotation($e): void { $annotation = $e->getParam('annotation'); if (! $annotation instanceof InputFilter) { @@ -145,7 +145,7 @@ public function handleInstanceAnnotation(EventInterface $e): void * @param EventInterface $e * @return void */ - public function handleOptionsAnnotation($e) + public function handleOptionsAnnotation($e): void { $annotation = $e->getParam('annotation'); if (! $annotation instanceof Options) { @@ -164,7 +164,7 @@ public function handleOptionsAnnotation($e) * @param EventInterface $e * @return void */ - public function handleTypeAnnotation($e) + public function handleTypeAnnotation($e): void { $annotation = $e->getParam('annotation'); if (! $annotation instanceof Type) { @@ -183,7 +183,7 @@ public function handleTypeAnnotation($e) * @param EventInterface $e * @return void */ - public function handleValidationGroupAnnotation($e) + public function handleValidationGroupAnnotation($e): void { $annotation = $e->getParam('annotation'); if (! $annotation instanceof ValidationGroup) { diff --git a/src/ConfigProvider.php b/src/ConfigProvider.php index e12c62856..755ef8067 100644 --- a/src/ConfigProvider.php +++ b/src/ConfigProvider.php @@ -11,7 +11,7 @@ class ConfigProvider * * @return array */ - public function __invoke() + public function __invoke(): array { return [ 'dependencies' => $this->getDependencyConfig(), @@ -24,7 +24,7 @@ public function __invoke() * * @return array */ - public function getDependencyConfig() + public function getDependencyConfig(): array { return [ 'abstract_factories' => [ @@ -56,7 +56,7 @@ public function getDependencyConfig() * * @return array */ - public function getViewHelperConfig() + public function getViewHelperConfig(): array { return [ 'aliases' => [ diff --git a/src/Element.php b/src/Element.php index f900d6e5f..60f76bdb7 100644 --- a/src/Element.php +++ b/src/Element.php @@ -65,7 +65,7 @@ public function __construct($name = null, iterable $options = []) * * @return void */ - public function init() + public function init(): void { } @@ -86,7 +86,7 @@ public function setName($name) * * @return null|string */ - public function getName() + public function getName(): ?string { return $this->getAttribute('name'); } @@ -128,7 +128,7 @@ public function setOptions(iterable $options) * * @return array */ - public function getOptions() + public function getOptions(): array { return $this->options; } @@ -212,7 +212,7 @@ public function removeAttribute($key) * @param string $key * @return bool */ - public function hasAttribute($key) + public function hasAttribute($key): bool { return array_key_exists($key, $this->attributes); } @@ -311,7 +311,7 @@ public function setLabel($label) * * @return null|string */ - public function getLabel() + public function getLabel(): ?string { return $this->label; } @@ -333,7 +333,7 @@ public function setLabelAttributes(array $labelAttributes) * * @return array */ - public function getLabelAttributes() + public function getLabelAttributes(): array { return $this->labelAttributes; } @@ -359,7 +359,7 @@ public function setLabelOptions(iterable $arrayOrTraversable) * * @return array */ - public function getLabelOptions() + public function getLabelOptions(): array { return $this->labelOptions; } @@ -436,7 +436,7 @@ public function removeLabelOption($key) * @param string $key * @return bool */ - public function hasLabelOption($key) + public function hasLabelOption($key): bool { return array_key_exists($key, $this->labelOptions); } @@ -469,7 +469,7 @@ public function getMessages(): array /** * @return boolean */ - public function hasValue() + public function hasValue(): bool { return $this->hasValue; } diff --git a/src/Element/Captcha.php b/src/Element/Captcha.php index b653d9fc7..e15c107b6 100644 --- a/src/Element/Captcha.php +++ b/src/Element/Captcha.php @@ -66,7 +66,7 @@ public function setCaptcha($captcha) * * @return null|LaminasCaptcha\AdapterInterface */ - public function getCaptcha() + public function getCaptcha(): ?LaminasCaptcha\AdapterInterface { return $this->captcha; } @@ -78,7 +78,7 @@ public function getCaptcha() * * @return array */ - public function getInputSpecification() + public function getInputSpecification(): array { $spec = [ 'name' => $this->getName(), diff --git a/src/Element/Checkbox.php b/src/Element/Checkbox.php index 90b1a85b3..eb1abf9b4 100644 --- a/src/Element/Checkbox.php +++ b/src/Element/Checkbox.php @@ -74,7 +74,7 @@ public function setUseHiddenElement($useHiddenElement) * * @return bool */ - public function useHiddenElement() + public function useHiddenElement(): bool { return $this->useHiddenElement; } @@ -96,7 +96,7 @@ public function setUncheckedValue($uncheckedValue) * * @return string */ - public function getUncheckedValue() + public function getUncheckedValue(): string { return $this->uncheckedValue; } @@ -118,7 +118,7 @@ public function setCheckedValue($checkedValue) * * @return string */ - public function getCheckedValue() + public function getCheckedValue(): string { return $this->checkedValue; } @@ -128,7 +128,7 @@ public function getCheckedValue() * * @return ValidatorInterface */ - protected function getValidator() + protected function getValidator(): ?ValidatorInterface { if (null === $this->validator) { $this->validator = new InArrayValidator([ @@ -146,7 +146,7 @@ protected function getValidator() * * @return array */ - public function getInputSpecification() + public function getInputSpecification(): array { $spec = [ 'name' => $this->getName(), @@ -167,7 +167,7 @@ public function getInputSpecification() * * @return bool */ - public function isChecked() + public function isChecked(): bool { return $this->value === $this->getCheckedValue(); } diff --git a/src/Element/Collection.php b/src/Element/Collection.php index eab6b9bec..0a1a281fe 100644 --- a/src/Element/Collection.php +++ b/src/Element/Collection.php @@ -154,7 +154,7 @@ public function setOptions(iterable $options) * @param object $object * @return bool */ - public function allowObjectBinding($object) + public function allowObjectBinding($object): bool { return true; } @@ -192,7 +192,7 @@ public function setObject($object) * @throws Exception\DomainException * @return void */ - public function populateValues(iterable $data) + public function populateValues(iterable $data): void { if ($data instanceof Traversable) { $data = ArrayUtils::iteratorToArray($data); @@ -259,7 +259,7 @@ public function populateValues(iterable $data) * * @return bool */ - public function allowValueBinding() + public function allowValueBinding(): bool { return true; } @@ -304,7 +304,7 @@ public function setCount($count) * * @return int */ - public function getCount() + public function getCount(): int { return $this->count; } @@ -345,7 +345,7 @@ public function setTargetElement($elementOrFieldset) * * @return ElementInterface|null */ - public function getTargetElement() + public function getTargetElement(): ?ElementInterface { return $this->targetElement; } @@ -367,7 +367,7 @@ public function setAllowAdd($allowAdd) * * @return bool */ - public function allowAdd() + public function allowAdd(): bool { return $this->allowAdd; } @@ -385,7 +385,7 @@ public function setAllowRemove($allowRemove) /** * @return bool */ - public function allowRemove() + public function allowRemove(): bool { return $this->allowRemove; } @@ -409,7 +409,7 @@ public function setShouldCreateTemplate($shouldCreateTemplate) * * @return bool */ - public function shouldCreateTemplate() + public function shouldCreateTemplate(): bool { return $this->shouldCreateTemplate; } @@ -434,7 +434,7 @@ public function setTemplatePlaceholder($templatePlaceholder) * * @return string */ - public function getTemplatePlaceholder() + public function getTemplatePlaceholder(): string { return $this->templatePlaceholder; } @@ -452,7 +452,7 @@ public function setCreateNewObjects($createNewObjects) /** * @return bool */ - public function createNewObjects() + public function createNewObjects(): bool { return $this->createNewObjects; } @@ -476,7 +476,7 @@ public function getTemplateElement() * * @return void */ - public function prepareElement(FormInterface $form) + public function prepareElement(FormInterface $form): void { if (true === $this->shouldCreateChildrenOnPrepareElement) { if ($this->targetElement !== null && $this->count > 0) { @@ -508,7 +508,7 @@ public function prepareElement(FormInterface $form) * @throws Exception\DomainException * @throws Exception\InvalidElementException */ - public function extract() + public function extract(): array { if ($this->object instanceof Traversable) { $this->object = ArrayUtils::iteratorToArray($this->object, false); @@ -559,7 +559,7 @@ public function extract() * * @return ElementInterface */ - protected function createNewTargetElementInstance() + protected function createNewTargetElementInstance(): ElementInterface { return clone $this->targetElement; } @@ -571,7 +571,7 @@ protected function createNewTargetElementInstance() * @return ElementInterface * @throws Exception\DomainException */ - protected function addNewTargetElementInstance($name) + protected function addNewTargetElementInstance($name): ElementInterface { $this->shouldCreateChildrenOnPrepareElement = false; @@ -618,7 +618,7 @@ protected function createTemplateElement() * * @return void */ - protected function replaceTemplateObjects() + protected function replaceTemplateObjects(): void { $fieldsets = $this->getFieldsets(); diff --git a/src/Element/Color.php b/src/Element/Color.php index 7700437ce..a60ddda8f 100644 --- a/src/Element/Color.php +++ b/src/Element/Color.php @@ -28,7 +28,7 @@ class Color extends Element implements InputProviderInterface * * @return ValidatorInterface */ - protected function getValidator() + protected function getValidator(): ValidatorInterface { if (null === $this->validator) { $this->validator = new RegexValidator('/^#[0-9a-fA-F]{6}$/'); @@ -43,7 +43,7 @@ protected function getValidator() * * @return array */ - public function getInputSpecification() + public function getInputSpecification(): array { return [ 'name' => $this->getName(), diff --git a/src/Element/Csrf.php b/src/Element/Csrf.php index 11f99fa1f..222d89c7c 100644 --- a/src/Element/Csrf.php +++ b/src/Element/Csrf.php @@ -48,7 +48,7 @@ public function setOptions(iterable $options) /** * @return array */ - public function getCsrfValidatorOptions() + public function getCsrfValidatorOptions(): array { return $this->csrfValidatorOptions; } @@ -68,7 +68,7 @@ public function setCsrfValidatorOptions(array $options) * * @return CsrfValidator */ - public function getCsrfValidator() + public function getCsrfValidator(): CsrfValidator { if (null === $this->csrfValidator) { $csrfOptions = $this->getCsrfValidatorOptions(); @@ -94,7 +94,7 @@ public function setCsrfValidator(CsrfValidator $validator) * * @return string */ - public function getValue() + public function getValue(): string { $validator = $this->getCsrfValidator(); return $validator->getHash(); @@ -120,7 +120,7 @@ public function getAttributes(): array * * @return array */ - public function getInputSpecification() + public function getInputSpecification(): array { return [ 'name' => $this->getName(), diff --git a/src/Element/DateSelect.php b/src/Element/DateSelect.php index b9b802f15..fd400a52a 100644 --- a/src/Element/DateSelect.php +++ b/src/Element/DateSelect.php @@ -56,7 +56,7 @@ public function setOptions(iterable $options) /** * @return Select */ - public function getDayElement() + public function getDayElement(): Select { return $this->dayElement; } @@ -66,7 +66,7 @@ public function getDayElement() * * @return array */ - public function getElements() + public function getElements(): array { return array_merge([$this->dayElement], parent::getElements()); } @@ -88,7 +88,7 @@ public function setDayAttributes(array $dayAttributes) * * @return array */ - public function getDayAttributes() + public function getDayAttributes(): array { return $this->dayElement->getAttributes(); } @@ -126,7 +126,7 @@ public function setValue($value) /** * @return String */ - public function getValue() + public function getValue(): String { return sprintf( '%s-%s-%s', @@ -141,7 +141,7 @@ public function getValue() * * @return void */ - public function prepareElement(FormInterface $form) + public function prepareElement(FormInterface $form): void { parent::prepareElement($form); @@ -154,7 +154,7 @@ public function prepareElement(FormInterface $form) * * @return ValidatorInterface */ - protected function getValidator() + protected function getValidator(): ValidatorInterface { if (null === $this->validator) { $this->validator = new DateValidator(['format' => 'Y-m-d']); @@ -169,7 +169,7 @@ protected function getValidator() * * @return array */ - public function getInputSpecification() + public function getInputSpecification(): array { return [ 'name' => $this->getName(), diff --git a/src/Element/DateTime.php b/src/Element/DateTime.php index 935071c2e..5ccb3f82c 100644 --- a/src/Element/DateTime.php +++ b/src/Element/DateTime.php @@ -98,7 +98,7 @@ public function setFormat($format) * * @return string */ - public function getFormat() + public function getFormat(): string { return $this->format; } @@ -108,7 +108,7 @@ public function getFormat() * * @return array */ - protected function getValidators() + protected function getValidators(): array { if ($this->validators) { return $this->validators; @@ -199,7 +199,7 @@ protected function getStepValidator(): ValidatorInterface * * @return array */ - public function getInputSpecification() + public function getInputSpecification(): array { return [ 'name' => $this->getName(), @@ -217,7 +217,7 @@ public function getInputSpecification() * @param string $value * @return bool */ - private function valueIsValidDateTimeFormat($value) + private function valueIsValidDateTimeFormat($value): bool { return PhpDateTime::createFromFormat( $this->format, diff --git a/src/Element/DateTimeSelect.php b/src/Element/DateTimeSelect.php index af7615d45..884c0ac1f 100644 --- a/src/Element/DateTimeSelect.php +++ b/src/Element/DateTimeSelect.php @@ -95,7 +95,7 @@ public function setOptions(iterable $options) /** * @return Select */ - public function getHourElement() + public function getHourElement(): Select { return $this->hourElement; } @@ -103,7 +103,7 @@ public function getHourElement() /** * @return Select */ - public function getMinuteElement() + public function getMinuteElement(): Select { return $this->minuteElement; } @@ -111,7 +111,7 @@ public function getMinuteElement() /** * @return Select */ - public function getSecondElement() + public function getSecondElement(): Select { return $this->secondElement; } @@ -133,7 +133,7 @@ public function setHourAttributes(array $hourAttributes) * * @return array */ - public function getHourAttributes() + public function getHourAttributes(): array { return $this->hourElement->getAttributes(); } @@ -155,7 +155,7 @@ public function setMinuteAttributes(array $minuteAttributes) * * @return array */ - public function getMinuteAttributes() + public function getMinuteAttributes(): array { return $this->minuteElement->getAttributes(); } @@ -177,7 +177,7 @@ public function setSecondAttributes(array $secondAttributes) * * @return array */ - public function getSecondAttributes() + public function getSecondAttributes(): array { return $this->secondElement->getAttributes(); } @@ -198,7 +198,7 @@ public function setShouldShowSeconds($shouldShowSeconds) /** * @return bool */ - public function shouldShowSeconds() + public function shouldShowSeconds(): bool { return $this->shouldShowSeconds; } @@ -250,7 +250,7 @@ public function setValue($value) /** * @return string */ - public function getValue() + public function getValue(): string { return sprintf( '%s-%s-%s %s:%s:%s', @@ -268,7 +268,7 @@ public function getValue() * * @return void */ - public function prepareElement(FormInterface $form) + public function prepareElement(FormInterface $form): void { parent::prepareElement($form); @@ -283,7 +283,7 @@ public function prepareElement(FormInterface $form) * * @return ValidatorInterface */ - protected function getValidator() + protected function getValidator(): ValidatorInterface { if (null === $this->validator) { $this->validator = new DateValidator(['format' => 'Y-m-d H:i:s']); @@ -298,7 +298,7 @@ protected function getValidator() * * @return array */ - public function getInputSpecification() + public function getInputSpecification(): array { return [ 'name' => $this->getName(), diff --git a/src/Element/Email.php b/src/Element/Email.php index 9c5a4e9b5..8d55277ab 100644 --- a/src/Element/Email.php +++ b/src/Element/Email.php @@ -31,7 +31,7 @@ class Email extends Element implements InputProviderInterface * * @return ValidatorInterface */ - public function getValidator() + public function getValidator(): ValidatorInterface { if (null === $this->validator) { $emailValidator = $this->getEmailValidator(); @@ -81,7 +81,7 @@ public function setValidator(ValidatorInterface $validator) * * @return ValidatorInterface */ - public function getEmailValidator() + public function getEmailValidator(): ValidatorInterface { if (null === $this->emailValidator) { $this->emailValidator = new RegexValidator( @@ -110,7 +110,7 @@ public function setEmailValidator(ValidatorInterface $validator) * * @return array */ - public function getInputSpecification() + public function getInputSpecification(): array { return [ 'name' => $this->getName(), diff --git a/src/Element/File.php b/src/Element/File.php index 0a8482a2f..7c6c621c2 100644 --- a/src/Element/File.php +++ b/src/Element/File.php @@ -24,7 +24,7 @@ class File extends Element implements InputProviderInterface, ElementPrepareAwar * * @return void */ - public function prepareElement(FormInterface $form) + public function prepareElement(FormInterface $form): void { // Ensure the form is using correct enctype $form->setAttribute('enctype', 'multipart/form-data'); @@ -36,7 +36,7 @@ public function prepareElement(FormInterface $form) * * @return array */ - public function getInputSpecification() + public function getInputSpecification(): array { return [ 'type' => FileInput::class, diff --git a/src/Element/MonthSelect.php b/src/Element/MonthSelect.php index 0a4b69979..3b6412e6c 100644 --- a/src/Element/MonthSelect.php +++ b/src/Element/MonthSelect.php @@ -125,7 +125,7 @@ public function setOptions(iterable $options) /** * @return Select */ - public function getMonthElement() + public function getMonthElement(): Select { return $this->monthElement; } @@ -133,7 +133,7 @@ public function getMonthElement() /** * @return Select */ - public function getYearElement() + public function getYearElement(): Select { return $this->yearElement; } @@ -143,7 +143,7 @@ public function getYearElement() * * @return array */ - public function getElements() + public function getElements(): array { return [$this->monthElement, $this->yearElement]; } @@ -165,7 +165,7 @@ public function setMonthAttributes(array $monthAttributes) * * @return array */ - public function getMonthAttributes() + public function getMonthAttributes(): array { return $this->monthElement->getAttributes(); } @@ -187,7 +187,7 @@ public function setYearAttributes(array $yearAttributes) * * @return array */ - public function getYearAttributes() + public function getYearAttributes(): array { return $this->yearElement->getAttributes(); } @@ -205,7 +205,7 @@ public function setMinYear($minYear) /** * @return int */ - public function getMinYear() + public function getMinYear(): int { return $this->minYear; } @@ -223,7 +223,7 @@ public function setMaxYear($maxYear) /** * @return int */ - public function getMaxYear() + public function getMaxYear(): int { return $this->maxYear; } @@ -241,7 +241,7 @@ public function setShouldCreateEmptyOption($createEmptyOption) /** * @return bool */ - public function shouldCreateEmptyOption() + public function shouldCreateEmptyOption(): bool { return $this->createEmptyOption; } @@ -259,7 +259,7 @@ public function setShouldRenderDelimiters($renderDelimiters) /** * @return bool */ - public function shouldRenderDelimiters() + public function shouldRenderDelimiters(): bool { return $this->renderDelimiters; } @@ -285,7 +285,7 @@ public function setValue($value) /** * @return string */ - public function getValue() + public function getValue(): string { return sprintf( '%s-%s', @@ -299,7 +299,7 @@ public function getValue() * * @return void */ - public function prepareElement(FormInterface $form) + public function prepareElement(FormInterface $form): void { $name = $this->getName(); $this->monthElement->setName($name . '[month]'); @@ -311,7 +311,7 @@ public function prepareElement(FormInterface $form) * * @return ValidatorInterface */ - protected function getValidator() + protected function getValidator(): ValidatorInterface { return new RegexValidator('/^[0-9]{4}\-(0?[1-9]|1[012])$/'); } @@ -322,7 +322,7 @@ protected function getValidator() * * @return array */ - public function getInputSpecification() + public function getInputSpecification(): array { return [ 'name' => $this->getName(), diff --git a/src/Element/MultiCheckbox.php b/src/Element/MultiCheckbox.php index 7d6d46086..a733ddd26 100644 --- a/src/Element/MultiCheckbox.php +++ b/src/Element/MultiCheckbox.php @@ -36,7 +36,7 @@ class MultiCheckbox extends Checkbox /** * @return array */ - public function getValueOptions() + public function getValueOptions(): array { return $this->valueOptions; } @@ -134,7 +134,7 @@ public function setDisableInArrayValidator($disableOption) * * @return bool */ - public function disableInArrayValidator() + public function disableInArrayValidator(): bool { return $this->disableInArrayValidator; } @@ -144,7 +144,7 @@ public function disableInArrayValidator() * * @return ValidatorInterface */ - protected function getValidator() + protected function getValidator(): ?ValidatorInterface { if (null === $this->validator && ! $this->disableInArrayValidator()) { $inArrayValidator = new InArrayValidator([ @@ -164,7 +164,7 @@ protected function getValidator() * * @return array */ - protected function getValueOptionsValues() + protected function getValueOptionsValues(): array { $values = []; $options = $this->getValueOptions(); diff --git a/src/Element/Number.php b/src/Element/Number.php index 691778169..7681b5954 100644 --- a/src/Element/Number.php +++ b/src/Element/Number.php @@ -30,7 +30,7 @@ class Number extends Element implements InputProviderInterface * * @return ValidatorInterface[] */ - protected function getValidators() + protected function getValidators(): array { if ($this->validators) { return $this->validators; @@ -82,7 +82,7 @@ protected function getValidators() * * @return array */ - public function getInputSpecification() + public function getInputSpecification(): array { return [ 'name' => $this->getName(), diff --git a/src/Element/Password.php b/src/Element/Password.php index dbd355e41..6fe0934d5 100644 --- a/src/Element/Password.php +++ b/src/Element/Password.php @@ -22,7 +22,7 @@ class Password extends Element implements ElementPrepareAwareInterface * * @return void */ - public function prepareElement(FormInterface $form) + public function prepareElement(FormInterface $form): void { $this->setValue(''); } diff --git a/src/Element/Radio.php b/src/Element/Radio.php index 6d2b743f4..a5dbcca0c 100644 --- a/src/Element/Radio.php +++ b/src/Element/Radio.php @@ -18,10 +18,8 @@ class Radio extends MultiCheckbox /** * Get validator - * - * @return ValidatorInterface */ - protected function getValidator() + protected function getValidator(): ?ValidatorInterface { if (null === $this->validator && ! $this->disableInArrayValidator()) { $this->validator = new InArrayValidator([ diff --git a/src/Element/Range.php b/src/Element/Range.php index e8eac8df8..e02d20247 100644 --- a/src/Element/Range.php +++ b/src/Element/Range.php @@ -25,7 +25,7 @@ class Range extends NumberElement * * @return ValidatorInterface[] */ - protected function getValidators() + protected function getValidators(): array { if ($this->validators) { return $this->validators; diff --git a/src/Element/Select.php b/src/Element/Select.php index 280dae6e1..f20a25f87 100644 --- a/src/Element/Select.php +++ b/src/Element/Select.php @@ -48,7 +48,7 @@ class Select extends Element implements InputProviderInterface /** * @return array */ - public function getValueOptions() + public function getValueOptions(): array { return $this->valueOptions; } @@ -169,7 +169,7 @@ public function setDisableInArrayValidator($disableOption) * * @return bool */ - public function disableInArrayValidator() + public function disableInArrayValidator(): bool { return $this->disableInArrayValidator; } @@ -191,7 +191,7 @@ public function setEmptyOption($emptyOption) * * @return string|null */ - public function getEmptyOption() + public function getEmptyOption(): ?string { return $this->emptyOption; } @@ -201,7 +201,7 @@ public function getEmptyOption() * * @return ValidatorInterface */ - protected function getValidator() + protected function getValidator(): ?ValidatorInterface { if (null === $this->validator && ! $this->disableInArrayValidator()) { $validator = new InArrayValidator([ @@ -238,7 +238,7 @@ public function setUseHiddenElement($useHiddenElement) * * @return bool */ - public function useHiddenElement() + public function useHiddenElement(): bool { return $this->useHiddenElement; } @@ -260,7 +260,7 @@ public function setUnselectedValue($unselectedValue) * * @return string */ - public function getUnselectedValue() + public function getUnselectedValue(): string { return $this->unselectedValue; } @@ -270,7 +270,7 @@ public function getUnselectedValue() * * @return array */ - public function getInputSpecification() + public function getInputSpecification(): array { $spec = [ 'name' => $this->getName(), @@ -311,7 +311,7 @@ public function getInputSpecification() * * @return array */ - protected function getValueOptionsValues() + protected function getValueOptionsValues(): array { $values = []; $options = $this->getValueOptions(); @@ -343,7 +343,7 @@ protected function getOptionValue($key, $optionSpec) * * @return bool */ - public function isMultiple() + public function isMultiple(): bool { return isset($this->attributes['multiple']) && ($this->attributes['multiple'] === true || $this->attributes['multiple'] === 'multiple'); diff --git a/src/Element/Tel.php b/src/Element/Tel.php index 3af04b81a..1e9b2c68d 100644 --- a/src/Element/Tel.php +++ b/src/Element/Tel.php @@ -28,7 +28,7 @@ class Tel extends Element implements InputProviderInterface * * @return ValidatorInterface */ - protected function getValidator() + protected function getValidator(): ValidatorInterface { if (null === $this->validator) { $this->validator = new RegexValidator("/^[^\r\n]*$/"); @@ -41,7 +41,7 @@ protected function getValidator() * * @return array */ - public function getInputSpecification() + public function getInputSpecification(): array { return [ 'name' => $this->getName(), diff --git a/src/Element/Url.php b/src/Element/Url.php index af83dea68..10a17dc5d 100644 --- a/src/Element/Url.php +++ b/src/Element/Url.php @@ -27,7 +27,7 @@ class Url extends Element implements InputProviderInterface * * @return ValidatorInterface */ - public function getValidator() + public function getValidator(): ValidatorInterface { if (null === $this->validator) { $this->validator = new UriValidator([ @@ -45,7 +45,7 @@ public function getValidator() * * @return array */ - public function getInputSpecification() + public function getInputSpecification(): array { return [ 'name' => $this->getName(), diff --git a/src/Element/Week.php b/src/Element/Week.php index de06e161c..ecdbe39a5 100644 --- a/src/Element/Week.php +++ b/src/Element/Week.php @@ -49,7 +49,7 @@ protected function getStepValidator(): ValidatorInterface * * @return array */ - protected function getValidators() + protected function getValidators(): array { if ($this->validators) { return $this->validators; diff --git a/src/ElementFactory.php b/src/ElementFactory.php index 37605eb50..f2a552b16 100644 --- a/src/ElementFactory.php +++ b/src/ElementFactory.php @@ -21,7 +21,7 @@ final class ElementFactory implements FactoryInterface * @param null|array $options * @return object */ - public function __invoke(ContainerInterface $container, $requestedName, ?array $options = null) + public function __invoke(ContainerInterface $container, $requestedName, ?array $options = null): object { if ($options === null) { $options = []; diff --git a/src/ElementInterface.php b/src/ElementInterface.php index 1426f6b90..cc9b77077 100644 --- a/src/ElementInterface.php +++ b/src/ElementInterface.php @@ -20,7 +20,7 @@ public function setName($name); * * @return null|string */ - public function getName(); + public function getName(): ?string; /** * Set options for an element @@ -43,7 +43,7 @@ public function setOption($key, $value); * * @return array */ - public function getOptions(); + public function getOptions(): array; /** * return the specified option @@ -76,7 +76,7 @@ public function getAttribute($key); * @param string $key * @return bool */ - public function hasAttribute($key); + public function hasAttribute($key): bool; /** * Set many attributes at once @@ -120,7 +120,7 @@ public function setLabel($label); * * @return null|string */ - public function getLabel(); + public function getLabel(): ?string; /** * Set a list of messages to report when validation fails diff --git a/src/Factory.php b/src/Factory.php index 91145b21e..6aec6e208 100644 --- a/src/Factory.php +++ b/src/Factory.php @@ -61,7 +61,7 @@ public function setInputFilterFactory(InputFilterFactory $inputFilterFactory) * * @return InputFilterFactory */ - public function getInputFilterFactory() + public function getInputFilterFactory(): InputFilterFactory { if (null === $this->inputFilterFactory) { $this->setInputFilterFactory(new InputFilterFactory()); @@ -85,7 +85,7 @@ public function setFormElementManager(FormElementManager $formElementManager) * * @return FormElementManager */ - public function getFormElementManager() + public function getFormElementManager(): FormElementManager { if ($this->formElementManager === null) { $this->setFormElementManager(new FormElementManager(new ServiceManager())); @@ -105,7 +105,7 @@ public function getFormElementManager() * @return ElementInterface * @throws Exception\DomainException */ - public function create($spec) + public function create($spec): ElementInterface { $spec = $this->validateSpecification($spec, __METHOD__); $type = $spec['type'] ?? Element::class; @@ -140,7 +140,7 @@ public function create($spec) * @param array $spec * @return ElementInterface */ - public function createElement($spec) + public function createElement($spec): ElementInterface { if (! isset($spec['type'])) { $spec['type'] = Element::class; @@ -155,7 +155,7 @@ public function createElement($spec) * @param array $spec * @return FieldsetInterface */ - public function createFieldset($spec) + public function createFieldset($spec): FieldsetInterface { if (! isset($spec['type'])) { $spec['type'] = Fieldset::class; @@ -170,7 +170,7 @@ public function createFieldset($spec) * @param array $spec * @return FormInterface */ - public function createForm($spec) + public function createForm($spec): FormInterface { if (! isset($spec['type'])) { $spec['type'] = Form::class; @@ -192,7 +192,7 @@ public function createForm($spec) * @return ElementInterface * @throws Exception\DomainException */ - public function configureElement(ElementInterface $element, $spec) + public function configureElement(ElementInterface $element, $spec): ElementInterface { $spec = $this->validateSpecification($spec, __METHOD__); @@ -233,7 +233,7 @@ public function configureElement(ElementInterface $element, $spec) * @return FieldsetInterface * @throws Exception\DomainException */ - public function configureFieldset(FieldsetInterface $fieldset, $spec) + public function configureFieldset(FieldsetInterface $fieldset, $spec): FieldsetInterface { $spec = $this->validateSpecification($spec, __METHOD__); $fieldset = $this->configureElement($fieldset, $spec); @@ -273,7 +273,7 @@ public function configureFieldset(FieldsetInterface $fieldset, $spec) * @param array|Traversable|ArrayAccess $spec * @return FormInterface */ - public function configureForm(FormInterface $form, $spec) + public function configureForm(FormInterface $form, $spec): FormInterface { $spec = $this->validateSpecification($spec, __METHOD__); $form = $this->configureFieldset($form, $spec); @@ -328,7 +328,7 @@ protected function validateSpecification($spec, $method) * @param string $method Method invoking this one (for exception messages) * @return void */ - protected function prepareAndInjectElements($elements, FieldsetInterface $fieldset, $method) + protected function prepareAndInjectElements($elements, FieldsetInterface $fieldset, $method): void { $elements = $this->validateSpecification($elements, $method); @@ -356,7 +356,7 @@ protected function prepareAndInjectElements($elements, FieldsetInterface $fields * @param string $method Method invoking this one (for exception messages) * @return void */ - public function prepareAndInjectFieldsets($fieldsets, FieldsetInterface $masterFieldset, $method) + public function prepareAndInjectFieldsets($fieldsets, FieldsetInterface $masterFieldset, $method): void { $fieldsets = $this->validateSpecification($fieldsets, $method); @@ -380,7 +380,7 @@ public function prepareAndInjectFieldsets($fieldsets, FieldsetInterface $masterF * @throws Exception\DomainException * @return void */ - protected function prepareAndInjectObject($objectName, FieldsetInterface $fieldset, $method) + protected function prepareAndInjectObject($objectName, FieldsetInterface $fieldset, $method): void { if (! is_string($objectName)) { throw new Exception\DomainException(sprintf( @@ -413,7 +413,7 @@ protected function prepareAndInjectObject($objectName, FieldsetInterface $fields * @throws Exception\DomainException If $hydratorOrName is not a string, does not resolve to a known class, or * the class does not implement Hydrator\HydratorInterface. */ - protected function prepareAndInjectHydrator($hydratorOrName, FieldsetInterface $fieldset, $method) + protected function prepareAndInjectHydrator($hydratorOrName, FieldsetInterface $fieldset, $method): void { if ($hydratorOrName instanceof Hydrator\HydratorInterface) { $fieldset->setHydrator($hydratorOrName); @@ -464,7 +464,7 @@ protected function prepareAndInjectHydrator($hydratorOrName, FieldsetInterface $ * @throws Exception\DomainException If $factoryOrName is not a string, does not resolve to a known class, or * the class does not extend Form\Factory. */ - protected function prepareAndInjectFactory($factoryOrName, FieldsetInterface $fieldset, $method) + protected function prepareAndInjectFactory($factoryOrName, FieldsetInterface $fieldset, $method): void { if (is_array($factoryOrName)) { if (! isset($factoryOrName['type'])) { @@ -506,7 +506,7 @@ protected function prepareAndInjectFactory($factoryOrName, FieldsetInterface $fi * @return void * @throws Exception\DomainException For unknown InputFilter class or invalid InputFilter instance. */ - protected function prepareAndInjectInputFilter($spec, FormInterface $form, $method) + protected function prepareAndInjectInputFilter($spec, FormInterface $form, $method): void { if ($spec instanceof InputFilterInterface) { $form->setInputFilter($spec); @@ -551,7 +551,7 @@ protected function prepareAndInjectInputFilter($spec, FormInterface $form, $meth * @return void * @throws Exception\DomainException If validation group given is not an array. */ - protected function prepareAndInjectValidationGroup($spec, FormInterface $form, $method) + protected function prepareAndInjectValidationGroup($spec, FormInterface $form, $method): void { if (! is_array($spec)) { if (! class_exists($spec)) { diff --git a/src/Fieldset.php b/src/Fieldset.php index c491d3cbb..f7e9d8691 100644 --- a/src/Fieldset.php +++ b/src/Fieldset.php @@ -117,7 +117,7 @@ public function setFormFactory(Factory $formFactory) * * @return Factory */ - public function getFormFactory() + public function getFormFactory(): Factory { if (null === $this->factory) { $this->setFormFactory(new Factory()); @@ -196,7 +196,7 @@ public function add($elementOrFieldset, array $flags = []) * @param string $elementOrFieldset * @return bool */ - public function has($elementOrFieldset) + public function has($elementOrFieldset): bool { return $this->iterator->get($elementOrFieldset) !== null; } @@ -205,9 +205,8 @@ public function has($elementOrFieldset) * Retrieve a named element or fieldset * * @param string $elementOrFieldset - * @return ElementInterface|FieldsetInterface */ - public function get($elementOrFieldset) + public function get($elementOrFieldset): ElementInterface { if (! $this->has($elementOrFieldset)) { throw new Exception\InvalidElementException(sprintf( @@ -340,7 +339,7 @@ public function getMessages($elementName = null): array * * @return void */ - public function prepareElement(FormInterface $form) + public function prepareElement(FormInterface $form): void { $name = $this->getName(); @@ -361,7 +360,7 @@ public function prepareElement(FormInterface $form) * @return void * @throws Exception\InvalidArgumentException */ - public function populateValues(iterable $data) + public function populateValues(iterable $data): void { if ($data instanceof Traversable) { $data = ArrayUtils::iteratorToArray($data); @@ -400,7 +399,7 @@ public function populateValues(iterable $data) * * @return int */ - public function count() + public function count(): int { return $this->iterator->count(); } @@ -410,7 +409,7 @@ public function count() * * @return PriorityList */ - public function getIterator() + public function getIterator(): PriorityList { return $this->iterator; } @@ -461,7 +460,7 @@ public function setAllowedObjectBindingClass($allowObjectBindingClass): void * * @return string */ - public function allowedObjectBindingClass() + public function allowedObjectBindingClass(): ?string { return $this->allowedObjectBindingClass; } @@ -472,7 +471,7 @@ public function allowedObjectBindingClass() * @param object $object * @return bool */ - public function allowObjectBinding($object) + public function allowObjectBinding($object): bool { $validBindingClass = false; if (is_object($object) && $this->allowedObjectBindingClass()) { @@ -506,7 +505,7 @@ public function setHydrator(HydratorInterface $hydrator) * * @return HydratorInterface */ - public function getHydrator() + public function getHydrator(): HydratorInterface { if (! $this->hydrator instanceof HydratorInterface) { if ($this->object instanceof HydratorAwareInterface) { @@ -527,7 +526,7 @@ class_exists(Hydrator\ArraySerializableHydrator::class) * * @return bool */ - public function allowValueBinding() + public function allowValueBinding(): bool { return is_object($this->object); } @@ -599,7 +598,7 @@ public function setUseAsBaseFieldset($useAsBaseFieldset) * * @return bool */ - public function useAsBaseFieldset() + public function useAsBaseFieldset(): bool { return $this->useAsBaseFieldset; } @@ -609,7 +608,7 @@ public function useAsBaseFieldset() * * @return array */ - protected function extract() + protected function extract(): array { if (! is_object($this->object)) { return []; diff --git a/src/FieldsetInterface.php b/src/FieldsetInterface.php index a992d2ef7..d4fe26616 100644 --- a/src/FieldsetInterface.php +++ b/src/FieldsetInterface.php @@ -35,7 +35,7 @@ public function add($elementOrFieldset, array $flags = []); * @param string $elementOrFieldset * @return bool */ - public function has($elementOrFieldset); + public function has($elementOrFieldset): bool; /** * Retrieve a named element or fieldset @@ -43,7 +43,7 @@ public function has($elementOrFieldset); * @param string $elementOrFieldset * @return ElementInterface */ - public function get($elementOrFieldset); + public function get($elementOrFieldset): ElementInterface; /** * Remove a named element or fieldset @@ -85,7 +85,7 @@ public function getFieldsets(): array; * * @return void */ - public function populateValues(iterable $data); + public function populateValues(iterable $data): void; /** * Set the object used by the hydrator @@ -108,7 +108,7 @@ public function getObject(); * @param object $object * @return bool */ - public function allowObjectBinding($object); + public function allowObjectBinding($object): bool; /** * Set the hydrator to use when binding an object to the element @@ -122,7 +122,7 @@ public function setHydrator(HydratorInterface $hydrator); * * @return null|HydratorInterface */ - public function getHydrator(); + public function getHydrator(): ?HydratorInterface; /** * Bind values to the bound object @@ -137,5 +137,5 @@ public function bindValues(array $values = []); * * @return bool */ - public function allowValueBinding(); + public function allowValueBinding(): bool; } diff --git a/src/Form.php b/src/Form.php index 4d568888c..9ee58198a 100644 --- a/src/Form.php +++ b/src/Form.php @@ -232,7 +232,7 @@ public function prepare() * * @return void */ - public function prepareElement(FormInterface $form) + public function prepareElement(FormInterface $form): void { $name = $this->getName(); @@ -332,7 +332,7 @@ public function setHydrator(HydratorInterface $hydrator) * @param array $values * @return void */ - public function bindValues(array $values = [], ?array $validationGroup = null) + public function bindValues(array $values = [], ?array $validationGroup = null): void { if (! is_object($this->object)) { if ($this->baseFieldset === null || $this->baseFieldset->allowValueBinding() === false) { @@ -382,7 +382,7 @@ public function bindValues(array $values = [], ?array $validationGroup = null) * @param array $match * @return array */ - protected function prepareBindData(array $values, array $match) + protected function prepareBindData(array $values, array $match): array { $data = []; foreach ($values as $name => $value) { @@ -427,7 +427,7 @@ public function setBindOnValidate($bindOnValidateFlag) * * @return bool */ - public function bindOnValidate() + public function bindOnValidate(): bool { return static::BIND_ON_VALIDATE === $this->bindOnValidate; } @@ -449,7 +449,7 @@ public function setBaseFieldset(FieldsetInterface $baseFieldset) * * @return FieldsetInterface */ - public function getBaseFieldset() + public function getBaseFieldset(): FieldsetInterface { return $this->baseFieldset; } @@ -459,7 +459,7 @@ public function getBaseFieldset() * * @return bool */ - public function hasValidated() + public function hasValidated(): bool { return $this->hasValidated; } @@ -472,7 +472,7 @@ public function hasValidated() * @return bool * @throws Exception\DomainException */ - public function isValid() + public function isValid(): bool { if ($this->hasValidated) { return $this->isValid; @@ -607,7 +607,7 @@ public function setValidationGroup() * * @return null|array */ - public function getValidationGroup() + public function getValidationGroup(): ?array { return $this->validationGroup; } @@ -675,7 +675,7 @@ public function setInputFilter(InputFilterInterface $inputFilter) * * @return InputFilterInterface */ - public function getInputFilter() + public function getInputFilter(): InputFilterInterface { if ($this->object instanceof InputFilterAwareInterface) { if (null === $this->baseFieldset) { @@ -725,7 +725,7 @@ public function setUseInputFilterDefaults($useInputFilterDefaults) * * @return bool */ - public function useInputFilterDefaults() + public function useInputFilterDefaults(): bool { return $this->useInputFilterDefaults; } @@ -748,7 +748,7 @@ public function setPreferFormInputFilter($preferFormInputFilter) * * @return bool */ - public function getPreferFormInputFilter() + public function getPreferFormInputFilter(): bool { return $this->preferFormInputFilter; } @@ -759,7 +759,7 @@ public function getPreferFormInputFilter() * @param FieldsetInterface $fieldset Fieldset to traverse when looking for default inputs * @return void */ - public function attachInputFilterDefaults(InputFilterInterface $inputFilter, FieldsetInterface $fieldset) + public function attachInputFilterDefaults(InputFilterInterface $inputFilter, FieldsetInterface $fieldset): void { $formFactory = $this->getFormFactory(); $inputFactory = $formFactory->getInputFilterFactory(); @@ -907,7 +907,7 @@ public function attachInputFilterDefaults(InputFilterInterface $inputFilter, Fie * * @return CollectionInputFilter */ - private function addInputsToCollectionInputFilter(CollectionInputFilter $inputFilter) + private function addInputsToCollectionInputFilter(CollectionInputFilter $inputFilter): CollectionInputFilter { foreach ($inputFilter->getInputs() as $name => $input) { if (! $inputFilter->getInputFilter()->has($name)) { @@ -935,7 +935,7 @@ public function setWrapElements($wrapElements) * * @return bool */ - public function wrapElements() + public function wrapElements(): bool { return $this->wrapElements; } @@ -945,7 +945,7 @@ public function wrapElements() * * @param bool $onlyBase */ - public function populateValues(iterable $data, $onlyBase = false) + public function populateValues(iterable $data, $onlyBase = false): void { if ($data instanceof Traversable) { $data = ArrayUtils::iteratorToArray($data); @@ -966,7 +966,7 @@ public function populateValues(iterable $data, $onlyBase = false) * * @return array */ - protected function extract() + protected function extract(): array { if ($this->baseFieldset !== null) { assert($this->baseFieldset instanceof Fieldset); diff --git a/src/FormAbstractServiceFactory.php b/src/FormAbstractServiceFactory.php index efe36e56e..1cdb32924 100644 --- a/src/FormAbstractServiceFactory.php +++ b/src/FormAbstractServiceFactory.php @@ -28,7 +28,7 @@ class FormAbstractServiceFactory implements AbstractFactoryInterface * @param array|null $options * @return FormInterface */ - public function __invoke(ContainerInterface $container, $requestedName, ?array $options = null) + public function __invoke(ContainerInterface $container, $requestedName, ?array $options = null): FormInterface { $config = $this->getConfig($container); $config = $config[$requestedName]; @@ -44,7 +44,7 @@ public function __invoke(ContainerInterface $container, $requestedName, ?array $ * @param string $requestedName * @return bool */ - public function canCreate(ContainerInterface $container, $requestedName) + public function canCreate(ContainerInterface $container, $requestedName): bool { // avoid infinite loops when looking up config if ($requestedName === 'config') { @@ -67,7 +67,7 @@ public function canCreate(ContainerInterface $container, $requestedName) * @param ServiceLocatorInterface $container * @return array */ - protected function getConfig(ContainerInterface $container) + protected function getConfig(ContainerInterface $container): array { if ($this->config !== null) { return $this->config; @@ -97,7 +97,7 @@ protected function getConfig(ContainerInterface $container) * @param ContainerInterface $services * @return Factory */ - protected function getFormFactory(ContainerInterface $container) + protected function getFormFactory(ContainerInterface $container): Factory { if ($this->factory instanceof Factory) { return $this->factory; @@ -124,7 +124,7 @@ protected function getFormFactory(ContainerInterface $container) * @param array $config * @return void */ - protected function marshalInputFilter(array &$config, ContainerInterface $container, Factory $formFactory) + protected function marshalInputFilter(array &$config, ContainerInterface $container, Factory $formFactory): void { if (! isset($config['input_filter'])) { return; diff --git a/src/FormElementManager.php b/src/FormElementManager.php index d03c02ad0..30d98db53 100644 --- a/src/FormElementManager.php +++ b/src/FormElementManager.php @@ -309,7 +309,7 @@ class FormElementManager extends AbstractPluginManager * @param mixed $instance Instance to inspect and optionally inject. * @return void */ - public function injectFactory(ContainerInterface $container, $instance) + public function injectFactory(ContainerInterface $container, $instance): void { if (! $instance instanceof Fieldset) { return; @@ -348,7 +348,7 @@ public function callElementInit(ContainerInterface $container, $instance): void * @param null|string $class * @return void */ - public function setInvokableClass($name, $class = null) + public function setInvokableClass($name, $class = null): void { $class = $class ?: $name; @@ -372,7 +372,7 @@ public function setInvokableClass($name, $class = null) * @return void * @throws InvalidServiceException */ - public function validate($instance) + public function validate($instance): void { if (! $instance instanceof $this->instanceOf) { throw new InvalidServiceException(sprintf( diff --git a/src/FormElementManagerFactory.php b/src/FormElementManagerFactory.php index b86c6bf4e..9e9f4d2d7 100644 --- a/src/FormElementManagerFactory.php +++ b/src/FormElementManagerFactory.php @@ -16,7 +16,7 @@ class FormElementManagerFactory implements FactoryInterface * * @return AbstractPluginManager */ - public function __invoke(ContainerInterface $container, $name, ?array $options = null) + public function __invoke(ContainerInterface $container, $name, ?array $options = null): AbstractPluginManager { $pluginManager = new FormElementManager($container, $options ?: []); diff --git a/src/FormInterface.php b/src/FormInterface.php index cd4a5005f..e19a88f14 100644 --- a/src/FormInterface.php +++ b/src/FormInterface.php @@ -55,7 +55,7 @@ public function setInputFilter(InputFilterInterface $inputFilter); * * @return InputFilterInterface */ - public function getInputFilter(); + public function getInputFilter(): InputFilterInterface; /** * Validate the form @@ -64,7 +64,7 @@ public function getInputFilter(); * * @return bool */ - public function isValid(); + public function isValid(): bool; /** * Retrieve the validated data diff --git a/src/LabelAwareInterface.php b/src/LabelAwareInterface.php index 7dcc4cc06..c79cdbffd 100644 --- a/src/LabelAwareInterface.php +++ b/src/LabelAwareInterface.php @@ -17,7 +17,7 @@ public function setLabel($label); * * @return null|string */ - public function getLabel(); + public function getLabel(): ?string; /** * Set the attributes to use with the label @@ -32,7 +32,7 @@ public function setLabelAttributes(array $labelAttributes); * * @return array */ - public function getLabelAttributes(); + public function getLabelAttributes(): array; /** * Set many label options at once @@ -48,7 +48,7 @@ public function setLabelOptions(iterable $arrayOrTraversable); * * @return array */ - public function getLabelOptions(); + public function getLabelOptions(): array; /** * Set a single label optionn @@ -81,7 +81,7 @@ public function removeLabelOption($key); * @param string $key * @return bool */ - public function hasLabelOption($key); + public function hasLabelOption($key): bool; /** * Remove many attributes at once diff --git a/src/LabelAwareTrait.php b/src/LabelAwareTrait.php index ccd8be2c4..625011f78 100644 --- a/src/LabelAwareTrait.php +++ b/src/LabelAwareTrait.php @@ -11,7 +11,7 @@ trait LabelAwareTrait * * @var array */ - protected $labelAttributes; + protected $labelAttributes = []; /** * Label specific options @@ -37,7 +37,7 @@ public function setLabelAttributes(array $labelAttributes) * * @return array */ - public function getLabelAttributes() + public function getLabelAttributes(): array { return $this->labelAttributes; } @@ -63,7 +63,7 @@ public function setLabelOptions(iterable $arrayOrTraversable) * * @return array */ - public function getLabelOptions() + public function getLabelOptions(): array { return $this->labelOptions; } @@ -139,7 +139,7 @@ public function removeLabelOption($key) * @param string $key * @return bool */ - public function hasLabelOption($key) + public function hasLabelOption($key): bool { return array_key_exists($key, $this->labelOptions); } diff --git a/src/Module.php b/src/Module.php index 6de3eab9d..4e48f2084 100644 --- a/src/Module.php +++ b/src/Module.php @@ -12,7 +12,7 @@ class Module * * @return array */ - public function getConfig() + public function getConfig(): array { $provider = new ConfigProvider(); return [ @@ -25,9 +25,8 @@ public function getConfig() * Register a specification for the FormElementManager with the ServiceListener. * * @param ModuleManager $moduleManager - * @return void */ - public function init($moduleManager) + public function init($moduleManager): void { $event = $moduleManager->getEvent(); $container = $event->getParam('ServiceManager'); diff --git a/src/View/Helper/AbstractHelper.php b/src/View/Helper/AbstractHelper.php index dd089bf70..77f9cbd32 100644 --- a/src/View/Helper/AbstractHelper.php +++ b/src/View/Helper/AbstractHelper.php @@ -202,7 +202,7 @@ public function setDoctype($doctype) * * @return string */ - public function getDoctype() + public function getDoctype(): string { return $this->getDoctypeHelper()->getDoctype(); } @@ -225,7 +225,7 @@ public function setEncoding($encoding) * * @return string */ - public function getEncoding() + public function getEncoding(): string { return $this->getEscapeHtmlHelper()->getEncoding(); } @@ -238,7 +238,7 @@ public function getEncoding() * @param array $attributes * @return string */ - public function createAttributesString(array $attributes) + public function createAttributesString(array $attributes): string { $attributes = $this->prepareAttributes($attributes); $escape = $this->getEscapeHtmlHelper(); @@ -285,7 +285,7 @@ public function createAttributesString(array $attributes) * * @return null|string */ - public function getId(ElementInterface $element) + public function getId(ElementInterface $element): ?string { $id = $element->getAttribute('id'); if (null !== $id) { @@ -302,7 +302,7 @@ public function getId(ElementInterface $element) * * @return string */ - public function getInlineClosingBracket() + public function getInlineClosingBracket(): string { $doctypeHelper = $this->getDoctypeHelper(); if ($doctypeHelper->isXhtml()) { @@ -316,7 +316,7 @@ public function getInlineClosingBracket() * * @return Doctype */ - protected function getDoctypeHelper() + protected function getDoctypeHelper(): Doctype { if ($this->doctypeHelper) { return $this->doctypeHelper; @@ -338,7 +338,7 @@ protected function getDoctypeHelper() * * @return EscapeHtml */ - protected function getEscapeHtmlHelper() + protected function getEscapeHtmlHelper(): EscapeHtml { if ($this->escapeHtmlHelper) { return $this->escapeHtmlHelper; @@ -360,7 +360,7 @@ protected function getEscapeHtmlHelper() * * @return EscapeHtmlAttr */ - protected function getEscapeHtmlAttrHelper() + protected function getEscapeHtmlAttrHelper(): EscapeHtmlAttr { if ($this->escapeHtmlAttrHelper) { return $this->escapeHtmlAttrHelper; @@ -388,7 +388,7 @@ protected function getEscapeHtmlAttrHelper() * @param array $attributes * @return array */ - protected function prepareAttributes(array $attributes) + protected function prepareAttributes(array $attributes): array { foreach ($attributes as $key => $value) { $attribute = strtolower($key); @@ -426,7 +426,7 @@ protected function prepareAttributes(array $attributes) * @param mixed $value * @return string */ - protected function prepareBooleanAttributeValue($attribute, $value) + protected function prepareBooleanAttributeValue($attribute, $value): string { if (! is_bool($value) && in_array($value, $this->booleanAttributes[$attribute])) { return $value; @@ -443,9 +443,8 @@ protected function prepareBooleanAttributeValue($attribute, $value) * * @param string $key * @param string $value - * @return string */ - protected function translateHtmlAttributeValue($key, $value) + protected function translateHtmlAttributeValue($key, $value): ?string { if (empty($value) || ($this->getTranslator() === null)) { return $value; @@ -561,7 +560,7 @@ public static function addDefaultTranslatableAttributePrefix($prefix): void * @param string $attribute * @return bool */ - protected function isValidAttributeName($attribute) + protected function isValidAttributeName($attribute): bool { return (bool) preg_match('/^[^\t\n\f \/>"\'=]+$/', $attribute); } @@ -572,7 +571,7 @@ protected function isValidAttributeName($attribute) * @param string $attribute * @return bool */ - protected function hasAllowedPrefix($attribute) + protected function hasAllowedPrefix($attribute): bool { foreach ($this->validTagAttributePrefixes as $prefix) { if (substr($attribute, 0, strlen($prefix)) === $prefix) { diff --git a/src/View/Helper/Captcha/AbstractWord.php b/src/View/Helper/Captcha/AbstractWord.php index d40629b2a..7ab3333b2 100644 --- a/src/View/Helper/Captcha/AbstractWord.php +++ b/src/View/Helper/Captcha/AbstractWord.php @@ -62,7 +62,7 @@ public function __invoke(?ElementInterface $element = null) * @throws Exception\DomainException * @return string */ - protected function renderCaptchaInputs(ElementInterface $element) + protected function renderCaptchaInputs(ElementInterface $element): string { $name = $element->getName(); if ($name === null || $name === '') { @@ -96,7 +96,7 @@ protected function renderCaptchaInputs(ElementInterface $element) * @param array $attributes * @return string */ - protected function renderCaptchaHidden(CaptchaAdapter $captcha, array $attributes) + protected function renderCaptchaHidden(CaptchaAdapter $captcha, array $attributes): string { $attributes['type'] = 'hidden'; $attributes['name'] .= '[id]'; @@ -126,7 +126,7 @@ protected function renderCaptchaHidden(CaptchaAdapter $captcha, array $attribute * @param array $attributes * @return string */ - protected function renderCaptchaInput(CaptchaAdapter $captcha, array $attributes) + protected function renderCaptchaInput(CaptchaAdapter $captcha, array $attributes): string { $attributes['type'] = 'text'; $attributes['name'] .= '[input]'; @@ -170,7 +170,7 @@ public function setCaptchaPosition($captchaPosition) * * @return string */ - public function getCaptchaPosition() + public function getCaptchaPosition(): string { return $this->captchaPosition; } @@ -192,7 +192,7 @@ public function setSeparator($separator) * * @return string */ - public function getSeparator() + public function getSeparator(): string { return $this->separator; } diff --git a/src/View/Helper/Captcha/Dumb.php b/src/View/Helper/Captcha/Dumb.php index 274be13fa..a7526d376 100644 --- a/src/View/Helper/Captcha/Dumb.php +++ b/src/View/Helper/Captcha/Dumb.php @@ -19,7 +19,7 @@ class Dumb extends AbstractWord * @throws Exception\DomainException * @return string */ - public function render(ElementInterface $element) + public function render(ElementInterface $element): string { assert($element instanceof Captcha); $captcha = $element->getCaptcha(); diff --git a/src/View/Helper/Captcha/Figlet.php b/src/View/Helper/Captcha/Figlet.php index f52180cb3..b35975005 100644 --- a/src/View/Helper/Captcha/Figlet.php +++ b/src/View/Helper/Captcha/Figlet.php @@ -18,7 +18,7 @@ class Figlet extends AbstractWord * @throws Exception\DomainException * @return string */ - public function render(ElementInterface $element) + public function render(ElementInterface $element): string { assert($element instanceof Captcha); $captcha = $element->getCaptcha(); diff --git a/src/View/Helper/Captcha/Image.php b/src/View/Helper/Captcha/Image.php index 3c376e6ed..0ba4da8a2 100644 --- a/src/View/Helper/Captcha/Image.php +++ b/src/View/Helper/Captcha/Image.php @@ -18,7 +18,7 @@ class Image extends AbstractWord * @throws Exception\DomainException * @return string */ - public function render(ElementInterface $element) + public function render(ElementInterface $element): string { assert($element instanceof Captcha); $captcha = $element->getCaptcha(); diff --git a/src/View/Helper/Captcha/ReCaptcha.php b/src/View/Helper/Captcha/ReCaptcha.php index 715079df6..70c8c0d87 100644 --- a/src/View/Helper/Captcha/ReCaptcha.php +++ b/src/View/Helper/Captcha/ReCaptcha.php @@ -35,7 +35,7 @@ public function __invoke(?ElementInterface $element = null) * @throws Exception\DomainException * @return string */ - public function render(ElementInterface $element) + public function render(ElementInterface $element): string { assert($element instanceof Captcha); $captcha = $element->getCaptcha(); @@ -69,7 +69,7 @@ public function render(ElementInterface $element) * @param string $responseId @deprecated * @return string */ - protected function renderHiddenInput($name, $challengeId = '', $responseName = '', $responseId = '') + protected function renderHiddenInput($name, $challengeId = '', $responseName = '', $responseId = ''): string { if ($name === 'g-recaptcha-response') { return ''; @@ -94,7 +94,7 @@ protected function renderHiddenInput($name, $challengeId = '', $responseName = ' * @param string $responseId * @return string */ - protected function renderJsEvents($challengeId, $responseId) + protected function renderJsEvents($challengeId, $responseId): string { return ''; } diff --git a/src/View/Helper/File/FormFileApcProgress.php b/src/View/Helper/File/FormFileApcProgress.php index 6d199acbb..8ef83aa9c 100644 --- a/src/View/Helper/File/FormFileApcProgress.php +++ b/src/View/Helper/File/FormFileApcProgress.php @@ -10,10 +10,7 @@ */ class FormFileApcProgress extends FormFileUploadProgress { - /** - * @return string - */ - protected function getName() + protected function getName(): string { return ini_get('apc.rfc1867_name'); } diff --git a/src/View/Helper/File/FormFileSessionProgress.php b/src/View/Helper/File/FormFileSessionProgress.php index be98bd605..67571cd27 100644 --- a/src/View/Helper/File/FormFileSessionProgress.php +++ b/src/View/Helper/File/FormFileSessionProgress.php @@ -13,7 +13,7 @@ class FormFileSessionProgress extends FormFileUploadProgress /** * @return string */ - protected function getName() + protected function getName(): string { return ini_get('session.upload_progress.name'); } diff --git a/src/View/Helper/File/FormFileUploadProgress.php b/src/View/Helper/File/FormFileUploadProgress.php index db99ed2eb..fc2bb49c8 100644 --- a/src/View/Helper/File/FormFileUploadProgress.php +++ b/src/View/Helper/File/FormFileUploadProgress.php @@ -21,7 +21,7 @@ class FormFileUploadProgress extends FormInput * * @return string */ - public function __invoke(?ElementInterface $element = null) + public function __invoke(?ElementInterface $element = null): string { return $this->renderHiddenId(); } @@ -31,7 +31,7 @@ public function __invoke(?ElementInterface $element = null) * * @return string */ - public function renderHiddenId() + public function renderHiddenId(): string { $attributes = [ 'id' => 'progress_key', @@ -50,7 +50,7 @@ public function renderHiddenId() /** * @return string */ - protected function getName() + protected function getName(): string { return 'UPLOAD_IDENTIFIER'; } @@ -58,7 +58,7 @@ protected function getName() /** * @return string */ - protected function getValue() + protected function getValue(): string { return uniqid(); } diff --git a/src/View/Helper/Form.php b/src/View/Helper/Form.php index 7774a516c..9fb7f3253 100644 --- a/src/View/Helper/Form.php +++ b/src/View/Helper/Form.php @@ -53,7 +53,7 @@ public function __invoke(?FormInterface $form = null) * * @return string */ - public function render(FormInterface $form) + public function render(FormInterface $form): string { if (method_exists($form, 'prepare')) { $form->prepare(); @@ -79,7 +79,7 @@ public function render(FormInterface $form) * * @return string */ - public function openTag(?FormInterface $form = null) + public function openTag(?FormInterface $form = null): string { $doctype = $this->getDoctype(); $attributes = []; @@ -111,7 +111,7 @@ public function openTag(?FormInterface $form = null) * * @return string */ - public function closeTag() + public function closeTag(): string { return ''; } diff --git a/src/View/Helper/FormButton.php b/src/View/Helper/FormButton.php index 3f9b4b425..d5659717c 100644 --- a/src/View/Helper/FormButton.php +++ b/src/View/Helper/FormButton.php @@ -70,7 +70,7 @@ public function __invoke(?ElementInterface $element = null, $buttonContent = nul * @throws Exception\DomainException * @return string */ - public function render(ElementInterface $element, $buttonContent = null) + public function render(ElementInterface $element, $buttonContent = null): string { $openTag = $this->openTag($element); @@ -110,7 +110,7 @@ public function render(ElementInterface $element, $buttonContent = null) * @throws Exception\DomainException * @return string */ - public function openTag($attributesOrElement = null) + public function openTag($attributesOrElement = null): string { if (null === $attributesOrElement) { return ''; } @@ -164,7 +164,7 @@ public function closeTag() * * @return string */ - protected function getType(ElementInterface $element) + protected function getType(ElementInterface $element): string { $type = $element->getAttribute('type'); if (empty($type)) { diff --git a/src/View/Helper/FormCaptcha.php b/src/View/Helper/FormCaptcha.php index de2afddff..e20f58525 100644 --- a/src/View/Helper/FormCaptcha.php +++ b/src/View/Helper/FormCaptcha.php @@ -34,7 +34,7 @@ public function __invoke(?Captcha $element = null) * not implement plugin(). * @return string */ - public function render(Captcha $element) + public function render(Captcha $element): string { $captcha = $element->getCaptcha(); diff --git a/src/View/Helper/FormCheckbox.php b/src/View/Helper/FormCheckbox.php index 63ded32c3..d95e3a623 100644 --- a/src/View/Helper/FormCheckbox.php +++ b/src/View/Helper/FormCheckbox.php @@ -17,7 +17,7 @@ class FormCheckbox extends FormInput * @throws Exception\DomainException * @return string */ - public function render(ElementInterface $element) + public function render(ElementInterface $element): string { if (! $element instanceof CheckboxElement) { throw new Exception\InvalidArgumentException(sprintf( @@ -72,7 +72,7 @@ public function render(ElementInterface $element) * * @return string */ - protected function getInputType() + protected function getInputType(): string { return 'checkbox'; } diff --git a/src/View/Helper/FormCollection.php b/src/View/Helper/FormCollection.php index d377031e6..048fb833a 100644 --- a/src/View/Helper/FormCollection.php +++ b/src/View/Helper/FormCollection.php @@ -89,7 +89,7 @@ public function __invoke(?ElementInterface $element = null, $wrap = true) * * @return string */ - public function render(ElementInterface $element) + public function render(ElementInterface $element): string { $renderer = $this->getView(); if (! method_exists($renderer, 'plugin')) { @@ -163,7 +163,7 @@ public function render(ElementInterface $element) * * @return string */ - public function renderTemplate(CollectionElement $collection) + public function renderTemplate(CollectionElement $collection): string { $elementHelper = $this->getElementHelper(); assert(is_callable($elementHelper)); @@ -205,7 +205,7 @@ public function setShouldWrap($wrap) * * @return bool */ - public function shouldWrap() + public function shouldWrap(): bool { return $this->shouldWrap; } @@ -227,7 +227,7 @@ public function setDefaultElementHelper($defaultSubHelper) * * @return string */ - public function getDefaultElementHelper() + public function getDefaultElementHelper(): string { return $this->defaultElementHelper; } @@ -250,7 +250,7 @@ public function setElementHelper(HelperInterface $elementHelper) * @return HelperInterface * @throws RuntimeException */ - protected function getElementHelper() + protected function getElementHelper(): HelperInterface { if ($this->elementHelper) { return $this->elementHelper; @@ -287,7 +287,7 @@ public function setFieldsetHelper(HelperInterface $fieldsetHelper) * * @return FormCollection */ - protected function getFieldsetHelper() + protected function getFieldsetHelper(): HelperInterface { if ($this->fieldsetHelper) { return $this->fieldsetHelper; @@ -301,7 +301,7 @@ protected function getFieldsetHelper() * * @return string */ - public function getWrapper() + public function getWrapper(): string { return $this->wrapper; } @@ -350,7 +350,7 @@ public function setLabelWrapper($labelWrapper) * * @return string */ - public function getLabelWrapper() + public function getLabelWrapper(): string { return $this->labelWrapper; } @@ -360,7 +360,7 @@ public function getLabelWrapper() * * @return string */ - public function getTemplateWrapper() + public function getTemplateWrapper(): string { return $this->templateWrapper; } diff --git a/src/View/Helper/FormColor.php b/src/View/Helper/FormColor.php index 3c369288a..4413ea0a0 100644 --- a/src/View/Helper/FormColor.php +++ b/src/View/Helper/FormColor.php @@ -27,7 +27,7 @@ class FormColor extends FormInput * * @return string */ - protected function getType(ElementInterface $element) + protected function getType(ElementInterface $element): string { return 'color'; } diff --git a/src/View/Helper/FormDate.php b/src/View/Helper/FormDate.php index 619b1c5c6..1940414ea 100644 --- a/src/View/Helper/FormDate.php +++ b/src/View/Helper/FormDate.php @@ -8,10 +8,8 @@ class FormDate extends FormDateTime { /** * Determine input type to use - * - * @return string */ - protected function getType(ElementInterface $element) + protected function getType(ElementInterface $element): string { return 'date'; } diff --git a/src/View/Helper/FormDateSelect.php b/src/View/Helper/FormDateSelect.php index 38c2e32f5..8a541911b 100644 --- a/src/View/Helper/FormDateSelect.php +++ b/src/View/Helper/FormDateSelect.php @@ -21,7 +21,7 @@ class FormDateSelect extends FormMonthSelectHelper * @throws Exception\DomainException * @return string */ - public function render(ElementInterface $element) + public function render(ElementInterface $element): string { if (! $element instanceof DateSelectElement) { throw new Exception\InvalidArgumentException(sprintf( @@ -79,7 +79,7 @@ public function render(ElementInterface $element) * @param string $pattern Pattern to use for days * @return array */ - protected function getDaysOptions($pattern) + protected function getDaysOptions($pattern): array { $keyFormatter = new IntlDateFormatter($this->getLocale(), null, null, null, null, 'dd'); $valueFormatter = new IntlDateFormatter($this->getLocale(), null, null, null, null, $pattern); diff --git a/src/View/Helper/FormDateTime.php b/src/View/Helper/FormDateTime.php index ecd76b8f6..dc3451980 100644 --- a/src/View/Helper/FormDateTime.php +++ b/src/View/Helper/FormDateTime.php @@ -32,7 +32,7 @@ class FormDateTime extends FormInput * * @return string */ - protected function getType(ElementInterface $element) + protected function getType(ElementInterface $element): string { return 'datetime'; } diff --git a/src/View/Helper/FormDateTimeLocal.php b/src/View/Helper/FormDateTimeLocal.php index e580aefa4..aca9bcd03 100644 --- a/src/View/Helper/FormDateTimeLocal.php +++ b/src/View/Helper/FormDateTimeLocal.php @@ -11,7 +11,7 @@ class FormDateTimeLocal extends FormDateTime * * @return string */ - protected function getType(ElementInterface $element) + protected function getType(ElementInterface $element): string { return 'datetime-local'; } diff --git a/src/View/Helper/FormDateTimeSelect.php b/src/View/Helper/FormDateTimeSelect.php index ded3ac17e..add1412b0 100644 --- a/src/View/Helper/FormDateTimeSelect.php +++ b/src/View/Helper/FormDateTimeSelect.php @@ -78,7 +78,7 @@ public function __invoke( * @throws Exception\InvalidArgumentException * @throws Exception\DomainException */ - public function render(ElementInterface $element) + public function render(ElementInterface $element): string { if (! $element instanceof DateTimeSelectElement) { throw new Exception\InvalidArgumentException(sprintf( @@ -170,7 +170,7 @@ public function setTimeType($timeType) /** * @return int */ - public function getTimeType() + public function getTimeType(): int { return $this->timeType; } @@ -180,7 +180,7 @@ public function getTimeType() * * @return string */ - public function getPattern() + public function getPattern(): string { if ($this->pattern === null) { $intl = new IntlDateFormatter($this->getLocale(), $this->dateType, $this->timeType); @@ -198,7 +198,7 @@ public function getPattern() * @param bool $renderDelimiters * @return array */ - protected function parsePattern($renderDelimiters = true) + protected function parsePattern($renderDelimiters = true): array { $pattern = $this->getPattern(); $pregResult = preg_split( @@ -239,7 +239,7 @@ protected function parsePattern($renderDelimiters = true) * @param string $pattern Pattern to use for hours * @return array */ - protected function getHoursOptions($pattern) + protected function getHoursOptions($pattern): array { $keyFormatter = new IntlDateFormatter($this->getLocale(), null, null, null, null, 'HH'); $valueFormatter = new IntlDateFormatter($this->getLocale(), null, null, null, null, $pattern); @@ -263,7 +263,7 @@ protected function getHoursOptions($pattern) * @param string $pattern Pattern to use for minutes * @return array */ - protected function getMinutesOptions($pattern) + protected function getMinutesOptions($pattern): array { $keyFormatter = new IntlDateFormatter($this->getLocale(), null, null, null, null, 'mm'); $valueFormatter = new IntlDateFormatter($this->getLocale(), null, null, null, null, $pattern); @@ -287,7 +287,7 @@ protected function getMinutesOptions($pattern) * @param string $pattern Pattern to use for seconds * @return array */ - protected function getSecondsOptions($pattern) + protected function getSecondsOptions($pattern): array { $keyFormatter = new IntlDateFormatter($this->getLocale(), null, null, null, null, 'ss'); $valueFormatter = new IntlDateFormatter($this->getLocale(), null, null, null, null, $pattern); diff --git a/src/View/Helper/FormElement.php b/src/View/Helper/FormElement.php index dad053f4d..e2b0d8735 100644 --- a/src/View/Helper/FormElement.php +++ b/src/View/Helper/FormElement.php @@ -94,7 +94,7 @@ public function __invoke(?ElementInterface $element = null) * * @return string */ - public function render(ElementInterface $element) + public function render(ElementInterface $element): string { $renderer = $this->getView(); if ($renderer === null || ! method_exists($renderer, 'plugin')) { @@ -164,7 +164,7 @@ public function addClass($class, $plugin) * @param string $name * @return string */ - protected function renderHelper($name, ElementInterface $element) + protected function renderHelper($name, ElementInterface $element): string { $renderer = $this->getView(); assert($renderer instanceof PhpRenderer); @@ -178,7 +178,7 @@ protected function renderHelper($name, ElementInterface $element) * * @return string|null */ - protected function renderInstance(ElementInterface $element) + protected function renderInstance(ElementInterface $element): ?string { foreach ($this->classMap as $class => $pluginName) { if ($element instanceof $class) { @@ -194,7 +194,7 @@ protected function renderInstance(ElementInterface $element) * * @return string|null */ - protected function renderType(ElementInterface $element) + protected function renderType(ElementInterface $element): ?string { $type = $element->getAttribute('type'); diff --git a/src/View/Helper/FormElementErrors.php b/src/View/Helper/FormElementErrors.php index b8743fbdf..be3f37626 100644 --- a/src/View/Helper/FormElementErrors.php +++ b/src/View/Helper/FormElementErrors.php @@ -53,7 +53,7 @@ public function __invoke(?ElementInterface $element = null, array $attributes = * @throws Exception\DomainException * @return string */ - public function render(ElementInterface $element, array $attributes = []) + public function render(ElementInterface $element, array $attributes = []): string { $messages = $element->getMessages(); if (! $messages) { @@ -98,7 +98,7 @@ public function setAttributes(array $attributes) * * @return array */ - public function getAttributes() + public function getAttributes(): array { return $this->attributes; } @@ -120,7 +120,7 @@ public function setMessageCloseString($messageCloseString) * * @return string */ - public function getMessageCloseString() + public function getMessageCloseString(): string { return $this->messageCloseString; } @@ -142,7 +142,7 @@ public function setMessageOpenFormat($messageOpenFormat) * * @return string */ - public function getMessageOpenFormat() + public function getMessageOpenFormat(): string { return $this->messageOpenFormat; } @@ -164,7 +164,7 @@ public function setMessageSeparatorString($messageSeparatorString) * * @return string */ - public function getMessageSeparatorString() + public function getMessageSeparatorString(): string { return $this->messageSeparatorString; } @@ -185,7 +185,7 @@ public function setTranslateMessages($flag) * @param array $messages * @return array */ - private function flattenMessages(array $messages) + private function flattenMessages(array $messages): array { return $this->translateErrorMessages && $this->getTranslator() ? $this->flattenMessagesWithTranslator($messages) @@ -196,7 +196,7 @@ private function flattenMessages(array $messages) * @param array $messages * @return array */ - private function flattenMessagesWithoutTranslator(array $messages) + private function flattenMessagesWithoutTranslator(array $messages): array { $messagesToPrint = []; array_walk_recursive($messages, static function ($item) use (&$messagesToPrint) { @@ -209,7 +209,7 @@ private function flattenMessagesWithoutTranslator(array $messages) * @param array $messages * @return array */ - private function flattenMessagesWithTranslator(array $messages) + private function flattenMessagesWithTranslator(array $messages): array { $translator = $this->getTranslator(); $textDomain = $this->getTranslatorTextDomain(); diff --git a/src/View/Helper/FormEmail.php b/src/View/Helper/FormEmail.php index 841be6d5e..4c0220777 100644 --- a/src/View/Helper/FormEmail.php +++ b/src/View/Helper/FormEmail.php @@ -35,7 +35,7 @@ class FormEmail extends FormInput * * @return string */ - protected function getType(ElementInterface $element) + protected function getType(ElementInterface $element): string { return 'email'; } diff --git a/src/View/Helper/FormFile.php b/src/View/Helper/FormFile.php index 769493ebb..900d655d1 100644 --- a/src/View/Helper/FormFile.php +++ b/src/View/Helper/FormFile.php @@ -34,7 +34,7 @@ class FormFile extends FormInput * @throws Exception\DomainException * @return string */ - public function render(ElementInterface $element) + public function render(ElementInterface $element): string { $name = $element->getName(); if ($name === null || $name === '') { @@ -70,7 +70,7 @@ public function render(ElementInterface $element) * * @return string */ - protected function getType(ElementInterface $element) + protected function getType(ElementInterface $element): string { return 'file'; } diff --git a/src/View/Helper/FormHidden.php b/src/View/Helper/FormHidden.php index 8ee838a0b..f55dfac18 100644 --- a/src/View/Helper/FormHidden.php +++ b/src/View/Helper/FormHidden.php @@ -25,7 +25,7 @@ class FormHidden extends FormInput * * @return string */ - protected function getType(ElementInterface $element) + protected function getType(ElementInterface $element): string { return 'hidden'; } diff --git a/src/View/Helper/FormImage.php b/src/View/Helper/FormImage.php index 588f24589..692ed634e 100644 --- a/src/View/Helper/FormImage.php +++ b/src/View/Helper/FormImage.php @@ -37,7 +37,7 @@ class FormImage extends FormInput * @throws Exception\DomainException * @return string */ - public function render(ElementInterface $element) + public function render(ElementInterface $element): string { $src = $element->getAttribute('src'); if (empty($src)) { @@ -55,7 +55,7 @@ public function render(ElementInterface $element) * * @return string */ - protected function getType(ElementInterface $element) + protected function getType(ElementInterface $element): string { return 'image'; } diff --git a/src/View/Helper/FormInput.php b/src/View/Helper/FormInput.php index 3db575235..49c2aafdb 100644 --- a/src/View/Helper/FormInput.php +++ b/src/View/Helper/FormInput.php @@ -102,7 +102,7 @@ public function __invoke(?ElementInterface $element = null) * @throws Exception\DomainException * @return string */ - public function render(ElementInterface $element) + public function render(ElementInterface $element): string { $name = $element->getName(); if ($name === null || $name === '') { @@ -133,7 +133,7 @@ public function render(ElementInterface $element) * * @return string */ - protected function getType(ElementInterface $element) + protected function getType(ElementInterface $element): string { $type = $element->getAttribute('type'); if (empty($type)) { diff --git a/src/View/Helper/FormLabel.php b/src/View/Helper/FormLabel.php index d21af9074..728844a8c 100644 --- a/src/View/Helper/FormLabel.php +++ b/src/View/Helper/FormLabel.php @@ -96,7 +96,7 @@ public function __invoke(?ElementInterface $element = null, $labelContent = null * @throws Exception\DomainException * @return string */ - public function openTag($attributesOrElement = null) + public function openTag($attributesOrElement = null): string { if (null === $attributesOrElement) { return ''; } diff --git a/src/View/Helper/FormMonth.php b/src/View/Helper/FormMonth.php index 9be4f764e..4ae18c54b 100644 --- a/src/View/Helper/FormMonth.php +++ b/src/View/Helper/FormMonth.php @@ -11,7 +11,7 @@ class FormMonth extends FormDateTime * * @return string */ - protected function getType(ElementInterface $element) + protected function getType(ElementInterface $element): string { return 'month'; } diff --git a/src/View/Helper/FormMonthSelect.php b/src/View/Helper/FormMonthSelect.php index f03b87c65..00604edc9 100644 --- a/src/View/Helper/FormMonthSelect.php +++ b/src/View/Helper/FormMonthSelect.php @@ -97,7 +97,7 @@ public function __invoke(?ElementInterface $element = null, $dateType = IntlDate * @throws Exception\InvalidArgumentException * @throws Exception\DomainException */ - public function render(ElementInterface $element) + public function render(ElementInterface $element): string { if (! $element instanceof MonthSelectElement) { throw new Exception\InvalidArgumentException(sprintf( @@ -155,7 +155,7 @@ public function render(ElementInterface $element) * @param bool $renderDelimiters * @return array */ - protected function parsePattern($renderDelimiters = true) + protected function parsePattern($renderDelimiters = true): array { $pattern = $this->getPattern(); $pregResult = preg_split( @@ -186,7 +186,7 @@ protected function parsePattern($renderDelimiters = true) * * @return string */ - public function getPattern() + public function getPattern(): string { if (null === $this->pattern) { $intl = new IntlDateFormatter($this->getLocale(), $this->dateType, IntlDateFormatter::NONE); @@ -219,7 +219,7 @@ public function setDateType($dateType) * * @return int */ - public function getDateType() + public function getDateType(): int { return $this->dateType; } @@ -241,7 +241,7 @@ public function setLocale($locale) * * @return string */ - public function getLocale() + public function getLocale(): string { if (null === $this->locale) { $this->locale = Locale::getDefault(); @@ -256,7 +256,7 @@ public function getLocale() * @param string $pattern Pattern to use for months * @return array */ - protected function getMonthsOptions($pattern) + protected function getMonthsOptions($pattern): array { $keyFormatter = new IntlDateFormatter($this->getLocale(), null, null, null, null, 'MM'); $valueFormatter = new IntlDateFormatter($this->getLocale(), null, null, null, null, $pattern); @@ -283,7 +283,7 @@ protected function getMonthsOptions($pattern) * @param int $maxYear * @return array */ - protected function getYearsOptions($minYear, $maxYear) + protected function getYearsOptions($minYear, $maxYear): array { $result = []; for ($i = $maxYear; $i >= $minYear; --$i) { @@ -298,7 +298,7 @@ protected function getYearsOptions($minYear, $maxYear) * * @return FormSelect */ - protected function getSelectElementHelper() + protected function getSelectElementHelper(): FormSelect { if ($this->selectHelper) { return $this->selectHelper; diff --git a/src/View/Helper/FormMultiCheckbox.php b/src/View/Helper/FormMultiCheckbox.php index b8ede97dd..382476971 100644 --- a/src/View/Helper/FormMultiCheckbox.php +++ b/src/View/Helper/FormMultiCheckbox.php @@ -97,7 +97,7 @@ public function __invoke(?ElementInterface $element = null, $labelPosition = nul * @throws Exception\InvalidArgumentException * @return string */ - public function render(ElementInterface $element) + public function render(ElementInterface $element): string { if (! $element instanceof MultiCheckboxElement) { throw new Exception\InvalidArgumentException(sprintf( @@ -138,7 +138,7 @@ protected function renderOptions( array $options, array $selectedOptions, array $attributes - ) { + ): string { $escapeHtmlHelper = $this->getEscapeHtmlHelper(); $labelHelper = $this->getLabelHelper(); $labelClose = $labelHelper->closeTag(); @@ -248,7 +248,7 @@ protected function renderOptions( * * @return string */ - protected function renderHiddenElement(MultiCheckboxElement $element) + protected function renderHiddenElement(MultiCheckboxElement $element): string { $closingBracket = $this->getInlineClosingBracket(); @@ -283,7 +283,7 @@ public function setLabelAttributes($attributes) * * @return array|null */ - public function getLabelAttributes() + public function getLabelAttributes(): ?array { return $this->labelAttributes; } @@ -317,7 +317,7 @@ public function setLabelPosition($labelPosition) * * @return string */ - public function getLabelPosition() + public function getLabelPosition(): string { return $this->labelPosition; } @@ -339,7 +339,7 @@ public function setSeparator($separator) * * @return string */ - public function getSeparator() + public function getSeparator(): string { return $this->separator; } @@ -363,7 +363,7 @@ public function setUseHiddenElement($useHiddenElement) * * @return bool */ - public function getUseHiddenElement() + public function getUseHiddenElement(): bool { return $this->useHiddenElement; } @@ -385,7 +385,7 @@ public function setUncheckedValue($value) * * @return string */ - public function getUncheckedValue() + public function getUncheckedValue(): string { return $this->uncheckedValue; } @@ -395,7 +395,7 @@ public function getUncheckedValue() * * @return string */ - protected function getInputType() + protected function getInputType(): string { return 'checkbox'; } @@ -406,7 +406,7 @@ protected function getInputType() * @throws Exception\DomainException * @return string */ - protected static function getName(ElementInterface $element) + protected static function getName(ElementInterface $element): string { $name = $element->getName(); if ($name === null || $name === '') { @@ -423,7 +423,7 @@ protected static function getName(ElementInterface $element) * * @return FormInput */ - protected function getInputHelper() + protected function getInputHelper(): FormInput { if ($this->inputHelper) { return $this->inputHelper; @@ -445,7 +445,7 @@ protected function getInputHelper() * * @return FormLabel */ - protected function getLabelHelper() + protected function getLabelHelper(): FormLabel { if ($this->labelHelper) { return $this->labelHelper; diff --git a/src/View/Helper/FormNumber.php b/src/View/Helper/FormNumber.php index 9175a0119..edb9c8460 100644 --- a/src/View/Helper/FormNumber.php +++ b/src/View/Helper/FormNumber.php @@ -33,7 +33,7 @@ class FormNumber extends FormInput * * @return string */ - protected function getType(ElementInterface $element) + protected function getType(ElementInterface $element): string { return 'number'; } diff --git a/src/View/Helper/FormPassword.php b/src/View/Helper/FormPassword.php index 8eb64ed6f..2286724ca 100644 --- a/src/View/Helper/FormPassword.php +++ b/src/View/Helper/FormPassword.php @@ -33,7 +33,7 @@ class FormPassword extends FormInput * * @return string */ - protected function getType(ElementInterface $element) + protected function getType(ElementInterface $element): string { return 'password'; } diff --git a/src/View/Helper/FormRadio.php b/src/View/Helper/FormRadio.php index c5626185e..a75b740e8 100644 --- a/src/View/Helper/FormRadio.php +++ b/src/View/Helper/FormRadio.php @@ -11,7 +11,7 @@ class FormRadio extends FormMultiCheckbox * * @return string */ - protected function getInputType() + protected function getInputType(): string { return 'radio'; } @@ -21,7 +21,7 @@ protected function getInputType() * * @return string */ - protected static function getName(ElementInterface $element) + protected static function getName(ElementInterface $element): string { return (string) $element->getName(); } diff --git a/src/View/Helper/FormRange.php b/src/View/Helper/FormRange.php index f5e2dc765..ec6671302 100644 --- a/src/View/Helper/FormRange.php +++ b/src/View/Helper/FormRange.php @@ -31,7 +31,7 @@ class FormRange extends FormInput * * @return string */ - protected function getType(ElementInterface $element) + protected function getType(ElementInterface $element): string { return 'range'; } diff --git a/src/View/Helper/FormReset.php b/src/View/Helper/FormReset.php index 16789ef2d..be519f48f 100644 --- a/src/View/Helper/FormReset.php +++ b/src/View/Helper/FormReset.php @@ -36,7 +36,7 @@ class FormReset extends FormInput * @throws Exception\DomainException * @return string */ - protected function getType(ElementInterface $element) + protected function getType(ElementInterface $element): string { return 'reset'; } diff --git a/src/View/Helper/FormRow.php b/src/View/Helper/FormRow.php index 5338809a1..7590ee994 100644 --- a/src/View/Helper/FormRow.php +++ b/src/View/Helper/FormRow.php @@ -113,7 +113,7 @@ public function __invoke( * @throws Exception\DomainException * @return string */ - public function render(ElementInterface $element, $labelPosition = null) + public function render(ElementInterface $element, $labelPosition = null): string { $escapeHtmlHelper = $this->getEscapeHtmlHelper(); $labelHelper = $this->getLabelHelper(); @@ -263,7 +263,7 @@ public function setInputErrorClass($inputErrorClass) * * @return string */ - public function getInputErrorClass() + public function getInputErrorClass(): string { return $this->inputErrorClass; } @@ -285,7 +285,7 @@ public function setLabelAttributes($labelAttributes) * * @return array */ - public function getLabelAttributes() + public function getLabelAttributes(): array { return $this->labelAttributes; } @@ -319,7 +319,7 @@ public function setLabelPosition($labelPosition) * * @return string */ - public function getLabelPosition() + public function getLabelPosition(): string { return $this->labelPosition; } @@ -341,7 +341,7 @@ public function setRenderErrors($renderErrors) * * @return bool */ - public function getRenderErrors() + public function getRenderErrors(): bool { return $this->renderErrors; } @@ -363,7 +363,7 @@ public function setPartial($partial) * * @return null|string */ - public function getPartial() + public function getPartial(): ?string { return $this->partial; } @@ -373,7 +373,7 @@ public function getPartial() * * @return FormLabel */ - protected function getLabelHelper() + protected function getLabelHelper(): FormLabel { if ($this->labelHelper) { return $this->labelHelper; @@ -402,7 +402,7 @@ protected function getLabelHelper() * * @return FormElement */ - protected function getElementHelper() + protected function getElementHelper(): FormElement { if ($this->elementHelper) { return $this->elementHelper; @@ -424,7 +424,7 @@ protected function getElementHelper() * * @return FormElementErrors */ - protected function getElementErrorsHelper() + protected function getElementErrorsHelper(): FormElementErrors { if ($this->elementErrorsHelper) { return $this->elementErrorsHelper; diff --git a/src/View/Helper/FormSearch.php b/src/View/Helper/FormSearch.php index 50083810f..92d0a09de 100644 --- a/src/View/Helper/FormSearch.php +++ b/src/View/Helper/FormSearch.php @@ -19,7 +19,7 @@ class FormSearch extends FormText * * @return string */ - protected function getType(ElementInterface $element) + protected function getType(ElementInterface $element): string { return 'search'; } diff --git a/src/View/Helper/FormSelect.php b/src/View/Helper/FormSelect.php index a0584ee97..b0cfbe13a 100644 --- a/src/View/Helper/FormSelect.php +++ b/src/View/Helper/FormSelect.php @@ -97,7 +97,7 @@ public function __invoke(?ElementInterface $element = null) * @throws Exception\DomainException * @return string */ - public function render(ElementInterface $element) + public function render(ElementInterface $element): string { if (! $element instanceof SelectElement) { throw new Exception\InvalidArgumentException(sprintf( @@ -161,7 +161,7 @@ public function render(ElementInterface $element) * @param array $selectedOptions Option values that should be marked as selected * @return string */ - public function renderOptions(array $options, array $selectedOptions = []) + public function renderOptions(array $options, array $selectedOptions = []): string { $template = ''; $optionStrings = []; @@ -242,7 +242,7 @@ public function renderOptions(array $options, array $selectedOptions = []) * @param array $selectedOptions * @return string */ - public function renderOptgroup(array $optgroup, array $selectedOptions = []) + public function renderOptgroup(array $optgroup, array $selectedOptions = []): string { $template = '%s'; @@ -278,7 +278,7 @@ public function renderOptgroup(array $optgroup, array $selectedOptions = []) * @return array * @throws Exception\DomainException */ - protected function validateMultiValue($value, array $attributes) + protected function validateMultiValue($value, array $attributes): array { if (null === $value) { return []; @@ -313,7 +313,7 @@ protected function renderHiddenElement(SelectElement $element) /** * @return FormHidden */ - protected function getFormHiddenHelper() + protected function getFormHiddenHelper(): FormHidden { if (! $this->formHiddenHelper) { if (method_exists($this->view, 'plugin')) { diff --git a/src/View/Helper/FormSubmit.php b/src/View/Helper/FormSubmit.php index 8b24ca894..22b35ef62 100644 --- a/src/View/Helper/FormSubmit.php +++ b/src/View/Helper/FormSubmit.php @@ -39,9 +39,8 @@ class FormSubmit extends FormInput * Determine input type to use * * @throws Exception\DomainException - * @return string */ - protected function getType(ElementInterface $element) + protected function getType(ElementInterface $element): string { return 'submit'; } diff --git a/src/View/Helper/FormTel.php b/src/View/Helper/FormTel.php index 673d7fc70..2bee69ff2 100644 --- a/src/View/Helper/FormTel.php +++ b/src/View/Helper/FormTel.php @@ -34,7 +34,7 @@ class FormTel extends FormInput * * @return string */ - protected function getType(ElementInterface $element) + protected function getType(ElementInterface $element): string { return 'tel'; } diff --git a/src/View/Helper/FormText.php b/src/View/Helper/FormText.php index 3601e72fc..e59f6ff67 100644 --- a/src/View/Helper/FormText.php +++ b/src/View/Helper/FormText.php @@ -36,7 +36,7 @@ class FormText extends FormInput * * @return string */ - protected function getType(ElementInterface $element) + protected function getType(ElementInterface $element): string { return 'text'; } diff --git a/src/View/Helper/FormTextarea.php b/src/View/Helper/FormTextarea.php index af965c87f..294000ede 100644 --- a/src/View/Helper/FormTextarea.php +++ b/src/View/Helper/FormTextarea.php @@ -54,7 +54,7 @@ public function __invoke(?ElementInterface $element = null) * @throws Exception\DomainException * @return string */ - public function render(ElementInterface $element) + public function render(ElementInterface $element): string { $name = $element->getName(); if (empty($name) && $name !== 0) { diff --git a/src/View/Helper/FormTime.php b/src/View/Helper/FormTime.php index 1fa9c6f13..dcc8f9a28 100644 --- a/src/View/Helper/FormTime.php +++ b/src/View/Helper/FormTime.php @@ -11,7 +11,7 @@ class FormTime extends FormDateTime * * @return string */ - protected function getType(ElementInterface $element) + protected function getType(ElementInterface $element): string { return 'time'; } diff --git a/src/View/Helper/FormUrl.php b/src/View/Helper/FormUrl.php index c72aaf6af..ae4e94701 100644 --- a/src/View/Helper/FormUrl.php +++ b/src/View/Helper/FormUrl.php @@ -34,7 +34,7 @@ class FormUrl extends FormInput * * @return string */ - protected function getType(ElementInterface $element) + protected function getType(ElementInterface $element): string { return 'url'; } diff --git a/src/View/Helper/FormWeek.php b/src/View/Helper/FormWeek.php index 160e9bf21..da846e4b4 100644 --- a/src/View/Helper/FormWeek.php +++ b/src/View/Helper/FormWeek.php @@ -11,7 +11,7 @@ class FormWeek extends FormDateTime * * @return string */ - protected function getType(ElementInterface $element) + protected function getType(ElementInterface $element): string { return 'week'; } diff --git a/test/Integration/TestAsset/Form.php b/test/Integration/TestAsset/Form.php index 9182a6693..9d5bffce2 100644 --- a/test/Integration/TestAsset/Form.php +++ b/test/Integration/TestAsset/Form.php @@ -13,7 +13,7 @@ class Form extends BaseForm /** * {@inheritDoc} */ - public function init() + public function init(): void { $this->elementManagerAtInit = $this->getFormFactory()->getFormElementManager(); } diff --git a/test/LabelAwareTraitTest.php b/test/LabelAwareTraitTest.php index 5980ce910..ac23ff872 100644 --- a/test/LabelAwareTraitTest.php +++ b/test/LabelAwareTraitTest.php @@ -22,7 +22,7 @@ public function testSetLabelAttributes(): void use LabelAwareTrait; }; - $this->assertNull($object->getLabelAttributes()); + $this->assertEmpty($object->getLabelAttributes()); $labelAttributes = [ 'test', @@ -40,9 +40,7 @@ public function testGetEmptyLabelAttributes(): void use LabelAwareTrait; }; - $labelAttributes = $object->getLabelAttributes(); - - $this->assertEquals(null, $labelAttributes); + $this->assertEmpty($object->getLabelAttributes()); } public function testGetLabelAttributes(): void diff --git a/test/TestAsset/FieldsetWithDependency.php b/test/TestAsset/FieldsetWithDependency.php index 3aadaf587..43bd15097 100644 --- a/test/TestAsset/FieldsetWithDependency.php +++ b/test/TestAsset/FieldsetWithDependency.php @@ -17,7 +17,7 @@ public function __construct($name = null, $options = []) parent::__construct('fieldset_with_dependency', $options); } - public function init() + public function init(): void { // should not fail $this->dependency->getValues(); diff --git a/test/TestAsset/ValueStoringFieldset.php b/test/TestAsset/ValueStoringFieldset.php index 053cd67d6..2caaff7f3 100644 --- a/test/TestAsset/ValueStoringFieldset.php +++ b/test/TestAsset/ValueStoringFieldset.php @@ -9,7 +9,7 @@ class ValueStoringFieldset extends Fieldset /** @var iterable */ protected $storedValue; - public function populateValues(iterable $data) + public function populateValues(iterable $data): void { $this->storedValue = $data; parent::populateValues($data); diff --git a/test/View/Helper/FormTest.php b/test/View/Helper/FormTest.php index eceb7174b..d97d563b0 100644 --- a/test/View/Helper/FormTest.php +++ b/test/View/Helper/FormTest.php @@ -6,6 +6,7 @@ use Laminas\Form\Element\Submit; use Laminas\Form\Form; use Laminas\Form\View\Helper\Form as FormHelper; +use Laminas\Stdlib\PriorityList; use Laminas\View\Helper\Doctype; use Laminas\View\Helper\EscapeHtmlAttr; use LaminasTest\Form\TestAsset\CityFieldset; @@ -100,7 +101,7 @@ public function testRenderPreparesForm(): void $form = $this->createMock(Form::class); $form->expects($this->once())->method('prepare'); $form->method('getAttributes')->willReturn([]); - $form->method('getIterator')->willReturn(new ArrayIterator([])); + $form->method('getIterator')->willReturn(new PriorityList()); $markup = $this->helper->__invoke($form); From 40a35aacef588de0edf9c06f6104c614aee01c78 Mon Sep 17 00:00:00 2001 From: Filippo Tessarotto Date: Thu, 27 May 2021 10:04:21 +0200 Subject: [PATCH 4/9] Fix PSalm errors Signed-off-by: Filippo Tessarotto --- .../AbstractAnnotationsListener.php | 1 - src/Annotation/AbstractBuilder.php | 16 ---- src/Annotation/BuilderAbstractFactory.php | 3 - src/Annotation/ElementAnnotationsListener.php | 14 ---- src/Annotation/FormAnnotationsListener.php | 7 -- src/Element.php | 11 --- src/Element/Captcha.php | 2 - src/Element/Checkbox.php | 12 +-- src/Element/Collection.php | 31 +------ src/Element/Color.php | 2 - src/Element/Csrf.php | 4 - src/Element/DateSelect.php | 12 +-- src/Element/DateTime.php | 3 - src/Element/DateTimeSelect.php | 19 ----- src/Element/Email.php | 4 - src/Element/File.php | 2 - src/Element/MonthSelect.php | 25 ------ src/Element/MultiCheckbox.php | 4 - src/Element/Password.php | 2 - src/Element/Select.php | 12 --- src/Element/Tel.php | 2 - src/Element/Url.php | 2 - src/ElementFactory.php | 1 - src/ElementInterface.php | 5 -- src/Factory.php | 18 ---- src/Fieldset.php | 27 +----- src/FieldsetInterface.php | 9 -- src/Form.php | 35 -------- src/FormAbstractServiceFactory.php | 4 - src/FormElementManager.php | 3 - src/FormInterface.php | 4 - src/LabelAwareInterface.php | 3 - src/LabelAwareTrait.php | 1 - src/View/Helper/AbstractHelper.php | 18 ---- src/View/Helper/Captcha/AbstractWord.php | 9 +- src/View/Helper/Captcha/Dumb.php | 1 - src/View/Helper/Captcha/Figlet.php | 1 - src/View/Helper/Captcha/Image.php | 1 - src/View/Helper/Captcha/ReCaptcha.php | 3 - .../Helper/File/FormFileSessionProgress.php | 3 - .../Helper/File/FormFileUploadProgress.php | 10 --- src/View/Helper/Form.php | 6 -- src/View/Helper/FormButton.php | 6 -- src/View/Helper/FormCaptcha.php | 4 +- src/View/Helper/FormCheckbox.php | 3 - src/View/Helper/FormCollection.php | 19 +---- src/View/Helper/FormColor.php | 2 - src/View/Helper/FormDateSelect.php | 1 - src/View/Helper/FormDateTime.php | 2 - src/View/Helper/FormDateTimeLocal.php | 2 - src/View/Helper/FormDateTimeSelect.php | 6 -- src/View/Helper/FormElement.php | 7 -- src/View/Helper/FormElementErrors.php | 7 -- src/View/Helper/FormEmail.php | 2 - src/View/Helper/FormFile.php | 3 - src/View/Helper/FormHidden.php | 2 - src/View/Helper/FormImage.php | 3 - src/View/Helper/FormInput.php | 3 - src/View/Helper/FormLabel.php | 3 - src/View/Helper/FormMonth.php | 2 - src/View/Helper/FormMonthSelect.php | 9 -- src/View/Helper/FormMultiCheckbox.php | 19 ----- src/View/Helper/FormNumber.php | 2 - src/View/Helper/FormPassword.php | 2 - src/View/Helper/FormRadio.php | 4 - src/View/Helper/FormRange.php | 2 - src/View/Helper/FormReset.php | 1 - src/View/Helper/FormRow.php | 15 ---- src/View/Helper/FormSearch.php | 2 - src/View/Helper/FormSelect.php | 6 -- src/View/Helper/FormTel.php | 2 - src/View/Helper/FormText.php | 2 - src/View/Helper/FormTextarea.php | 3 +- src/View/Helper/FormTime.php | 2 - src/View/Helper/FormUrl.php | 2 - src/View/Helper/FormWeek.php | 2 - test/Element/CollectionTest.php | 84 ++++++++++++------- test/FactoryTest.php | 1 + test/FormTest.php | 31 +++++-- test/View/Helper/FormButtonTest.php | 6 +- test/View/Helper/FormColorTest.php | 6 +- test/View/Helper/FormDateTimeLocalTest.php | 6 +- test/View/Helper/FormDateTimeTest.php | 6 +- test/View/Helper/FormEmailTest.php | 6 +- test/View/Helper/FormFileTest.php | 6 +- test/View/Helper/FormHiddenTest.php | 6 +- test/View/Helper/FormImageTest.php | 6 +- test/View/Helper/FormMonthTest.php | 6 +- test/View/Helper/FormNumberTest.php | 6 +- test/View/Helper/FormPasswordTest.php | 6 +- test/View/Helper/FormRangeTest.php | 6 +- test/View/Helper/FormResetTest.php | 6 +- test/View/Helper/FormSearchTest.php | 6 +- test/View/Helper/FormSubmitTest.php | 6 +- test/View/Helper/FormTelTest.php | 6 +- test/View/Helper/FormTest.php | 1 - test/View/Helper/FormTextTest.php | 6 +- test/View/Helper/FormTextareaTest.php | 6 +- test/View/Helper/FormTimeTest.php | 6 +- test/View/Helper/FormUrlTest.php | 6 +- test/View/Helper/FormWeekTest.php | 6 +- 101 files changed, 176 insertions(+), 571 deletions(-) diff --git a/src/Annotation/AbstractAnnotationsListener.php b/src/Annotation/AbstractAnnotationsListener.php index 2f0c16556..37a955884 100644 --- a/src/Annotation/AbstractAnnotationsListener.php +++ b/src/Annotation/AbstractAnnotationsListener.php @@ -49,7 +49,6 @@ public function handleNameAnnotation($e) * Discover the fallback name via reflection * * @param EventInterface $e - * @return string */ public function discoverFallbackName($e): string { diff --git a/src/Annotation/AbstractBuilder.php b/src/Annotation/AbstractBuilder.php index cebf1d857..093580b47 100644 --- a/src/Annotation/AbstractBuilder.php +++ b/src/Annotation/AbstractBuilder.php @@ -56,8 +56,6 @@ public function setFormFactory(Factory $formFactory) /** * Set event manager instance - * - * @return void */ public function setEventManager(EventManagerInterface $eventManager): void { @@ -74,8 +72,6 @@ public function setEventManager(EventManagerInterface $eventManager): void * Retrieve form factory * * Lazy-loads the default form factory if none is currently set. - * - * @return Factory */ public function getFormFactory(): Factory { @@ -89,8 +85,6 @@ public function getFormFactory(): Factory /** * Get event manager - * - * @return EventManagerInterface */ public function getEventManager(): EventManagerInterface { @@ -105,7 +99,6 @@ public function getEventManager(): EventManagerInterface * * @param string|object $entity Either an instance or a valid class name for an entity * @throws Exception\InvalidArgumentException If $entity is not an object or class name. - * @return ArrayObject */ public function getFormSpecification($entity): ArrayObject { @@ -149,7 +142,6 @@ abstract protected function getFormSpecificationInternal($entity): array; * Create a form from an object. * * @param string|object $entity - * @return FormInterface */ public function createForm($entity): FormInterface { @@ -160,8 +152,6 @@ public function createForm($entity): FormInterface /** * Get the entity used to construct the form. - * - * @return object */ public function getEntity(): object { @@ -175,7 +165,6 @@ public function getEntity(): object * @param ReflectionClass $reflection * @param ArrayObject $formSpec * @param ArrayObject $filterSpec - * @return void * @triggers discoverName * @triggers configureForm */ @@ -205,7 +194,6 @@ protected function configureForm($annotations, $reflection, $formSpec, $filterSp * @param ReflectionProperty $reflection * @param ArrayObject $formSpec * @param ArrayObject $filterSpec - * @return void * @triggers checkForExclude * @triggers discoverName * @triggers configureElement @@ -280,9 +268,6 @@ public function setPreserveDefinedOrder($preserveDefinedOrder) return $this; } - /** - * @return bool - */ public function preserveDefinedOrder(): bool { return $this->preserveDefinedOrder; @@ -293,7 +278,6 @@ public function preserveDefinedOrder(): bool * * @param AnnotationCollection $annotations * @param Reflector $reflection - * @return string */ protected function discoverName($annotations, $reflection): string { diff --git a/src/Annotation/BuilderAbstractFactory.php b/src/Annotation/BuilderAbstractFactory.php index da9ee0a28..8dadee319 100644 --- a/src/Annotation/BuilderAbstractFactory.php +++ b/src/Annotation/BuilderAbstractFactory.php @@ -24,7 +24,6 @@ class BuilderAbstractFactory implements AbstractFactoryInterface /** * @param string $requestedName * @param null|array $options - * @return AnnotationBuilder * @throws ServiceNotCreatedException For invalid listener configuration. */ public function __invoke(ContainerInterface $container, $requestedName, ?array $options = null): AnnotationBuilder @@ -53,7 +52,6 @@ public function __invoke(ContainerInterface $container, $requestedName, ?array $ /** * @param string $requestedName - * @return bool */ public function canCreate(ContainerInterface $container, $requestedName): bool { @@ -95,7 +93,6 @@ private function marshalConfig(ContainerInterface $container): array * - otherwise attaches it to the event manager * * @param array $config - * @return void * @throws ServiceNotCreatedException If any listener is not an event listener aggregate. */ private function injectListeners(array $config, EventManagerInterface $events, ContainerInterface $container): void diff --git a/src/Annotation/ElementAnnotationsListener.php b/src/Annotation/ElementAnnotationsListener.php index 5ec939528..ad2a5b7ba 100644 --- a/src/Annotation/ElementAnnotationsListener.php +++ b/src/Annotation/ElementAnnotationsListener.php @@ -71,7 +71,6 @@ public function attach(EventManagerInterface $events, $priority = 1) * Sets the allow_empty flag on the input specification array. * * @param EventInterface $e - * @return void */ public function handleAllowEmptyAnnotation($e): void { @@ -90,7 +89,6 @@ public function handleAllowEmptyAnnotation($e): void * Sets the attributes array of the element specification. * * @param EventInterface $e - * @return void */ public function handleAttributesAnnotation($e): void { @@ -115,7 +113,6 @@ public function handleAttributesAnnotation($e): void * Allow creating fieldsets from composed entity properties * * @param EventInterface $e - * @return void */ public function handleComposedObjectAnnotation($e): void { @@ -189,7 +186,6 @@ public function handleComposedObjectAnnotation($e): void * Sets the continue_if_empty flag on the input specification array. * * @param EventInterface $e - * @return void */ public function handleContinueIfEmptyAnnotation($e): void { @@ -208,7 +204,6 @@ public function handleContinueIfEmptyAnnotation($e): void * Sets the error_message of the input specification. * * @param EventInterface $e - * @return void */ public function handleErrorMessageAnnotation($e): void { @@ -225,7 +220,6 @@ public function handleErrorMessageAnnotation($e): void * Determine if the element has been marked to exclude from the definition * * @param EventInterface $e - * @return bool */ public function handleExcludeAnnotation($e): bool { @@ -244,7 +238,6 @@ public function handleExcludeAnnotation($e): bool * Adds a filter to the filter chain specification for the input. * * @param EventInterface $e - * @return void */ public function handleFilterAnnotation($e): void { @@ -267,7 +260,6 @@ public function handleFilterAnnotation($e): void * priority). * * @param EventInterface $e - * @return void */ public function handleFlagsAnnotation($e): void { @@ -286,7 +278,6 @@ public function handleFlagsAnnotation($e): void * Sets the hydrator class to use in the fieldset specification. * * @param EventInterface $e - * @return void */ public function handleHydratorAnnotation($e): void { @@ -306,7 +297,6 @@ public function handleHydratorAnnotation($e): void * input class name. * * @param EventInterface $e - * @return void */ public function handleInputAnnotation($e): void { @@ -341,7 +331,6 @@ public function handleInstanceAnnotation(EventInterface $e): void * Sets the element options in the specification. * * @param EventInterface $e - * @return void */ public function handleOptionsAnnotation($e): void { @@ -360,7 +349,6 @@ public function handleOptionsAnnotation($e): void * Sets the required flag on the input based on the annotation value. * * @param EventInterface $e - * @return void */ public function handleRequiredAnnotation($e): void { @@ -389,7 +377,6 @@ public function handleRequiredAnnotation($e): void * Sets the element class type to use in the element specification. * * @param EventInterface $e - * @return void */ public function handleTypeAnnotation($e): void { @@ -408,7 +395,6 @@ public function handleTypeAnnotation($e): void * Adds a validator to the validator chain of the input specification. * * @param EventInterface $e - * @return void */ public function handleValidatorAnnotation($e): void { diff --git a/src/Annotation/FormAnnotationsListener.php b/src/Annotation/FormAnnotationsListener.php index c001fe335..0a1b23558 100644 --- a/src/Annotation/FormAnnotationsListener.php +++ b/src/Annotation/FormAnnotationsListener.php @@ -51,7 +51,6 @@ public function attach(EventManagerInterface $events, $priority = 1) * Sets the attributes key of the form specification. * * @param EventInterface $e - * @return void */ public function handleAttributesAnnotation($e): void { @@ -70,7 +69,6 @@ public function handleAttributesAnnotation($e): void * Sets the flags key of the form specification. * * @param EventInterface $e - * @return void */ public function handleFlagsAnnotation($e): void { @@ -89,7 +87,6 @@ public function handleFlagsAnnotation($e): void * Sets the hydrator class to use in the form specification. * * @param EventInterface $e - * @return void */ public function handleHydratorAnnotation($e): void { @@ -108,7 +105,6 @@ public function handleHydratorAnnotation($e): void * Sets the input filter class to use in the form specification. * * @param EventInterface $e - * @return void */ public function handleInputFilterAnnotation($e): void { @@ -143,7 +139,6 @@ public function handleInstanceAnnotation(EventInterface $e): void * Sets the options key of the form specification. * * @param EventInterface $e - * @return void */ public function handleOptionsAnnotation($e): void { @@ -162,7 +157,6 @@ public function handleOptionsAnnotation($e): void * Sets the form class to use in the form specification. * * @param EventInterface $e - * @return void */ public function handleTypeAnnotation($e): void { @@ -181,7 +175,6 @@ public function handleTypeAnnotation($e): void * Sets the validation group to use in the form specification. * * @param EventInterface $e - * @return void */ public function handleValidationGroupAnnotation($e): void { diff --git a/src/Element.php b/src/Element.php index 60f76bdb7..38d85b58b 100644 --- a/src/Element.php +++ b/src/Element.php @@ -62,8 +62,6 @@ public function __construct($name = null, iterable $options = []) /** * This function is automatically called when creating element with factory. It * allows to perform various operations (add elements...) - * - * @return void */ public function init(): void { @@ -83,8 +81,6 @@ public function setName($name) /** * Get value for name - * - * @return null|string */ public function getName(): ?string { @@ -210,7 +206,6 @@ public function removeAttribute($key) * Does the element has a specific attribute ? * * @param string $key - * @return bool */ public function hasAttribute($key): bool { @@ -308,8 +303,6 @@ public function setLabel($label) /** * Retrieve the label used for this element - * - * @return null|string */ public function getLabel(): ?string { @@ -434,7 +427,6 @@ public function removeLabelOption($key) * Does the element has a specific label option ? * * @param string $key - * @return bool */ public function hasLabelOption($key): bool { @@ -466,9 +458,6 @@ public function getMessages(): array return $this->messages; } - /** - * @return boolean - */ public function hasValue(): bool { return $this->hasValue; diff --git a/src/Element/Captcha.php b/src/Element/Captcha.php index e15c107b6..6035ba2dc 100644 --- a/src/Element/Captcha.php +++ b/src/Element/Captcha.php @@ -63,8 +63,6 @@ public function setCaptcha($captcha) /** * Retrieve captcha (if any) - * - * @return null|LaminasCaptcha\AdapterInterface */ public function getCaptcha(): ?LaminasCaptcha\AdapterInterface { diff --git a/src/Element/Checkbox.php b/src/Element/Checkbox.php index eb1abf9b4..ec2af4c0b 100644 --- a/src/Element/Checkbox.php +++ b/src/Element/Checkbox.php @@ -71,8 +71,6 @@ public function setUseHiddenElement($useHiddenElement) /** * Do we render hidden element? - * - * @return bool */ public function useHiddenElement(): bool { @@ -93,8 +91,6 @@ public function setUncheckedValue($uncheckedValue) /** * Get the value to use when checkbox is unchecked - * - * @return string */ public function getUncheckedValue(): string { @@ -115,8 +111,6 @@ public function setCheckedValue($checkedValue) /** * Get the value to use when checkbox is checked - * - * @return string */ public function getCheckedValue(): string { @@ -125,8 +119,6 @@ public function getCheckedValue(): string /** * Get validator - * - * @return ValidatorInterface */ protected function getValidator(): ?ValidatorInterface { @@ -164,8 +156,6 @@ public function getInputSpecification(): array /** * Checks if this checkbox is checked. - * - * @return bool */ public function isChecked(): bool { @@ -193,7 +183,7 @@ public function setChecked($value) public function setValue($value) { // Cast to strings because POST data comes in string form - $checked = (string) $value === (string) $this->getCheckedValue(); + $checked = (string) $value === $this->getCheckedValue(); $this->value = $checked ? $this->getCheckedValue() : $this->getUncheckedValue(); return $this; } diff --git a/src/Element/Collection.php b/src/Element/Collection.php index 0a1a281fe..8f1dee3a7 100644 --- a/src/Element/Collection.php +++ b/src/Element/Collection.php @@ -152,7 +152,6 @@ public function setOptions(iterable $options) * Checks if the object can be set in this fieldset * * @param object $object - * @return bool */ public function allowObjectBinding($object): bool { @@ -190,7 +189,6 @@ public function setObject($object) * * @throws Exception\InvalidArgumentException * @throws Exception\DomainException - * @return void */ public function populateValues(iterable $data): void { @@ -256,8 +254,6 @@ public function populateValues(iterable $data): void /** * Checks if this fieldset can bind data - * - * @return bool */ public function allowValueBinding(): bool { @@ -301,8 +297,6 @@ public function setCount($count) /** * Get the initial count of target element - * - * @return int */ public function getCount(): int { @@ -342,8 +336,6 @@ public function setTargetElement($elementOrFieldset) /** * Get target element - * - * @return ElementInterface|null */ public function getTargetElement(): ?ElementInterface { @@ -364,8 +356,6 @@ public function setAllowAdd($allowAdd) /** * Get allow add - * - * @return bool */ public function allowAdd(): bool { @@ -382,9 +372,6 @@ public function setAllowRemove($allowRemove) return $this; } - /** - * @return bool - */ public function allowRemove(): bool { return $this->allowRemove; @@ -406,8 +393,6 @@ public function setShouldCreateTemplate($shouldCreateTemplate) /** * Get if the collection should create a template - * - * @return bool */ public function shouldCreateTemplate(): bool { @@ -431,8 +416,6 @@ public function setTemplatePlaceholder($templatePlaceholder) /** * Get the template placeholder - * - * @return string */ public function getTemplatePlaceholder(): string { @@ -449,9 +432,6 @@ public function setCreateNewObjects($createNewObjects) return $this; } - /** - * @return bool - */ public function createNewObjects(): bool { return $this->createNewObjects; @@ -473,8 +453,6 @@ public function getTemplateElement() /** * Prepare the collection by adding a dummy template element if the user want one - * - * @return void */ public function prepareElement(FormInterface $form): void { @@ -536,7 +514,9 @@ public function extract(): array $targetElement->setObject($value); $values[$key] = $targetElement->extract(); if (! $this->createNewObjects() && $this->has($key)) { - $this->get($key)->setObject($value); + $fieldset = $this->get($key); + assert($fieldset instanceof FieldsetInterface); + $fieldset->setObject($value); } continue; } @@ -556,8 +536,6 @@ public function extract(): array /** * Create a new instance of the target element - * - * @return ElementInterface */ protected function createNewTargetElementInstance(): ElementInterface { @@ -568,7 +546,6 @@ protected function createNewTargetElementInstance(): ElementInterface * Add a new instance of the target element * * @param string $name - * @return ElementInterface * @throws Exception\DomainException */ protected function addNewTargetElementInstance($name): ElementInterface @@ -615,8 +592,6 @@ protected function createTemplateElement() /** * Replaces the default template object of a sub element with the corresponding * real entity so that all properties are preserved. - * - * @return void */ protected function replaceTemplateObjects(): void { diff --git a/src/Element/Color.php b/src/Element/Color.php index a60ddda8f..7ea598fc1 100644 --- a/src/Element/Color.php +++ b/src/Element/Color.php @@ -25,8 +25,6 @@ class Color extends Element implements InputProviderInterface /** * Get validator - * - * @return ValidatorInterface */ protected function getValidator(): ValidatorInterface { diff --git a/src/Element/Csrf.php b/src/Element/Csrf.php index 222d89c7c..ffd7e3433 100644 --- a/src/Element/Csrf.php +++ b/src/Element/Csrf.php @@ -65,8 +65,6 @@ public function setCsrfValidatorOptions(array $options) /** * Get CSRF validator - * - * @return CsrfValidator */ public function getCsrfValidator(): CsrfValidator { @@ -91,8 +89,6 @@ public function setCsrfValidator(CsrfValidator $validator) * Retrieve value * * Retrieves the hash from the validator - * - * @return string */ public function getValue(): string { diff --git a/src/Element/DateSelect.php b/src/Element/DateSelect.php index fd400a52a..b18108348 100644 --- a/src/Element/DateSelect.php +++ b/src/Element/DateSelect.php @@ -53,9 +53,6 @@ public function setOptions(iterable $options) return $this; } - /** - * @return Select - */ public function getDayElement(): Select { return $this->dayElement; @@ -123,10 +120,7 @@ public function setValue($value) return $this; } - /** - * @return String - */ - public function getValue(): String + public function getValue(): string { return sprintf( '%s-%s-%s', @@ -138,8 +132,6 @@ public function getValue(): String /** * Prepare the form element (mostly used for rendering purposes) - * - * @return void */ public function prepareElement(FormInterface $form): void { @@ -151,8 +143,6 @@ public function prepareElement(FormInterface $form): void /** * Get validator - * - * @return ValidatorInterface */ protected function getValidator(): ValidatorInterface { diff --git a/src/Element/DateTime.php b/src/Element/DateTime.php index 5ccb3f82c..2d84e45ed 100644 --- a/src/Element/DateTime.php +++ b/src/Element/DateTime.php @@ -95,8 +95,6 @@ public function setFormat($format) /** * Retrieve the DateTime format to use for the value - * - * @return string */ public function getFormat(): string { @@ -215,7 +213,6 @@ public function getInputSpecification(): array * Indicate whether or not a value represents a valid DateTime format. * * @param string $value - * @return bool */ private function valueIsValidDateTimeFormat($value): bool { diff --git a/src/Element/DateTimeSelect.php b/src/Element/DateTimeSelect.php index 884c0ac1f..fa824d7ea 100644 --- a/src/Element/DateTimeSelect.php +++ b/src/Element/DateTimeSelect.php @@ -92,25 +92,16 @@ public function setOptions(iterable $options) return $this; } - /** - * @return Select - */ public function getHourElement(): Select { return $this->hourElement; } - /** - * @return Select - */ public function getMinuteElement(): Select { return $this->minuteElement; } - /** - * @return Select - */ public function getSecondElement(): Select { return $this->secondElement; @@ -195,9 +186,6 @@ public function setShouldShowSeconds($shouldShowSeconds) return $this; } - /** - * @return bool - */ public function shouldShowSeconds(): bool { return $this->shouldShowSeconds; @@ -247,9 +235,6 @@ public function setValue($value) return $this; } - /** - * @return string - */ public function getValue(): string { return sprintf( @@ -265,8 +250,6 @@ public function getValue(): string /** * Prepare the form element (mostly used for rendering purposes) - * - * @return void */ public function prepareElement(FormInterface $form): void { @@ -280,8 +263,6 @@ public function prepareElement(FormInterface $form): void /** * Get validator - * - * @return ValidatorInterface */ protected function getValidator(): ValidatorInterface { diff --git a/src/Element/Email.php b/src/Element/Email.php index 8d55277ab..9997a078a 100644 --- a/src/Element/Email.php +++ b/src/Element/Email.php @@ -28,8 +28,6 @@ class Email extends Element implements InputProviderInterface /** * Get primary validator - * - * @return ValidatorInterface */ public function getValidator(): ValidatorInterface { @@ -78,8 +76,6 @@ public function setValidator(ValidatorInterface $validator) * browser validation, but you are free to set a different * (more strict) email validator such as Laminas\Validator\Email * if you wish. - * - * @return ValidatorInterface */ public function getEmailValidator(): ValidatorInterface { diff --git a/src/Element/File.php b/src/Element/File.php index 7c6c621c2..1f5662544 100644 --- a/src/Element/File.php +++ b/src/Element/File.php @@ -21,8 +21,6 @@ class File extends Element implements InputProviderInterface, ElementPrepareAwar /** * Prepare the form element (mostly used for rendering purposes) - * - * @return void */ public function prepareElement(FormInterface $form): void { diff --git a/src/Element/MonthSelect.php b/src/Element/MonthSelect.php index 3b6412e6c..541b4207f 100644 --- a/src/Element/MonthSelect.php +++ b/src/Element/MonthSelect.php @@ -122,17 +122,11 @@ public function setOptions(iterable $options) return $this; } - /** - * @return Select - */ public function getMonthElement(): Select { return $this->monthElement; } - /** - * @return Select - */ public function getYearElement(): Select { return $this->yearElement; @@ -202,9 +196,6 @@ public function setMinYear($minYear) return $this; } - /** - * @return int - */ public function getMinYear(): int { return $this->minYear; @@ -220,9 +211,6 @@ public function setMaxYear($maxYear) return $this; } - /** - * @return int - */ public function getMaxYear(): int { return $this->maxYear; @@ -238,9 +226,6 @@ public function setShouldCreateEmptyOption($createEmptyOption) return $this; } - /** - * @return bool - */ public function shouldCreateEmptyOption(): bool { return $this->createEmptyOption; @@ -256,9 +241,6 @@ public function setShouldRenderDelimiters($renderDelimiters) return $this; } - /** - * @return bool - */ public function shouldRenderDelimiters(): bool { return $this->renderDelimiters; @@ -282,9 +264,6 @@ public function setValue($value) return $this; } - /** - * @return string - */ public function getValue(): string { return sprintf( @@ -296,8 +275,6 @@ public function getValue(): string /** * Prepare the form element (mostly used for rendering purposes) - * - * @return void */ public function prepareElement(FormInterface $form): void { @@ -308,8 +285,6 @@ public function prepareElement(FormInterface $form): void /** * Get validator - * - * @return ValidatorInterface */ protected function getValidator(): ValidatorInterface { diff --git a/src/Element/MultiCheckbox.php b/src/Element/MultiCheckbox.php index a733ddd26..a47502c73 100644 --- a/src/Element/MultiCheckbox.php +++ b/src/Element/MultiCheckbox.php @@ -131,8 +131,6 @@ public function setDisableInArrayValidator($disableOption) /** * Get the disable in array validator flag. - * - * @return bool */ public function disableInArrayValidator(): bool { @@ -141,8 +139,6 @@ public function disableInArrayValidator(): bool /** * Get validator - * - * @return ValidatorInterface */ protected function getValidator(): ?ValidatorInterface { diff --git a/src/Element/Password.php b/src/Element/Password.php index 6fe0934d5..6a87c8779 100644 --- a/src/Element/Password.php +++ b/src/Element/Password.php @@ -19,8 +19,6 @@ class Password extends Element implements ElementPrepareAwareInterface /** * Remove the password before rendering if the form fails in order to avoid any security issue - * - * @return void */ public function prepareElement(FormInterface $form): void { diff --git a/src/Element/Select.php b/src/Element/Select.php index f20a25f87..8c8180c10 100644 --- a/src/Element/Select.php +++ b/src/Element/Select.php @@ -166,8 +166,6 @@ public function setDisableInArrayValidator($disableOption) /** * Get the disable in array validator flag. - * - * @return bool */ public function disableInArrayValidator(): bool { @@ -188,8 +186,6 @@ public function setEmptyOption($emptyOption) /** * Return the string for the empty option (null if none) - * - * @return string|null */ public function getEmptyOption(): ?string { @@ -198,8 +194,6 @@ public function getEmptyOption(): ?string /** * Get validator - * - * @return ValidatorInterface */ protected function getValidator(): ?ValidatorInterface { @@ -235,8 +229,6 @@ public function setUseHiddenElement($useHiddenElement) /** * Do we render hidden element? - * - * @return bool */ public function useHiddenElement(): bool { @@ -257,8 +249,6 @@ public function setUnselectedValue($unselectedValue) /** * Get the value when the select is not selected - * - * @return string */ public function getUnselectedValue(): string { @@ -340,8 +330,6 @@ protected function getOptionValue($key, $optionSpec) /** * Element has the multiple attribute - * - * @return bool */ public function isMultiple(): bool { diff --git a/src/Element/Tel.php b/src/Element/Tel.php index 1e9b2c68d..0b755045c 100644 --- a/src/Element/Tel.php +++ b/src/Element/Tel.php @@ -25,8 +25,6 @@ class Tel extends Element implements InputProviderInterface /** * Get validator - * - * @return ValidatorInterface */ protected function getValidator(): ValidatorInterface { diff --git a/src/Element/Url.php b/src/Element/Url.php index 10a17dc5d..b195e1eba 100644 --- a/src/Element/Url.php +++ b/src/Element/Url.php @@ -24,8 +24,6 @@ class Url extends Element implements InputProviderInterface /** * Get validator - * - * @return ValidatorInterface */ public function getValidator(): ValidatorInterface { diff --git a/src/ElementFactory.php b/src/ElementFactory.php index f2a552b16..05fbe4539 100644 --- a/src/ElementFactory.php +++ b/src/ElementFactory.php @@ -19,7 +19,6 @@ final class ElementFactory implements FactoryInterface * * @param string $requestedName * @param null|array $options - * @return object */ public function __invoke(ContainerInterface $container, $requestedName, ?array $options = null): object { diff --git a/src/ElementInterface.php b/src/ElementInterface.php index cc9b77077..5ff264712 100644 --- a/src/ElementInterface.php +++ b/src/ElementInterface.php @@ -17,8 +17,6 @@ public function setName($name); /** * Retrieve the element name - * - * @return null|string */ public function getName(): ?string; @@ -74,7 +72,6 @@ public function getAttribute($key); * Return true if a specific attribute is set * * @param string $key - * @return bool */ public function hasAttribute($key): bool; @@ -117,8 +114,6 @@ public function setLabel($label); /** * Retrieve the label (if any) used for this element - * - * @return null|string */ public function getLabel(): ?string; diff --git a/src/Factory.php b/src/Factory.php index 6aec6e208..e60a1580b 100644 --- a/src/Factory.php +++ b/src/Factory.php @@ -58,8 +58,6 @@ public function setInputFilterFactory(InputFilterFactory $inputFilterFactory) * Get current input filter factory * * If none provided, uses an unconfigured instance. - * - * @return InputFilterFactory */ public function getInputFilterFactory(): InputFilterFactory { @@ -82,8 +80,6 @@ public function setFormElementManager(FormElementManager $formElementManager) /** * Get form element manager - * - * @return FormElementManager */ public function getFormElementManager(): FormElementManager { @@ -102,7 +98,6 @@ public function getFormElementManager(): FormElementManager * represents simply an element. * * @param array|Traversable|ArrayAccess $spec - * @return ElementInterface * @throws Exception\DomainException */ public function create($spec): ElementInterface @@ -138,7 +133,6 @@ public function create($spec): ElementInterface * Create an element * * @param array $spec - * @return ElementInterface */ public function createElement($spec): ElementInterface { @@ -153,7 +147,6 @@ public function createElement($spec): ElementInterface * Create a fieldset * * @param array $spec - * @return FieldsetInterface */ public function createFieldset($spec): FieldsetInterface { @@ -168,7 +161,6 @@ public function createFieldset($spec): FieldsetInterface * Create a form * * @param array $spec - * @return FormInterface */ public function createForm($spec): FormInterface { @@ -189,7 +181,6 @@ public function createForm($spec): FormInterface * - attributes: an array or Traversable object of element attributes to assign * * @param array|Traversable|ArrayAccess $spec - * @return ElementInterface * @throws Exception\DomainException */ public function configureElement(ElementInterface $element, $spec): ElementInterface @@ -230,7 +221,6 @@ public function configureElement(ElementInterface $element, $spec): ElementInter * - spec: the actual element specification, per {@link configureElement()} * * @param array|Traversable|ArrayAccess $spec - * @return FieldsetInterface * @throws Exception\DomainException */ public function configureFieldset(FieldsetInterface $fieldset, $spec): FieldsetInterface @@ -271,7 +261,6 @@ public function configureFieldset(FieldsetInterface $fieldset, $spec): FieldsetI * - hydrator: hydrator instance or named hydrator class * * @param array|Traversable|ArrayAccess $spec - * @return FormInterface */ public function configureForm(FormInterface $form, $spec): FormInterface { @@ -326,7 +315,6 @@ protected function validateSpecification($spec, $method) * * @param array|Traversable|ArrayAccess $elements * @param string $method Method invoking this one (for exception messages) - * @return void */ protected function prepareAndInjectElements($elements, FieldsetInterface $fieldset, $method): void { @@ -354,7 +342,6 @@ protected function prepareAndInjectElements($elements, FieldsetInterface $fields * * @param array|Traversable|ArrayAccess $fieldsets * @param string $method Method invoking this one (for exception messages) - * @return void */ public function prepareAndInjectFieldsets($fieldsets, FieldsetInterface $masterFieldset, $method): void { @@ -378,7 +365,6 @@ public function prepareAndInjectFieldsets($fieldsets, FieldsetInterface $masterF * @param string $objectName * @param string $method * @throws Exception\DomainException - * @return void */ protected function prepareAndInjectObject($objectName, FieldsetInterface $fieldset, $method): void { @@ -409,7 +395,6 @@ protected function prepareAndInjectObject($objectName, FieldsetInterface $fields * * @param string|array|Hydrator\HydratorInterface $hydratorOrName * @param string $method - * @return void * @throws Exception\DomainException If $hydratorOrName is not a string, does not resolve to a known class, or * the class does not implement Hydrator\HydratorInterface. */ @@ -460,7 +445,6 @@ protected function prepareAndInjectHydrator($hydratorOrName, FieldsetInterface $ * * @param string|array|Factory $factoryOrName * @param string $method - * @return void * @throws Exception\DomainException If $factoryOrName is not a string, does not resolve to a known class, or * the class does not extend Form\Factory. */ @@ -503,7 +487,6 @@ protected function prepareAndInjectFactory($factoryOrName, FieldsetInterface $fi * * @param string|array|Traversable $spec * @param string $method - * @return void * @throws Exception\DomainException For unknown InputFilter class or invalid InputFilter instance. */ protected function prepareAndInjectInputFilter($spec, FormInterface $form, $method): void @@ -548,7 +531,6 @@ protected function prepareAndInjectInputFilter($spec, FormInterface $form, $meth * * @param string|array|Traversable $spec * @param string $method - * @return void * @throws Exception\DomainException If validation group given is not an array. */ protected function prepareAndInjectValidationGroup($spec, FormInterface $form, $method): void diff --git a/src/Fieldset.php b/src/Fieldset.php index f7e9d8691..33608ce7c 100644 --- a/src/Fieldset.php +++ b/src/Fieldset.php @@ -114,8 +114,6 @@ public function setFormFactory(Factory $formFactory) * Retrieve composed form factory * * Lazy-loads one if none present. - * - * @return Factory */ public function getFormFactory(): Factory { @@ -194,7 +192,6 @@ public function add($elementOrFieldset, array $flags = []) * Does the fieldset have an element/fieldset by the given name? * * @param string $elementOrFieldset - * @return bool */ public function has($elementOrFieldset): bool { @@ -205,6 +202,7 @@ public function has($elementOrFieldset): bool * Retrieve a named element or fieldset * * @param string $elementOrFieldset + * @return FieldsetInterface|ElementInterface */ public function get($elementOrFieldset): ElementInterface { @@ -336,8 +334,6 @@ public function getMessages($elementName = null): array /** * Ensures state is ready for use. Here, we append the name of the fieldsets to every elements in order to avoid * name clashes if the same fieldset is used multiple times - * - * @return void */ public function prepareElement(FormInterface $form): void { @@ -357,7 +353,6 @@ public function prepareElement(FormInterface $form): void * Recursively populate values of attached elements and fieldsets * * @param iterable $data - * @return void * @throws Exception\InvalidArgumentException */ public function populateValues(iterable $data): void @@ -396,8 +391,6 @@ public function populateValues(iterable $data): void /** * Countable: return count of attached elements/fieldsets - * - * @return int */ public function count(): int { @@ -406,8 +399,6 @@ public function count(): int /** * IteratorAggregate: return internal iterator - * - * @return PriorityList */ public function getIterator(): PriorityList { @@ -457,8 +448,6 @@ public function setAllowedObjectBindingClass($allowObjectBindingClass): void /** * Get The class or interface of objects that can be bound to this fieldset. - * - * @return string */ public function allowedObjectBindingClass(): ?string { @@ -469,7 +458,6 @@ public function allowedObjectBindingClass(): ?string * Checks if the object can be set in this fieldset * * @param object $object - * @return bool */ public function allowObjectBinding($object): bool { @@ -502,8 +490,6 @@ public function setHydrator(HydratorInterface $hydrator) * hydrator will be retrieved from the object. * * Will lazy-load Hydrator\ArraySerializable if none is present. - * - * @return HydratorInterface */ public function getHydrator(): HydratorInterface { @@ -523,8 +509,6 @@ class_exists(Hydrator\ArraySerializableHydrator::class) /** * Checks if this fieldset can bind data - * - * @return bool */ public function allowValueBinding(): bool { @@ -595,8 +579,6 @@ public function setUseAsBaseFieldset($useAsBaseFieldset) /** * Is this fieldset use as a base fieldset for a form ? - * - * @return bool */ public function useAsBaseFieldset(): bool { @@ -614,12 +596,7 @@ protected function extract(): array return []; } - $hydrator = $this->getHydrator(); - if (! $hydrator instanceof Hydrator\HydratorInterface) { - return []; - } - - $values = $hydrator->extract($this->object); + $values = $this->getHydrator()->extract($this->object); // Recursively extract and populate values for nested fieldsets foreach ($this->fieldsets as $fieldset) { diff --git a/src/FieldsetInterface.php b/src/FieldsetInterface.php index d4fe26616..bb243ccc6 100644 --- a/src/FieldsetInterface.php +++ b/src/FieldsetInterface.php @@ -33,7 +33,6 @@ public function add($elementOrFieldset, array $flags = []); * Does the fieldset have an element/fieldset by the given name? * * @param string $elementOrFieldset - * @return bool */ public function has($elementOrFieldset): bool; @@ -41,7 +40,6 @@ public function has($elementOrFieldset): bool; * Retrieve a named element or fieldset * * @param string $elementOrFieldset - * @return ElementInterface */ public function get($elementOrFieldset): ElementInterface; @@ -82,8 +80,6 @@ public function getFieldsets(): array; /** * Recursively populate value attributes of elements - * - * @return void */ public function populateValues(iterable $data): void; @@ -106,7 +102,6 @@ public function getObject(); * Checks if the object can be set in this fieldset * * @param object $object - * @return bool */ public function allowObjectBinding($object): bool; @@ -119,8 +114,6 @@ public function setHydrator(HydratorInterface $hydrator); /** * Get the hydrator used when binding an object to the element - * - * @return null|HydratorInterface */ public function getHydrator(): ?HydratorInterface; @@ -134,8 +127,6 @@ public function bindValues(array $values = []); /** * Checks if this fieldset can bind data - * - * @return bool */ public function allowValueBinding(): bool; } diff --git a/src/Form.php b/src/Form.php index 9ee58198a..62ec93b03 100644 --- a/src/Form.php +++ b/src/Form.php @@ -3,7 +3,6 @@ namespace Laminas\Form; use ArrayAccess; -use ArrayObject; use Laminas\Form\Element\Collection; use Laminas\Hydrator\HydratorInterface; use Laminas\InputFilter\CollectionInputFilter; @@ -229,8 +228,6 @@ public function prepare() /** * Ensures state is ready for use. Here, we append the name of the fieldsets to every elements in order to avoid * name clashes if the same fieldset is used multiple times - * - * @return void */ public function prepareElement(FormInterface $form): void { @@ -330,7 +327,6 @@ public function setHydrator(HydratorInterface $hydrator) * Bind values to the bound object * * @param array $values - * @return void */ public function bindValues(array $values = [], ?array $validationGroup = null): void { @@ -424,8 +420,6 @@ public function setBindOnValidate($bindOnValidateFlag) /** * Will we bind values to the bound object on successful validation? - * - * @return bool */ public function bindOnValidate(): bool { @@ -446,8 +440,6 @@ public function setBaseFieldset(FieldsetInterface $baseFieldset) /** * Get the base fieldset to use when hydrating - * - * @return FieldsetInterface */ public function getBaseFieldset(): FieldsetInterface { @@ -456,8 +448,6 @@ public function getBaseFieldset(): FieldsetInterface /** * Check if the form has been validated - * - * @return bool */ public function hasValidated(): bool { @@ -469,7 +459,6 @@ public function hasValidated(): bool * * Typically, will proxy to the composed input filter. * - * @return bool * @throws Exception\DomainException */ public function isValid(): bool @@ -490,23 +479,10 @@ public function isValid(): bool if (! is_array($this->data)) { $data = $this->extract(); $this->populateValues($data, true); - if (! is_array($data)) { - throw new Exception\DomainException(sprintf( - '%s is unable to validate as there is no data currently set', - __METHOD__ - )); - } $this->data = $data; } $filter = $this->getInputFilter(); - if (! $filter instanceof InputFilterInterface) { - throw new Exception\DomainException(sprintf( - '%s is unable to validate as there is no input filter present', - __METHOD__ - )); - } - $filter->setData($this->data); $filter->setValidationGroup(InputFilterInterface::VALIDATE_ALL); @@ -672,8 +648,6 @@ public function setInputFilter(InputFilterInterface $inputFilter) /** * Retrieve input filter used by this form - * - * @return InputFilterInterface */ public function getInputFilter(): InputFilterInterface { @@ -722,8 +696,6 @@ public function setUseInputFilterDefaults($useInputFilterDefaults) /** * Should we use input filter defaults from elements and fieldsets? - * - * @return bool */ public function useInputFilterDefaults(): bool { @@ -745,8 +717,6 @@ public function setPreferFormInputFilter($preferFormInputFilter) /** * Should we use form input filter over element input filter defaults from elements and fieldsets? - * - * @return bool */ public function getPreferFormInputFilter(): bool { @@ -757,7 +727,6 @@ public function getPreferFormInputFilter(): bool * Attach defaults provided by the elements to the input filter * * @param FieldsetInterface $fieldset Fieldset to traverse when looking for default inputs - * @return void */ public function attachInputFilterDefaults(InputFilterInterface $inputFilter, FieldsetInterface $fieldset): void { @@ -904,8 +873,6 @@ public function attachInputFilterDefaults(InputFilterInterface $inputFilter, Fie /** * Add inputs to CollectionInputFilter - * - * @return CollectionInputFilter */ private function addInputsToCollectionInputFilter(CollectionInputFilter $inputFilter): CollectionInputFilter { @@ -932,8 +899,6 @@ public function setWrapElements($wrapElements) /** * If true, form elements/fieldsets name's are wrapped around the form name itself - * - * @return bool */ public function wrapElements(): bool { diff --git a/src/FormAbstractServiceFactory.php b/src/FormAbstractServiceFactory.php index 1cdb32924..4f243ee7a 100644 --- a/src/FormAbstractServiceFactory.php +++ b/src/FormAbstractServiceFactory.php @@ -26,7 +26,6 @@ class FormAbstractServiceFactory implements AbstractFactoryInterface * * @param string $requestedName * @param array|null $options - * @return FormInterface */ public function __invoke(ContainerInterface $container, $requestedName, ?array $options = null): FormInterface { @@ -42,7 +41,6 @@ public function __invoke(ContainerInterface $container, $requestedName, ?array $ * Can we create the requested service? (v3) * * @param string $requestedName - * @return bool */ public function canCreate(ContainerInterface $container, $requestedName): bool { @@ -95,7 +93,6 @@ protected function getConfig(ContainerInterface $container): array * Retrieve the form factory, creating it if necessary * * @param ContainerInterface $services - * @return Factory */ protected function getFormFactory(ContainerInterface $container): Factory { @@ -122,7 +119,6 @@ protected function getFormFactory(ContainerInterface $container): Factory * attaches the FilterManager and ValidatorManager to it. * * @param array $config - * @return void */ protected function marshalInputFilter(array &$config, ContainerInterface $container, Factory $formFactory): void { diff --git a/src/FormElementManager.php b/src/FormElementManager.php index 30d98db53..c14ef5895 100644 --- a/src/FormElementManager.php +++ b/src/FormElementManager.php @@ -307,7 +307,6 @@ class FormElementManager extends AbstractPluginManager * Inject the factory to any element that implements FormFactoryAwareInterface * * @param mixed $instance Instance to inspect and optionally inject. - * @return void */ public function injectFactory(ContainerInterface $container, $instance): void { @@ -346,7 +345,6 @@ public function callElementInit(ContainerInterface $container, $instance): void * * @param string $name * @param null|string $class - * @return void */ public function setInvokableClass($name, $class = null): void { @@ -369,7 +367,6 @@ public function setInvokableClass($name, $class = null): void * Validates against `$instanceOf`. * * @param mixed $instance - * @return void * @throws InvalidServiceException */ public function validate($instance): void diff --git a/src/FormInterface.php b/src/FormInterface.php index e19a88f14..3acf64a99 100644 --- a/src/FormInterface.php +++ b/src/FormInterface.php @@ -52,8 +52,6 @@ public function setInputFilter(InputFilterInterface $inputFilter); /** * Retrieve input filter - * - * @return InputFilterInterface */ public function getInputFilter(): InputFilterInterface; @@ -61,8 +59,6 @@ public function getInputFilter(): InputFilterInterface; * Validate the form * * Typically, will proxy to the composed input filter. - * - * @return bool */ public function isValid(): bool; diff --git a/src/LabelAwareInterface.php b/src/LabelAwareInterface.php index c79cdbffd..1e7826fe6 100644 --- a/src/LabelAwareInterface.php +++ b/src/LabelAwareInterface.php @@ -14,8 +14,6 @@ public function setLabel($label); /** * Retrieve the label (if any) used for this element - * - * @return null|string */ public function getLabel(): ?string; @@ -79,7 +77,6 @@ public function removeLabelOption($key); * Does the element has a specific label option ? * * @param string $key - * @return bool */ public function hasLabelOption($key): bool; diff --git a/src/LabelAwareTrait.php b/src/LabelAwareTrait.php index 625011f78..0d31d64a0 100644 --- a/src/LabelAwareTrait.php +++ b/src/LabelAwareTrait.php @@ -137,7 +137,6 @@ public function removeLabelOption($key) * Does the element has a specific label option ? * * @param string $key - * @return bool */ public function hasLabelOption($key): bool { diff --git a/src/View/Helper/AbstractHelper.php b/src/View/Helper/AbstractHelper.php index 77f9cbd32..863f2e479 100644 --- a/src/View/Helper/AbstractHelper.php +++ b/src/View/Helper/AbstractHelper.php @@ -199,8 +199,6 @@ public function setDoctype($doctype) /** * Get value for doctype - * - * @return string */ public function getDoctype(): string { @@ -222,8 +220,6 @@ public function setEncoding($encoding) /** * Get character encoding - * - * @return string */ public function getEncoding(): string { @@ -236,7 +232,6 @@ public function getEncoding(): string * Escapes all attribute values * * @param array $attributes - * @return string */ public function createAttributesString(array $attributes): string { @@ -282,8 +277,6 @@ public function createAttributesString(array $attributes): string * * If no ID attribute present, attempts to use the name attribute. * If no name attribute is present, either, returns null. - * - * @return null|string */ public function getId(ElementInterface $element): ?string { @@ -299,8 +292,6 @@ public function getId(ElementInterface $element): ?string * Get the closing bracket for an inline tag * * Closes as either "/>" for XHTML doctypes or ">" otherwise. - * - * @return string */ public function getInlineClosingBracket(): string { @@ -313,8 +304,6 @@ public function getInlineClosingBracket(): string /** * Retrieve the doctype helper - * - * @return Doctype */ protected function getDoctypeHelper(): Doctype { @@ -335,8 +324,6 @@ protected function getDoctypeHelper(): Doctype /** * Retrieve the escapeHtml helper - * - * @return EscapeHtml */ protected function getEscapeHtmlHelper(): EscapeHtml { @@ -357,8 +344,6 @@ protected function getEscapeHtmlHelper(): EscapeHtml /** * Retrieve the escapeHtmlAttr helper - * - * @return EscapeHtmlAttr */ protected function getEscapeHtmlAttrHelper(): EscapeHtmlAttr { @@ -424,7 +409,6 @@ protected function prepareAttributes(array $attributes): array * * @param string $attribute * @param mixed $value - * @return string */ protected function prepareBooleanAttributeValue($attribute, $value): string { @@ -558,7 +542,6 @@ public static function addDefaultTranslatableAttributePrefix($prefix): void * Description of valid attributes * * @param string $attribute - * @return bool */ protected function isValidAttributeName($attribute): bool { @@ -569,7 +552,6 @@ protected function isValidAttributeName($attribute): bool * Whether the passed attribute has a valid prefix or not * * @param string $attribute - * @return bool */ protected function hasAllowedPrefix($attribute): bool { diff --git a/src/View/Helper/Captcha/AbstractWord.php b/src/View/Helper/Captcha/AbstractWord.php index 7ab3333b2..f4e7d6ca2 100644 --- a/src/View/Helper/Captcha/AbstractWord.php +++ b/src/View/Helper/Captcha/AbstractWord.php @@ -60,7 +60,6 @@ public function __invoke(?ElementInterface $element = null) * More specific renderers will consume this and render it. * * @throws Exception\DomainException - * @return string */ protected function renderCaptchaInputs(ElementInterface $element): string { @@ -75,7 +74,7 @@ protected function renderCaptchaInputs(ElementInterface $element): string assert($element instanceof Captcha); $captcha = $element->getCaptcha(); - if ($captcha === null || ! $captcha instanceof CaptchaAdapter) { + if ($captcha === null) { throw new Exception\DomainException(sprintf( '%s requires that the element has a "captcha" attribute implementing Laminas\Captcha\AdapterInterface; ' . 'none found', @@ -94,7 +93,6 @@ protected function renderCaptchaInputs(ElementInterface $element): string * Render the hidden input with the captcha identifier * * @param array $attributes - * @return string */ protected function renderCaptchaHidden(CaptchaAdapter $captcha, array $attributes): string { @@ -124,7 +122,6 @@ protected function renderCaptchaHidden(CaptchaAdapter $captcha, array $attribute * Render the input for capturing the captcha value from the client * * @param array $attributes - * @return string */ protected function renderCaptchaInput(CaptchaAdapter $captcha, array $attributes): string { @@ -167,8 +164,6 @@ public function setCaptchaPosition($captchaPosition) /** * Get position of captcha - * - * @return string */ public function getCaptchaPosition(): string { @@ -189,8 +184,6 @@ public function setSeparator($separator) /** * Get separator for captcha and inputs - * - * @return string */ public function getSeparator(): string { diff --git a/src/View/Helper/Captcha/Dumb.php b/src/View/Helper/Captcha/Dumb.php index a7526d376..32427a41e 100644 --- a/src/View/Helper/Captcha/Dumb.php +++ b/src/View/Helper/Captcha/Dumb.php @@ -17,7 +17,6 @@ class Dumb extends AbstractWord * Render the captcha * * @throws Exception\DomainException - * @return string */ public function render(ElementInterface $element): string { diff --git a/src/View/Helper/Captcha/Figlet.php b/src/View/Helper/Captcha/Figlet.php index b35975005..428fe94cf 100644 --- a/src/View/Helper/Captcha/Figlet.php +++ b/src/View/Helper/Captcha/Figlet.php @@ -16,7 +16,6 @@ class Figlet extends AbstractWord * Render the captcha * * @throws Exception\DomainException - * @return string */ public function render(ElementInterface $element): string { diff --git a/src/View/Helper/Captcha/Image.php b/src/View/Helper/Captcha/Image.php index 0ba4da8a2..1667c42c6 100644 --- a/src/View/Helper/Captcha/Image.php +++ b/src/View/Helper/Captcha/Image.php @@ -16,7 +16,6 @@ class Image extends AbstractWord * Render the captcha * * @throws Exception\DomainException - * @return string */ public function render(ElementInterface $element): string { diff --git a/src/View/Helper/Captcha/ReCaptcha.php b/src/View/Helper/Captcha/ReCaptcha.php index 70c8c0d87..e137af2c7 100644 --- a/src/View/Helper/Captcha/ReCaptcha.php +++ b/src/View/Helper/Captcha/ReCaptcha.php @@ -33,7 +33,6 @@ public function __invoke(?ElementInterface $element = null) * Render ReCaptcha form elements * * @throws Exception\DomainException - * @return string */ public function render(ElementInterface $element): string { @@ -67,7 +66,6 @@ public function render(ElementInterface $element): string * @param string $challengeId @deprecated * @param string $responseName @deprecated * @param string $responseId @deprecated - * @return string */ protected function renderHiddenInput($name, $challengeId = '', $responseName = '', $responseId = ''): string { @@ -92,7 +90,6 @@ protected function renderHiddenInput($name, $challengeId = '', $responseName = ' * * @param string $challengeId * @param string $responseId - * @return string */ protected function renderJsEvents($challengeId, $responseId): string { diff --git a/src/View/Helper/File/FormFileSessionProgress.php b/src/View/Helper/File/FormFileSessionProgress.php index 67571cd27..f09eb2a0c 100644 --- a/src/View/Helper/File/FormFileSessionProgress.php +++ b/src/View/Helper/File/FormFileSessionProgress.php @@ -10,9 +10,6 @@ */ class FormFileSessionProgress extends FormFileUploadProgress { - /** - * @return string - */ protected function getName(): string { return ini_get('session.upload_progress.name'); diff --git a/src/View/Helper/File/FormFileUploadProgress.php b/src/View/Helper/File/FormFileUploadProgress.php index fc2bb49c8..3c5d2c949 100644 --- a/src/View/Helper/File/FormFileUploadProgress.php +++ b/src/View/Helper/File/FormFileUploadProgress.php @@ -18,8 +18,6 @@ class FormFileUploadProgress extends FormInput * Invoke helper as functor * * Proxies to {@link render()}. - * - * @return string */ public function __invoke(?ElementInterface $element = null): string { @@ -28,8 +26,6 @@ public function __invoke(?ElementInterface $element = null): string /** * Render a hidden form element with the progress id - * - * @return string */ public function renderHiddenId(): string { @@ -47,17 +43,11 @@ public function renderHiddenId(): string ); } - /** - * @return string - */ protected function getName(): string { return 'UPLOAD_IDENTIFIER'; } - /** - * @return string - */ protected function getValue(): string { return uniqid(); diff --git a/src/View/Helper/Form.php b/src/View/Helper/Form.php index 9fb7f3253..f3c4c040a 100644 --- a/src/View/Helper/Form.php +++ b/src/View/Helper/Form.php @@ -50,8 +50,6 @@ public function __invoke(?FormInterface $form = null) /** * Render a form from the provided $form, - * - * @return string */ public function render(FormInterface $form): string { @@ -76,8 +74,6 @@ public function render(FormInterface $form): string /** * Generate an opening form tag - * - * @return string */ public function openTag(?FormInterface $form = null): string { @@ -108,8 +104,6 @@ public function openTag(?FormInterface $form = null): string /** * Generate a closing form tag - * - * @return string */ public function closeTag(): string { diff --git a/src/View/Helper/FormButton.php b/src/View/Helper/FormButton.php index d5659717c..08782c681 100644 --- a/src/View/Helper/FormButton.php +++ b/src/View/Helper/FormButton.php @@ -68,7 +68,6 @@ public function __invoke(?ElementInterface $element = null, $buttonContent = nul * * @param null|string $buttonContent * @throws Exception\DomainException - * @return string */ public function render(ElementInterface $element, $buttonContent = null): string { @@ -108,7 +107,6 @@ public function render(ElementInterface $element, $buttonContent = null): string * @param null|array|ElementInterface $attributesOrElement * @throws Exception\InvalidArgumentException * @throws Exception\DomainException - * @return string */ public function openTag($attributesOrElement = null): string { @@ -151,8 +149,6 @@ public function openTag($attributesOrElement = null): string /** * Return a closing button tag - * - * @return string */ public function closeTag(): string { @@ -161,8 +157,6 @@ public function closeTag(): string /** * Determine button type to use - * - * @return string */ protected function getType(ElementInterface $element): string { diff --git a/src/View/Helper/FormCaptcha.php b/src/View/Helper/FormCaptcha.php index e20f58525..e74cc7141 100644 --- a/src/View/Helper/FormCaptcha.php +++ b/src/View/Helper/FormCaptcha.php @@ -2,7 +2,6 @@ namespace Laminas\Form\View\Helper; -use Laminas\Captcha\AdapterInterface as CaptchaAdapter; use Laminas\Form\Element\Captcha; use Laminas\Form\Exception; @@ -32,13 +31,12 @@ public function __invoke(?Captcha $element = null) * * @throws Exception\DomainException If the element does not compose a captcha, or the renderer does * not implement plugin(). - * @return string */ public function render(Captcha $element): string { $captcha = $element->getCaptcha(); - if ($captcha === null || ! $captcha instanceof CaptchaAdapter) { + if ($captcha === null) { throw new Exception\DomainException(sprintf( '%s requires that the element has a "captcha" attribute implementing Laminas\Captcha\AdapterInterface; ' . 'none found', diff --git a/src/View/Helper/FormCheckbox.php b/src/View/Helper/FormCheckbox.php index d95e3a623..52da5b786 100644 --- a/src/View/Helper/FormCheckbox.php +++ b/src/View/Helper/FormCheckbox.php @@ -15,7 +15,6 @@ class FormCheckbox extends FormInput * * @throws Exception\InvalidArgumentException * @throws Exception\DomainException - * @return string */ public function render(ElementInterface $element): string { @@ -69,8 +68,6 @@ public function render(ElementInterface $element): string /** * Return input type - * - * @return string */ protected function getInputType(): string { diff --git a/src/View/Helper/FormCollection.php b/src/View/Helper/FormCollection.php index 048fb833a..bfd09f088 100644 --- a/src/View/Helper/FormCollection.php +++ b/src/View/Helper/FormCollection.php @@ -86,8 +86,6 @@ public function __invoke(?ElementInterface $element = null, $wrap = true) /** * Render a collection by iterating through all fieldsets and elements - * - * @return string */ public function render(ElementInterface $element): string { @@ -160,16 +158,13 @@ public function render(ElementInterface $element): string /** * Only render a template - * - * @return string */ public function renderTemplate(CollectionElement $collection): string { $elementHelper = $this->getElementHelper(); assert(is_callable($elementHelper)); $escapeHtmlAttribHelper = $this->getEscapeHtmlAttrHelper(); - assert(is_callable($escapeHtmlAttribHelper)); - $fieldsetHelper = $this->getFieldsetHelper(); + $fieldsetHelper = $this->getFieldsetHelper(); assert(is_callable($fieldsetHelper)); $templateMarkup = ''; @@ -202,8 +197,6 @@ public function setShouldWrap($wrap) /** * Get wrapped - * - * @return bool */ public function shouldWrap(): bool { @@ -224,8 +217,6 @@ public function setDefaultElementHelper($defaultSubHelper) /** * Gets the name of the view helper that should be used to render sub elements. - * - * @return string */ public function getDefaultElementHelper(): string { @@ -247,7 +238,7 @@ public function setElementHelper(HelperInterface $elementHelper) /** * Retrieve the element helper. * - * @return HelperInterface + * @return FormRow * @throws RuntimeException */ protected function getElementHelper(): HelperInterface @@ -298,8 +289,6 @@ protected function getFieldsetHelper(): HelperInterface /** * Get the wrapper for the collection - * - * @return string */ public function getWrapper(): string { @@ -347,8 +336,6 @@ public function setLabelWrapper($labelWrapper) /** * Get the wrapper for the label - * - * @return string */ public function getLabelWrapper(): string { @@ -357,8 +344,6 @@ public function getLabelWrapper(): string /** * Ge the wrapper for the template - * - * @return string */ public function getTemplateWrapper(): string { diff --git a/src/View/Helper/FormColor.php b/src/View/Helper/FormColor.php index 4413ea0a0..01ea585e4 100644 --- a/src/View/Helper/FormColor.php +++ b/src/View/Helper/FormColor.php @@ -24,8 +24,6 @@ class FormColor extends FormInput /** * Determine input type to use - * - * @return string */ protected function getType(ElementInterface $element): string { diff --git a/src/View/Helper/FormDateSelect.php b/src/View/Helper/FormDateSelect.php index 8a541911b..80e45993f 100644 --- a/src/View/Helper/FormDateSelect.php +++ b/src/View/Helper/FormDateSelect.php @@ -19,7 +19,6 @@ class FormDateSelect extends FormMonthSelectHelper * * @throws Exception\InvalidArgumentException * @throws Exception\DomainException - * @return string */ public function render(ElementInterface $element): string { diff --git a/src/View/Helper/FormDateTime.php b/src/View/Helper/FormDateTime.php index dc3451980..aaacfed91 100644 --- a/src/View/Helper/FormDateTime.php +++ b/src/View/Helper/FormDateTime.php @@ -29,8 +29,6 @@ class FormDateTime extends FormInput /** * Determine input type to use - * - * @return string */ protected function getType(ElementInterface $element): string { diff --git a/src/View/Helper/FormDateTimeLocal.php b/src/View/Helper/FormDateTimeLocal.php index aca9bcd03..1b282f3fd 100644 --- a/src/View/Helper/FormDateTimeLocal.php +++ b/src/View/Helper/FormDateTimeLocal.php @@ -8,8 +8,6 @@ class FormDateTimeLocal extends FormDateTime { /** * Determine input type to use - * - * @return string */ protected function getType(ElementInterface $element): string { diff --git a/src/View/Helper/FormDateTimeSelect.php b/src/View/Helper/FormDateTimeSelect.php index add1412b0..b8c3f86fa 100644 --- a/src/View/Helper/FormDateTimeSelect.php +++ b/src/View/Helper/FormDateTimeSelect.php @@ -74,7 +74,6 @@ public function __invoke( /** * Render a date element that is composed of six selects * - * @return string * @throws Exception\InvalidArgumentException * @throws Exception\DomainException */ @@ -167,9 +166,6 @@ public function setTimeType($timeType) return $this; } - /** - * @return int - */ public function getTimeType(): int { return $this->timeType; @@ -177,8 +173,6 @@ public function getTimeType(): int /** * Override to also get time part - * - * @return string */ public function getPattern(): string { diff --git a/src/View/Helper/FormElement.php b/src/View/Helper/FormElement.php index e2b0d8735..fb8b44d49 100644 --- a/src/View/Helper/FormElement.php +++ b/src/View/Helper/FormElement.php @@ -91,8 +91,6 @@ public function __invoke(?ElementInterface $element = null) * * Introspects the element type and attributes to determine which * helper to utilize when rendering. - * - * @return string */ public function render(ElementInterface $element): string { @@ -162,7 +160,6 @@ public function addClass($class, $plugin) * Render element by helper name * * @param string $name - * @return string */ protected function renderHelper($name, ElementInterface $element): string { @@ -175,8 +172,6 @@ protected function renderHelper($name, ElementInterface $element): string /** * Render element by instance map - * - * @return string|null */ protected function renderInstance(ElementInterface $element): ?string { @@ -191,8 +186,6 @@ protected function renderInstance(ElementInterface $element): ?string /** * Render element by type map - * - * @return string|null */ protected function renderType(ElementInterface $element): ?string { diff --git a/src/View/Helper/FormElementErrors.php b/src/View/Helper/FormElementErrors.php index be3f37626..ef10a4ef1 100644 --- a/src/View/Helper/FormElementErrors.php +++ b/src/View/Helper/FormElementErrors.php @@ -51,7 +51,6 @@ public function __invoke(?ElementInterface $element = null, array $attributes = * * @param array $attributes * @throws Exception\DomainException - * @return string */ public function render(ElementInterface $element, array $attributes = []): string { @@ -117,8 +116,6 @@ public function setMessageCloseString($messageCloseString) /** * Get the string used to close message representation - * - * @return string */ public function getMessageCloseString(): string { @@ -139,8 +136,6 @@ public function setMessageOpenFormat($messageOpenFormat) /** * Get the formatted string used to open message representation - * - * @return string */ public function getMessageOpenFormat(): string { @@ -161,8 +156,6 @@ public function setMessageSeparatorString($messageSeparatorString) /** * Get the string used to separate messages - * - * @return string */ public function getMessageSeparatorString(): string { diff --git a/src/View/Helper/FormEmail.php b/src/View/Helper/FormEmail.php index 4c0220777..04dabc35d 100644 --- a/src/View/Helper/FormEmail.php +++ b/src/View/Helper/FormEmail.php @@ -32,8 +32,6 @@ class FormEmail extends FormInput /** * Determine input type to use - * - * @return string */ protected function getType(ElementInterface $element): string { diff --git a/src/View/Helper/FormFile.php b/src/View/Helper/FormFile.php index 900d655d1..f26835fd4 100644 --- a/src/View/Helper/FormFile.php +++ b/src/View/Helper/FormFile.php @@ -32,7 +32,6 @@ class FormFile extends FormInput * Render a form element from the provided $element * * @throws Exception\DomainException - * @return string */ public function render(ElementInterface $element): string { @@ -67,8 +66,6 @@ public function render(ElementInterface $element): string /** * Determine input type to use - * - * @return string */ protected function getType(ElementInterface $element): string { diff --git a/src/View/Helper/FormHidden.php b/src/View/Helper/FormHidden.php index f55dfac18..4329eb435 100644 --- a/src/View/Helper/FormHidden.php +++ b/src/View/Helper/FormHidden.php @@ -22,8 +22,6 @@ class FormHidden extends FormInput /** * Determine input type to use - * - * @return string */ protected function getType(ElementInterface $element): string { diff --git a/src/View/Helper/FormImage.php b/src/View/Helper/FormImage.php index 692ed634e..b4e17272d 100644 --- a/src/View/Helper/FormImage.php +++ b/src/View/Helper/FormImage.php @@ -35,7 +35,6 @@ class FormImage extends FormInput * Render a form element from the provided $element * * @throws Exception\DomainException - * @return string */ public function render(ElementInterface $element): string { @@ -52,8 +51,6 @@ public function render(ElementInterface $element): string /** * Determine input type to use - * - * @return string */ protected function getType(ElementInterface $element): string { diff --git a/src/View/Helper/FormInput.php b/src/View/Helper/FormInput.php index 49c2aafdb..7c51d5a6f 100644 --- a/src/View/Helper/FormInput.php +++ b/src/View/Helper/FormInput.php @@ -100,7 +100,6 @@ public function __invoke(?ElementInterface $element = null) * Render a form element from the provided $element * * @throws Exception\DomainException - * @return string */ public function render(ElementInterface $element): string { @@ -130,8 +129,6 @@ public function render(ElementInterface $element): string /** * Determine input type to use - * - * @return string */ protected function getType(ElementInterface $element): string { diff --git a/src/View/Helper/FormLabel.php b/src/View/Helper/FormLabel.php index 728844a8c..170471308 100644 --- a/src/View/Helper/FormLabel.php +++ b/src/View/Helper/FormLabel.php @@ -94,7 +94,6 @@ public function __invoke(?ElementInterface $element = null, $labelContent = null * @param null|array|ElementInterface $attributesOrElement * @throws Exception\InvalidArgumentException * @throws Exception\DomainException - * @return string */ public function openTag($attributesOrElement = null): string { @@ -140,8 +139,6 @@ public function openTag($attributesOrElement = null): string /** * Return a closing label tag - * - * @return string */ public function closeTag(): string { diff --git a/src/View/Helper/FormMonth.php b/src/View/Helper/FormMonth.php index 4ae18c54b..5f8ecf71d 100644 --- a/src/View/Helper/FormMonth.php +++ b/src/View/Helper/FormMonth.php @@ -8,8 +8,6 @@ class FormMonth extends FormDateTime { /** * Determine input type to use - * - * @return string */ protected function getType(ElementInterface $element): string { diff --git a/src/View/Helper/FormMonthSelect.php b/src/View/Helper/FormMonthSelect.php index 00604edc9..0343f41d3 100644 --- a/src/View/Helper/FormMonthSelect.php +++ b/src/View/Helper/FormMonthSelect.php @@ -93,7 +93,6 @@ public function __invoke(?ElementInterface $element = null, $dateType = IntlDate /** * Render a month element that is composed of two selects * - * @return string * @throws Exception\InvalidArgumentException * @throws Exception\DomainException */ @@ -183,8 +182,6 @@ protected function parsePattern($renderDelimiters = true): array /** * Retrieve pattern to use for Date rendering - * - * @return string */ public function getPattern(): string { @@ -216,8 +213,6 @@ public function setDateType($dateType) /** * Get date formatter - * - * @return int */ public function getDateType(): int { @@ -238,8 +233,6 @@ public function setLocale($locale) /** * Get locale - * - * @return string */ public function getLocale(): string { @@ -295,8 +288,6 @@ protected function getYearsOptions($minYear, $maxYear): array /** * Retrieve the FormSelect helper - * - * @return FormSelect */ protected function getSelectElementHelper(): FormSelect { diff --git a/src/View/Helper/FormMultiCheckbox.php b/src/View/Helper/FormMultiCheckbox.php index 382476971..db657e457 100644 --- a/src/View/Helper/FormMultiCheckbox.php +++ b/src/View/Helper/FormMultiCheckbox.php @@ -95,7 +95,6 @@ public function __invoke(?ElementInterface $element = null, $labelPosition = nul * Render a form element from the provided $element * * @throws Exception\InvalidArgumentException - * @return string */ public function render(ElementInterface $element): string { @@ -131,7 +130,6 @@ public function render(ElementInterface $element): string * @param array $options * @param array $selectedOptions * @param array $attributes - * @return string */ protected function renderOptions( MultiCheckboxElement $element, @@ -245,8 +243,6 @@ protected function renderOptions( /** * Render a hidden element for empty/unchecked value - * - * @return string */ protected function renderHiddenElement(MultiCheckboxElement $element): string { @@ -314,8 +310,6 @@ public function setLabelPosition($labelPosition) /** * Get position of label - * - * @return string */ public function getLabelPosition(): string { @@ -336,8 +330,6 @@ public function setSeparator($separator) /** * Get separator for checkbox elements - * - * @return string */ public function getSeparator(): string { @@ -360,8 +352,6 @@ public function setUseHiddenElement($useHiddenElement) /** * Returns the option for prefixing the element with a hidden element * for the unset value. - * - * @return bool */ public function getUseHiddenElement(): bool { @@ -382,8 +372,6 @@ public function setUncheckedValue($value) /** * Returns the unchecked value used when "UseHiddenElement" is turned on. - * - * @return string */ public function getUncheckedValue(): string { @@ -392,8 +380,6 @@ public function getUncheckedValue(): string /** * Return input type - * - * @return string */ protected function getInputType(): string { @@ -404,7 +390,6 @@ protected function getInputType(): string * Get element name * * @throws Exception\DomainException - * @return string */ protected static function getName(ElementInterface $element): string { @@ -420,8 +405,6 @@ protected static function getName(ElementInterface $element): string /** * Retrieve the FormInput helper - * - * @return FormInput */ protected function getInputHelper(): FormInput { @@ -442,8 +425,6 @@ protected function getInputHelper(): FormInput /** * Retrieve the FormLabel helper - * - * @return FormLabel */ protected function getLabelHelper(): FormLabel { diff --git a/src/View/Helper/FormNumber.php b/src/View/Helper/FormNumber.php index edb9c8460..38d6cf00b 100644 --- a/src/View/Helper/FormNumber.php +++ b/src/View/Helper/FormNumber.php @@ -30,8 +30,6 @@ class FormNumber extends FormInput /** * Determine input type to use - * - * @return string */ protected function getType(ElementInterface $element): string { diff --git a/src/View/Helper/FormPassword.php b/src/View/Helper/FormPassword.php index 2286724ca..23e864b42 100644 --- a/src/View/Helper/FormPassword.php +++ b/src/View/Helper/FormPassword.php @@ -30,8 +30,6 @@ class FormPassword extends FormInput /** * Determine input type to use - * - * @return string */ protected function getType(ElementInterface $element): string { diff --git a/src/View/Helper/FormRadio.php b/src/View/Helper/FormRadio.php index a75b740e8..a8e4744c1 100644 --- a/src/View/Helper/FormRadio.php +++ b/src/View/Helper/FormRadio.php @@ -8,8 +8,6 @@ class FormRadio extends FormMultiCheckbox { /** * Return input type - * - * @return string */ protected function getInputType(): string { @@ -18,8 +16,6 @@ protected function getInputType(): string /** * Get element name - * - * @return string */ protected static function getName(ElementInterface $element): string { diff --git a/src/View/Helper/FormRange.php b/src/View/Helper/FormRange.php index ec6671302..acdce6b42 100644 --- a/src/View/Helper/FormRange.php +++ b/src/View/Helper/FormRange.php @@ -28,8 +28,6 @@ class FormRange extends FormInput /** * Determine input type to use - * - * @return string */ protected function getType(ElementInterface $element): string { diff --git a/src/View/Helper/FormReset.php b/src/View/Helper/FormReset.php index be519f48f..b8d639d02 100644 --- a/src/View/Helper/FormReset.php +++ b/src/View/Helper/FormReset.php @@ -34,7 +34,6 @@ class FormReset extends FormInput * Determine input type to use * * @throws Exception\DomainException - * @return string */ protected function getType(ElementInterface $element): string { diff --git a/src/View/Helper/FormRow.php b/src/View/Helper/FormRow.php index 7590ee994..b14fbcec2 100644 --- a/src/View/Helper/FormRow.php +++ b/src/View/Helper/FormRow.php @@ -111,7 +111,6 @@ public function __invoke( * * @param null|string $labelPosition * @throws Exception\DomainException - * @return string */ public function render(ElementInterface $element, $labelPosition = null): string { @@ -260,8 +259,6 @@ public function setInputErrorClass($inputErrorClass) /** * Get the class that is added to element that have errors - * - * @return string */ public function getInputErrorClass(): string { @@ -316,8 +313,6 @@ public function setLabelPosition($labelPosition) /** * Get the label position - * - * @return string */ public function getLabelPosition(): string { @@ -338,8 +333,6 @@ public function setRenderErrors($renderErrors) /** * Retrieve if the errors are rendered by this helper - * - * @return bool */ public function getRenderErrors(): bool { @@ -360,8 +353,6 @@ public function setPartial($partial) /** * Retrieve current partial - * - * @return null|string */ public function getPartial(): ?string { @@ -370,8 +361,6 @@ public function getPartial(): ?string /** * Retrieve the FormLabel helper - * - * @return FormLabel */ protected function getLabelHelper(): FormLabel { @@ -399,8 +388,6 @@ protected function getLabelHelper(): FormLabel /** * Retrieve the FormElement helper - * - * @return FormElement */ protected function getElementHelper(): FormElement { @@ -421,8 +408,6 @@ protected function getElementHelper(): FormElement /** * Retrieve the FormElementErrors helper - * - * @return FormElementErrors */ protected function getElementErrorsHelper(): FormElementErrors { diff --git a/src/View/Helper/FormSearch.php b/src/View/Helper/FormSearch.php index 92d0a09de..7adfdb9a6 100644 --- a/src/View/Helper/FormSearch.php +++ b/src/View/Helper/FormSearch.php @@ -16,8 +16,6 @@ class FormSearch extends FormText { /** * Determine input type to use - * - * @return string */ protected function getType(ElementInterface $element): string { diff --git a/src/View/Helper/FormSelect.php b/src/View/Helper/FormSelect.php index b0cfbe13a..e155ff6aa 100644 --- a/src/View/Helper/FormSelect.php +++ b/src/View/Helper/FormSelect.php @@ -95,7 +95,6 @@ public function __invoke(?ElementInterface $element = null) * * @throws Exception\InvalidArgumentException * @throws Exception\DomainException - * @return string */ public function render(ElementInterface $element): string { @@ -159,7 +158,6 @@ public function render(ElementInterface $element): string * * @param array $options * @param array $selectedOptions Option values that should be marked as selected - * @return string */ public function renderOptions(array $options, array $selectedOptions = []): string { @@ -240,7 +238,6 @@ public function renderOptions(array $options, array $selectedOptions = []): stri * * @param array $optgroup * @param array $selectedOptions - * @return string */ public function renderOptgroup(array $optgroup, array $selectedOptions = []): string { @@ -310,9 +307,6 @@ protected function renderHiddenElement(SelectElement $element) return $this->getFormHiddenHelper()->__invoke($hiddenElement); } - /** - * @return FormHidden - */ protected function getFormHiddenHelper(): FormHidden { if (! $this->formHiddenHelper) { diff --git a/src/View/Helper/FormTel.php b/src/View/Helper/FormTel.php index 2bee69ff2..613dcf62a 100644 --- a/src/View/Helper/FormTel.php +++ b/src/View/Helper/FormTel.php @@ -31,8 +31,6 @@ class FormTel extends FormInput /** * Determine input type to use - * - * @return string */ protected function getType(ElementInterface $element): string { diff --git a/src/View/Helper/FormText.php b/src/View/Helper/FormText.php index e59f6ff67..fa3ab0693 100644 --- a/src/View/Helper/FormText.php +++ b/src/View/Helper/FormText.php @@ -33,8 +33,6 @@ class FormText extends FormInput /** * Determine input type to use - * - * @return string */ protected function getType(ElementInterface $element): string { diff --git a/src/View/Helper/FormTextarea.php b/src/View/Helper/FormTextarea.php index 294000ede..180ccc9e9 100644 --- a/src/View/Helper/FormTextarea.php +++ b/src/View/Helper/FormTextarea.php @@ -52,12 +52,11 @@ public function __invoke(?ElementInterface $element = null) * Render a form