diff --git a/composer.json b/composer.json index 96e66dbd..428ff91c 100644 --- a/composer.json +++ b/composer.json @@ -40,7 +40,7 @@ "require-dev": { "ext-json": "*", "laminas/laminas-coding-standard": "~2.5.0", - "phpunit/phpunit": "^10.5.15", + "phpunit/phpunit": "^10.5.18", "psalm/plugin-phpunit": "^0.19.0", "psr/http-message": "^2.0", "vimeo/psalm": "^5.23.1", diff --git a/composer.lock b/composer.lock index e2d10899..846a2f8d 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "0393a5f8ad0e360dc3dc490cbd0d525e", + "content-hash": "2c6b09cd6a04ec06aefaf87de44e2d75", "packages": [ { "name": "laminas/laminas-filter", - "version": "2.35.1", + "version": "2.35.2", "source": { "type": "git", "url": "https://github.com/laminas/laminas-filter.git", - "reference": "a03ad6a4976df7e6f6026ce8b2d1e9c53f6a99c4" + "reference": "3e821b33a787253d56046f9258174a22de1bd267" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-filter/zipball/a03ad6a4976df7e6f6026ce8b2d1e9c53f6a99c4", - "reference": "a03ad6a4976df7e6f6026ce8b2d1e9c53f6a99c4", + "url": "https://api.github.com/repos/laminas/laminas-filter/zipball/3e821b33a787253d56046f9258174a22de1bd267", + "reference": "3e821b33a787253d56046f9258174a22de1bd267", "shasum": "" }, "require": { @@ -83,7 +83,7 @@ "type": "community_bridge" } ], - "time": "2024-04-04T09:13:02+00:00" + "time": "2024-04-11T08:13:56+00:00" }, { "name": "laminas/laminas-servicemanager", @@ -512,16 +512,16 @@ }, { "name": "amphp/byte-stream", - "version": "v1.8.1", + "version": "v1.8.2", "source": { "type": "git", "url": "https://github.com/amphp/byte-stream.git", - "reference": "acbd8002b3536485c997c4e019206b3f10ca15bd" + "reference": "4f0e968ba3798a423730f567b1b50d3441c16ddc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/amphp/byte-stream/zipball/acbd8002b3536485c997c4e019206b3f10ca15bd", - "reference": "acbd8002b3536485c997c4e019206b3f10ca15bd", + "url": "https://api.github.com/repos/amphp/byte-stream/zipball/4f0e968ba3798a423730f567b1b50d3441c16ddc", + "reference": "4f0e968ba3798a423730f567b1b50d3441c16ddc", "shasum": "" }, "require": { @@ -537,11 +537,6 @@ "psalm/phar": "^3.11.4" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, "autoload": { "files": [ "lib/functions.php" @@ -565,7 +560,7 @@ } ], "description": "A stream abstraction to make working with non-blocking I/O simple.", - "homepage": "http://amphp.org/byte-stream", + "homepage": "https://amphp.org/byte-stream", "keywords": [ "amp", "amphp", @@ -575,9 +570,8 @@ "stream" ], "support": { - "irc": "irc://irc.freenode.org/amphp", "issues": "https://github.com/amphp/byte-stream/issues", - "source": "https://github.com/amphp/byte-stream/tree/v1.8.1" + "source": "https://github.com/amphp/byte-stream/tree/v1.8.2" }, "funding": [ { @@ -585,7 +579,7 @@ "type": "github" } ], - "time": "2021-03-30T17:13:30+00:00" + "time": "2024-04-13T18:00:56+00:00" }, { "name": "composer/package-versions-deprecated", @@ -2024,16 +2018,16 @@ }, { "name": "phpunit/phpunit", - "version": "10.5.17", + "version": "10.5.18", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "c1f736a473d21957ead7e94fcc029f571895abf5" + "reference": "835df1709ac6c968ba34bf23f3c30e5d5a266de8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c1f736a473d21957ead7e94fcc029f571895abf5", - "reference": "c1f736a473d21957ead7e94fcc029f571895abf5", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/835df1709ac6c968ba34bf23f3c30e5d5a266de8", + "reference": "835df1709ac6c968ba34bf23f3c30e5d5a266de8", "shasum": "" }, "require": { @@ -2105,7 +2099,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.17" + "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.18" }, "funding": [ { @@ -2121,7 +2115,7 @@ "type": "tidelift" } ], - "time": "2024-04-05T04:39:01+00:00" + "time": "2024-04-14T07:05:31+00:00" }, { "name": "psalm/plugin-phpunit", diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 9ae5bafc..170b746b 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -498,9 +498,6 @@ - - - diff --git a/psalm.xml.dist b/psalm.xml.dist index 22355666..12c9f2ad 100644 --- a/psalm.xml.dist +++ b/psalm.xml.dist @@ -33,6 +33,11 @@ + + + + + diff --git a/test/CollectionInputFilterTest.php b/test/CollectionInputFilterTest.php index dcd49763..bbeffd6c 100644 --- a/test/CollectionInputFilterTest.php +++ b/test/CollectionInputFilterTest.php @@ -246,7 +246,7 @@ public static function dataNestingCollection(): array } #[DataProvider('dataNestingCollection')] - public function testNestingCollectionCountCached(?int $count, bool $expectedIsValid): void + public function testNestingCollectionCountCached(?int $count, bool $isValid): void { $firstInputFilter = new InputFilter(); @@ -291,7 +291,7 @@ public function testNestingCollectionCountCached(?int $count, bool $expectedIsVa ]; $mainInputFilter->setData($data); - self::assertSame($expectedIsValid, $mainInputFilter->isValid()); + self::assertSame($isValid, $mainInputFilter->isValid()); } /** diff --git a/test/FileInput/HttpServerFileInputDecoratorTest.php b/test/FileInput/HttpServerFileInputDecoratorTest.php index 348013c1..0f129bb2 100644 --- a/test/FileInput/HttpServerFileInputDecoratorTest.php +++ b/test/FileInput/HttpServerFileInputDecoratorTest.php @@ -9,6 +9,7 @@ use Laminas\Validator; use LaminasTest\InputFilter\InputTest; use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use Webmozart\Assert\Assert; use function json_encode; @@ -214,14 +215,14 @@ public function testValidationsRunWithoutFileArrayIsSend(): void self::assertFalse($this->input->isValid()); } - /** @param mixed $value */ - public function testNotEmptyValidatorAddedWhenIsValidIsCalled($value = null): void + #[DataProvider('emptyValueProvider')] + public function testNotEmptyValidatorAddedWhenIsValidIsCalled(mixed $raw, mixed $filtered): void { self::markTestSkipped('Test is not enabled in FileInputTest'); } - /** @param mixed $value */ - public function testRequiredNotEmptyValidatorNotAddedWhenOneExists($value = null): void + #[DataProvider('emptyValueProvider')] + public function testRequiredNotEmptyValidatorNotAddedWhenOneExists(mixed $raw, mixed $filtered): void { self::markTestSkipped('Test is not enabled in FileInputTest'); } diff --git a/test/FileInput/PsrFileInputDecoratorTest.php b/test/FileInput/PsrFileInputDecoratorTest.php index 53825717..c972632e 100644 --- a/test/FileInput/PsrFileInputDecoratorTest.php +++ b/test/FileInput/PsrFileInputDecoratorTest.php @@ -11,6 +11,7 @@ use LaminasTest\InputFilter\InputTest; use LaminasTest\InputFilter\TestAsset\UploadedFileInterfaceStub; use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use Psr\Http\Message\UploadedFileInterface; use function in_array; @@ -215,14 +216,14 @@ public function testRequiredUploadValidatorValidatorNotAddedWhenOneExists(): voi self::assertEquals($validator, $validators[0]['instance']); } - /** @param mixed $value */ - public function testNotEmptyValidatorAddedWhenIsValidIsCalled($value = null): void + #[DataProvider('emptyValueProvider')] + public function testNotEmptyValidatorAddedWhenIsValidIsCalled(mixed $raw, mixed $filtered): void { self::markTestSkipped('Test is not enabled in PsrFileInputTest'); } - /** @param mixed $value */ - public function testRequiredNotEmptyValidatorNotAddedWhenOneExists($value = null): void + #[DataProvider('emptyValueProvider')] + public function testRequiredNotEmptyValidatorNotAddedWhenOneExists(mixed $raw, mixed $filtered): void { self::markTestSkipped('Test is not enabled in PsrFileInputTest'); } diff --git a/test/InputTest.php b/test/InputTest.php index ac554262..3da5cdfe 100644 --- a/test/InputTest.php +++ b/test/InputTest.php @@ -142,29 +142,23 @@ public function testContinueIfEmptyFlagIsMutable(): void self::assertTrue($input->continueIfEmpty()); } - /** - * @param mixed $fallbackValue - */ #[DataProvider('setValueProvider')] - public function testSetFallbackValue($fallbackValue): void + public function testSetFallbackValue(mixed $raw, mixed $filtered): void { $input = $this->input; - $return = $input->setFallbackValue($fallbackValue); + $return = $input->setFallbackValue($raw); self::assertSame($input, $return, 'setFallbackValue() must return it self'); - self::assertEquals($fallbackValue, $input->getFallbackValue(), 'getFallbackValue() value not match'); + self::assertEquals($raw, $input->getFallbackValue(), 'getFallbackValue() value not match'); self::assertTrue($input->hasFallback(), 'hasFallback() value not match'); } - /** - * @param mixed $fallbackValue - */ #[DataProvider('setValueProvider')] - public function testClearFallbackValue($fallbackValue): void + public function testClearFallbackValue(mixed $raw, mixed $filtered): void { $input = $this->input; - $input->setFallbackValue($fallbackValue); + $input->setFallbackValue($raw); $input->clearFallbackValue(); self::assertNull($input->getFallbackValue(), 'getFallbackValue() value not match'); self::assertFalse($input->hasFallback(), 'hasFallback() value not match'); @@ -322,15 +316,12 @@ public function testNotRequiredWithoutFallbackAndValueNotSetThenIsValid(): void self::assertEquals([], $input->getMessages(), 'getMessages() should be empty because the input is valid'); } - /** - * @param mixed $value - */ #[DataProvider('emptyValueProvider')] - public function testNotEmptyValidatorNotInjectedIfContinueIfEmptyIsTrue($value): void + public function testNotEmptyValidatorNotInjectedIfContinueIfEmptyIsTrue(mixed $raw, mixed $filtered): void { $input = $this->input; $input->setContinueIfEmpty(true); - $input->setValue($value); + $input->setValue($raw); $input->isValid(); $validators = $input->getValidatorChain() ->getValidators(); @@ -406,14 +397,11 @@ public function testBreakOnFailureFlagIsMutable(): void self::assertTrue($this->input->breakOnFailure()); } - /** - * @param mixed $value - */ #[DataProvider('emptyValueProvider')] - public function testNotEmptyValidatorAddedWhenIsValidIsCalled($value): void + public function testNotEmptyValidatorAddedWhenIsValidIsCalled(mixed $raw, mixed $filtered): void { self::assertTrue($this->input->isRequired()); - $this->input->setValue($value); + $this->input->setValue($raw); $validatorChain = $this->input->getValidatorChain(); self::assertEquals(0, count($validatorChain->getValidators())); @@ -427,16 +415,13 @@ public function testNotEmptyValidatorAddedWhenIsValidIsCalled($value): void self::assertEquals(1, count($validatorChain->getValidators())); } - /** - * @param mixed $value - */ #[DataProvider('emptyValueProvider')] - public function testRequiredNotEmptyValidatorNotAddedWhenOneExists($value): void + public function testRequiredNotEmptyValidatorNotAddedWhenOneExists(mixed $raw, mixed $filtered): void { $this->input->setRequired(true); - $this->input->setValue($value); + $this->input->setValue($raw); - $notEmptyMock = $this->createNonEmptyValidatorMock(false, $value); + $notEmptyMock = $this->createNonEmptyValidatorMock(false, $raw); $validatorChain = $this->input->getValidatorChain(); $validatorChain->prependValidator($notEmptyMock); @@ -447,21 +432,17 @@ public function testRequiredNotEmptyValidatorNotAddedWhenOneExists($value): void self::assertEquals($notEmptyMock, $validators[0]['instance']); } - /** - * @param mixed $valueRaw - * @param mixed $valueFiltered - */ #[DataProvider('emptyValueProvider')] - public function testDoNotInjectNotEmptyValidatorIfAnywhereInChain($valueRaw, $valueFiltered): void + public function testDoNotInjectNotEmptyValidatorIfAnywhereInChain(mixed $raw, mixed $filtered): void { - $filterChain = $this->createFilterChainMock([[$valueRaw, $valueFiltered]]); + $filterChain = $this->createFilterChainMock([[$raw, $filtered]]); $validatorChain = $this->input->getValidatorChain(); $this->input->setRequired(true); $this->input->setFilterChain($filterChain); - $this->input->setValue($valueRaw); + $this->input->setValue($raw); - $notEmptyMock = $this->createNonEmptyValidatorMock(false, $valueFiltered); + $notEmptyMock = $this->createNonEmptyValidatorMock(false, $filtered); $validatorChain->attach(self::createValidatorMock(true)); $validatorChain->attach($notEmptyMock); @@ -501,30 +482,24 @@ public function testIsRequiredVsAllowEmptyVsContinueIfEmptyVsIsValid( self::assertEquals($value, $this->input->getValue(), 'getValue() must return the filtered value always'); } - /** - * @param mixed $value - */ #[DataProvider('setValueProvider')] - public function testSetValuePutInputInTheDesiredState($value): void + public function testSetValuePutInputInTheDesiredState(mixed $raw, mixed $filtered): void { $input = $this->input; self::assertFalse($input->hasValue(), 'Input should not have value by default'); - $input->setValue($value); + $input->setValue($raw); self::assertTrue($input->hasValue(), "hasValue() didn't return true when value was set"); } - /** - * @param mixed $value - */ #[DataProvider('setValueProvider')] - public function testResetValueReturnsInputValueToDefaultValue($value): void + public function testResetValueReturnsInputValueToDefaultValue(mixed $raw, mixed $filtered): void { $input = $this->input; $originalInput = clone $input; self::assertFalse($input->hasValue(), 'Input should not have value by default'); - $input->setValue($value); + $input->setValue($raw); self::assertTrue($input->hasValue(), "hasValue() didn't return true when value was set"); $return = $input->resetValue();