From 50ab59b148109d6ccea43200674dc2601c17f48c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edi=20Modri=C4=87?= Date: Tue, 12 Sep 2023 15:38:54 +0200 Subject: [PATCH 1/3] Use docker variant of OskarStark/php-cs-fixer-ga require --- .github/workflows/coding_standards.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/coding_standards.yml b/.github/workflows/coding_standards.yml index 0e161330..f943db45 100644 --- a/.github/workflows/coding_standards.yml +++ b/.github/workflows/coding_standards.yml @@ -18,6 +18,6 @@ jobs: with: repository: netgen-layouts/layouts-coding-standard path: vendor/netgen/layouts-coding-standard - - uses: OskarStark/php-cs-fixer-ga@master + - uses: docker://oskarstark/php-cs-fixer-ga with: args: --diff --dry-run From 63b96ec2ece73ca00228d4b328bb7ec14bf9b176 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edi=20Modri=C4=87?= Date: Tue, 12 Sep 2023 15:56:23 +0200 Subject: [PATCH 2/3] Fix CS --- bundle/Controller/Admin/DeleteRule.php | 4 +--- phpstan.tests.neon | 2 +- .../HttpCache/ConfigureHttpCachePassTest.php | 2 +- .../Integration/ComponentTestBase.php | 4 ++-- .../Integration/ContentFieldTestBase.php | 4 ++-- .../Resolver/ConditionType/ContentTypeTest.php | 2 +- .../Resolver/ConditionType/SiteAccessGroupTest.php | 4 ++-- .../Layout/Resolver/ConditionType/SiteAccessTest.php | 4 ++-- .../TargetType/SemanticPathInfoPrefixTest.php | 2 +- .../Resolver/TargetType/SemanticPathInfoTest.php | 2 +- .../lib/Parameters/ParameterType/ContentTypeTest.php | 10 +++++----- .../Parameters/ParameterType/ContentTypeTypeTest.php | 10 +++++----- .../Parameters/ParameterType/LocationTypeTest.php | 10 +++++----- .../Parameters/ParameterType/ObjectStateTypeTest.php | 12 ++++++------ .../lib/Parameters/ParameterType/SectionTypeTest.php | 10 +++++----- tests/lib/Parameters/ParameterType/TagsTypeTest.php | 8 ++++---- .../Voter/RepositoryAccessVoterTest.php | 2 +- tests/lib/Security/Role/RoleHierarchyTest.php | 2 +- tests/lib/Validator/ContentTypeValidatorTest.php | 2 +- tests/lib/Validator/ObjectStateValidatorTest.php | 2 +- tests/lib/Validator/SectionValidatorTest.php | 2 +- tests/lib/Validator/SiteAccessGroupValidatorTest.php | 2 +- tests/lib/Validator/SiteAccessValidatorTest.php | 2 +- 23 files changed, 51 insertions(+), 53 deletions(-) diff --git a/bundle/Controller/Admin/DeleteRule.php b/bundle/Controller/Admin/DeleteRule.php index bfd8bc39..c30967dd 100644 --- a/bundle/Controller/Admin/DeleteRule.php +++ b/bundle/Controller/Admin/DeleteRule.php @@ -49,7 +49,5 @@ public function __invoke(Rule $rule, Request $request): Response return new Response('', Response::HTTP_NO_CONTENT); } - public function checkPermissions(): void - { - } + public function checkPermissions(): void {} } diff --git a/phpstan.tests.neon b/phpstan.tests.neon index 438f4b8e..e6fb3453 100644 --- a/phpstan.tests.neon +++ b/phpstan.tests.neon @@ -12,7 +12,7 @@ parameters: - '#Call to an undefined method Netgen\\Layouts\\Ez\\Security\\Role\\RoleHierarchy::getReachableRoles\(\).#' # Disable errors about missing value types in PHPUnit data providers - - '#Method .+Test(Base)?::\w+DataProvider\(\) return type has no value type specified in iterable type array.#' + - '#Method .+Test(Base)?::\w+DataProvider\(\) return type has no value type specified in iterable type iterable.#' # Disable errors for various tests that verify the instance of the value - '#Call to static method PHPUnit\\Framework\\Assert::assertInstanceOf\(\)#' diff --git a/tests/bundle/DependencyInjection/CompilerPass/HttpCache/ConfigureHttpCachePassTest.php b/tests/bundle/DependencyInjection/CompilerPass/HttpCache/ConfigureHttpCachePassTest.php index c4b41731..bbbd0a28 100644 --- a/tests/bundle/DependencyInjection/CompilerPass/HttpCache/ConfigureHttpCachePassTest.php +++ b/tests/bundle/DependencyInjection/CompilerPass/HttpCache/ConfigureHttpCachePassTest.php @@ -55,7 +55,7 @@ public function testProcessWithNoSupportedClient(): void $this->assertContainerBuilderNotHasAlias('netgen_layouts.http_cache.client'); } - public static function processDataProvider(): array + public static function processDataProvider(): iterable { return [ [VarnishPurgeClient::class, true], diff --git a/tests/lib/Block/BlockDefinition/Integration/ComponentTestBase.php b/tests/lib/Block/BlockDefinition/Integration/ComponentTestBase.php index e843fc57..4c733342 100644 --- a/tests/lib/Block/BlockDefinition/Integration/ComponentTestBase.php +++ b/tests/lib/Block/BlockDefinition/Integration/ComponentTestBase.php @@ -19,7 +19,7 @@ abstract class ComponentTestBase extends BlockTestCase { - public static function parametersDataProvider(): array + public static function parametersDataProvider(): iterable { return [ [ @@ -60,7 +60,7 @@ public static function parametersDataProvider(): array ]; } - public static function invalidParametersDataProvider(): array + public static function invalidParametersDataProvider(): iterable { return [ [ diff --git a/tests/lib/Block/BlockDefinition/Integration/ContentFieldTestBase.php b/tests/lib/Block/BlockDefinition/Integration/ContentFieldTestBase.php index 5634ab7d..630d236f 100644 --- a/tests/lib/Block/BlockDefinition/Integration/ContentFieldTestBase.php +++ b/tests/lib/Block/BlockDefinition/Integration/ContentFieldTestBase.php @@ -11,7 +11,7 @@ abstract class ContentFieldTestBase extends BlockTestCase { - public static function parametersDataProvider(): array + public static function parametersDataProvider(): iterable { return [ [ @@ -53,7 +53,7 @@ public static function parametersDataProvider(): array ]; } - public static function invalidParametersDataProvider(): array + public static function invalidParametersDataProvider(): iterable { return [ [ diff --git a/tests/lib/Layout/Resolver/ConditionType/ContentTypeTest.php b/tests/lib/Layout/Resolver/ConditionType/ContentTypeTest.php index 5c05088d..da01e97d 100644 --- a/tests/lib/Layout/Resolver/ConditionType/ContentTypeTest.php +++ b/tests/lib/Layout/Resolver/ConditionType/ContentTypeTest.php @@ -143,7 +143,7 @@ public function testMatchesWithNoContent(): void self::assertFalse($this->conditionType->matches($request, ['article'])); } - public static function matchesDataProvider(): array + public static function matchesDataProvider(): iterable { return [ ['not_array', false], diff --git a/tests/lib/Layout/Resolver/ConditionType/SiteAccessGroupTest.php b/tests/lib/Layout/Resolver/ConditionType/SiteAccessGroupTest.php index b541c667..106d0625 100644 --- a/tests/lib/Layout/Resolver/ConditionType/SiteAccessGroupTest.php +++ b/tests/lib/Layout/Resolver/ConditionType/SiteAccessGroupTest.php @@ -95,7 +95,7 @@ public function testMatchesWithNoSiteAccess(): void /** * Provider for testing condition type validation. */ - public static function validationDataProvider(): array + public static function validationDataProvider(): iterable { return [ [['frontend'], true], @@ -107,7 +107,7 @@ public static function validationDataProvider(): array ]; } - public static function matchesDataProvider(): array + public static function matchesDataProvider(): iterable { return [ ['not_array', false], diff --git a/tests/lib/Layout/Resolver/ConditionType/SiteAccessTest.php b/tests/lib/Layout/Resolver/ConditionType/SiteAccessTest.php index 6911cccc..73c135ca 100644 --- a/tests/lib/Layout/Resolver/ConditionType/SiteAccessTest.php +++ b/tests/lib/Layout/Resolver/ConditionType/SiteAccessTest.php @@ -74,7 +74,7 @@ public function testMatchesWithNoSiteAccess(): void /** * Provider for testing condition type validation. */ - public static function validationDataProvider(): array + public static function validationDataProvider(): iterable { return [ [['cro'], true], @@ -86,7 +86,7 @@ public static function validationDataProvider(): array ]; } - public static function matchesDataProvider(): array + public static function matchesDataProvider(): iterable { return [ ['not_array', false], diff --git a/tests/lib/Layout/Resolver/TargetType/SemanticPathInfoPrefixTest.php b/tests/lib/Layout/Resolver/TargetType/SemanticPathInfoPrefixTest.php index e8603f35..a5ac1ed8 100644 --- a/tests/lib/Layout/Resolver/TargetType/SemanticPathInfoPrefixTest.php +++ b/tests/lib/Layout/Resolver/TargetType/SemanticPathInfoPrefixTest.php @@ -82,7 +82,7 @@ public function testProvideValueWithNoSemanticPathInfo(): void /** * Provider for testing target type validation. */ - public static function validationDataProvider(): array + public static function validationDataProvider(): iterable { return [ ['/some/route', true], diff --git a/tests/lib/Layout/Resolver/TargetType/SemanticPathInfoTest.php b/tests/lib/Layout/Resolver/TargetType/SemanticPathInfoTest.php index 6453cbef..282531a4 100644 --- a/tests/lib/Layout/Resolver/TargetType/SemanticPathInfoTest.php +++ b/tests/lib/Layout/Resolver/TargetType/SemanticPathInfoTest.php @@ -82,7 +82,7 @@ public function testProvideValueWithNoSemanticPathInfo(): void /** * Provider for testing target type validation. */ - public static function validationDataProvider(): array + public static function validationDataProvider(): iterable { return [ ['/some/route', true], diff --git a/tests/lib/Parameters/ParameterType/ContentTypeTest.php b/tests/lib/Parameters/ParameterType/ContentTypeTest.php index 8ecfbd0e..477fa692 100644 --- a/tests/lib/Parameters/ParameterType/ContentTypeTest.php +++ b/tests/lib/Parameters/ParameterType/ContentTypeTest.php @@ -120,7 +120,7 @@ public function testInvalidOptions(array $options): void /** * Provider for testing valid parameter attributes. */ - public static function validOptionsDataProvider(): array + public static function validOptionsDataProvider(): iterable { return [ [ @@ -172,7 +172,7 @@ public static function validOptionsDataProvider(): array /** * Provider for testing invalid parameter attributes. */ - public static function invalidOptionsDataProvider(): array + public static function invalidOptionsDataProvider(): iterable { return [ [ @@ -294,7 +294,7 @@ static function () use ($value, $type): ContentInfo { /** * Provider for testing valid parameter values. */ - public static function validationDataProvider(): array + public static function validationDataProvider(): iterable { return [ [12, 24, false, true], @@ -335,7 +335,7 @@ public function testFromHash($value, $convertedValue): void ); } - public static function fromHashDataProvider(): array + public static function fromHashDataProvider(): iterable { return [ [ @@ -368,7 +368,7 @@ public function testIsValueEmpty($value, bool $isEmpty): void /** * Provider for testing if the value is empty. */ - public static function emptyDataProvider(): array + public static function emptyDataProvider(): iterable { return [ [null, true], diff --git a/tests/lib/Parameters/ParameterType/ContentTypeTypeTest.php b/tests/lib/Parameters/ParameterType/ContentTypeTypeTest.php index 19d6a8fe..db9a9a17 100644 --- a/tests/lib/Parameters/ParameterType/ContentTypeTypeTest.php +++ b/tests/lib/Parameters/ParameterType/ContentTypeTypeTest.php @@ -88,7 +88,7 @@ public function testInvalidOptions(array $options): void /** * Provider for testing valid parameter attributes. */ - public static function validOptionsDataProvider(): array + public static function validOptionsDataProvider(): iterable { return [ [ @@ -140,7 +140,7 @@ public static function validOptionsDataProvider(): array /** * Provider for testing invalid parameter attributes. */ - public static function invalidOptionsDataProvider(): array + public static function invalidOptionsDataProvider(): iterable { return [ [ @@ -193,7 +193,7 @@ static function (string $identifier): EzContentType { /** * Provider for testing valid parameter values. */ - public static function validationDataProvider(): array + public static function validationDataProvider(): iterable { return [ ['news', false, true], @@ -236,7 +236,7 @@ public function testFromHash($value, $convertedValue, bool $multiple): void ); } - public static function fromHashDataProvider(): array + public static function fromHashDataProvider(): iterable { return [ [ @@ -297,7 +297,7 @@ public function testIsValueEmpty($value, bool $isEmpty): void /** * Provider for testing if the value is empty. */ - public static function emptyDataProvider(): array + public static function emptyDataProvider(): iterable { return [ [null, true], diff --git a/tests/lib/Parameters/ParameterType/LocationTypeTest.php b/tests/lib/Parameters/ParameterType/LocationTypeTest.php index a13ace5c..d709755b 100644 --- a/tests/lib/Parameters/ParameterType/LocationTypeTest.php +++ b/tests/lib/Parameters/ParameterType/LocationTypeTest.php @@ -96,7 +96,7 @@ public function testInvalidOptions(array $options): void /** * Provider for testing valid parameter attributes. */ - public static function validOptionsDataProvider(): array + public static function validOptionsDataProvider(): iterable { return [ [ @@ -148,7 +148,7 @@ public static function validOptionsDataProvider(): array /** * Provider for testing invalid parameter attributes. */ - public static function invalidOptionsDataProvider(): array + public static function invalidOptionsDataProvider(): iterable { return [ [ @@ -279,7 +279,7 @@ static function () use ($value, $type): Location { /** * Provider for testing valid parameter values. */ - public static function validationDataProvider(): array + public static function validationDataProvider(): iterable { return [ [12, 'user', false, true], @@ -320,7 +320,7 @@ public function testFromHash($value, $convertedValue): void ); } - public static function fromHashDataProvider(): array + public static function fromHashDataProvider(): iterable { return [ [ @@ -353,7 +353,7 @@ public function testIsValueEmpty($value, bool $isEmpty): void /** * Provider for testing if the value is empty. */ - public static function emptyDataProvider(): array + public static function emptyDataProvider(): iterable { return [ [null, true], diff --git a/tests/lib/Parameters/ParameterType/ObjectStateTypeTest.php b/tests/lib/Parameters/ParameterType/ObjectStateTypeTest.php index 89e944ab..ef04bf03 100644 --- a/tests/lib/Parameters/ParameterType/ObjectStateTypeTest.php +++ b/tests/lib/Parameters/ParameterType/ObjectStateTypeTest.php @@ -88,7 +88,7 @@ public function testInvalidOptions(array $options): void /** * Provider for testing valid parameter attributes. */ - public static function validOptionsDataProvider(): array + public static function validOptionsDataProvider(): iterable { return [ [ @@ -140,7 +140,7 @@ public static function validOptionsDataProvider(): array /** * Provider for testing invalid parameter attributes. */ - public static function invalidOptionsDataProvider(): array + public static function invalidOptionsDataProvider(): iterable { return [ [ @@ -235,7 +235,7 @@ public function testValidationWithEmptyValues($value, bool $required, bool $isVa self::assertSame($isValid, $errors->count() === 0); } - public static function validationDataProvider(): array + public static function validationDataProvider(): iterable { return [ ['group1|state2', false, true], @@ -255,7 +255,7 @@ public static function validationDataProvider(): array ]; } - public static function validationWithEmptyValuesDataProvider(): array + public static function validationWithEmptyValuesDataProvider(): iterable { return [ [[], false, true], @@ -288,7 +288,7 @@ public function testFromHash($value, $convertedValue, bool $multiple): void ); } - public static function fromHashDataProvider(): array + public static function fromHashDataProvider(): iterable { return [ [ @@ -349,7 +349,7 @@ public function testIsValueEmpty($value, bool $isEmpty): void /** * Provider for testing if the value is empty. */ - public static function emptyDataProvider(): array + public static function emptyDataProvider(): iterable { return [ [null, true], diff --git a/tests/lib/Parameters/ParameterType/SectionTypeTest.php b/tests/lib/Parameters/ParameterType/SectionTypeTest.php index 4c77606d..d824330f 100644 --- a/tests/lib/Parameters/ParameterType/SectionTypeTest.php +++ b/tests/lib/Parameters/ParameterType/SectionTypeTest.php @@ -88,7 +88,7 @@ public function testInvalidOptions(array $options): void /** * Provider for testing valid parameter attributes. */ - public static function validOptionsDataProvider(): array + public static function validOptionsDataProvider(): iterable { return [ [ @@ -140,7 +140,7 @@ public static function validOptionsDataProvider(): array /** * Provider for testing invalid parameter attributes. */ - public static function invalidOptionsDataProvider(): array + public static function invalidOptionsDataProvider(): iterable { return [ [ @@ -199,7 +199,7 @@ static function (string $identifier): EzSection { /** * Provider for testing valid parameter values. */ - public static function validationDataProvider(): array + public static function validationDataProvider(): iterable { return [ ['standard', false, true], @@ -242,7 +242,7 @@ public function testFromHash($value, $convertedValue, bool $multiple): void ); } - public static function fromHashDataProvider(): array + public static function fromHashDataProvider(): iterable { return [ [ @@ -303,7 +303,7 @@ public function testIsValueEmpty($value, bool $isEmpty): void /** * Provider for testing if the value is empty. */ - public static function emptyDataProvider(): array + public static function emptyDataProvider(): iterable { return [ [null, true], diff --git a/tests/lib/Parameters/ParameterType/TagsTypeTest.php b/tests/lib/Parameters/ParameterType/TagsTypeTest.php index c831d750..8c2774d8 100644 --- a/tests/lib/Parameters/ParameterType/TagsTypeTest.php +++ b/tests/lib/Parameters/ParameterType/TagsTypeTest.php @@ -73,7 +73,7 @@ public function testInvalidOptions(array $options): void /** * Provider for testing valid parameter attributes. */ - public static function validOptionsDataProvider(): array + public static function validOptionsDataProvider(): iterable { return [ [ @@ -174,7 +174,7 @@ public static function validOptionsDataProvider(): array /** * Provider for testing invalid parameter attributes. */ - public static function invalidOptionsDataProvider(): array + public static function invalidOptionsDataProvider(): iterable { return [ [ @@ -234,7 +234,7 @@ public function testFromHash($value, $convertedValue): void ); } - public static function fromHashDataProvider(): array + public static function fromHashDataProvider(): iterable { return [ [ @@ -354,7 +354,7 @@ static function (int $id): Tag { self::assertSame($isValid, $errors->count() === 0); } - public static function validationDataProvider(): array + public static function validationDataProvider(): iterable { return [ [[12], false, true], diff --git a/tests/lib/Security/Authorization/Voter/RepositoryAccessVoterTest.php b/tests/lib/Security/Authorization/Voter/RepositoryAccessVoterTest.php index e927defa..3445a12f 100644 --- a/tests/lib/Security/Authorization/Voter/RepositoryAccessVoterTest.php +++ b/tests/lib/Security/Authorization/Voter/RepositoryAccessVoterTest.php @@ -70,7 +70,7 @@ public function testVote(string $attribute, array $repoAccess, int $voteResult): self::assertSame($voteResult, $result); } - public static function voteDataProvider(): array + public static function voteDataProvider(): iterable { return [ // Only matches admin eZ function diff --git a/tests/lib/Security/Role/RoleHierarchyTest.php b/tests/lib/Security/Role/RoleHierarchyTest.php index fcdcdcd3..5e658f69 100644 --- a/tests/lib/Security/Role/RoleHierarchyTest.php +++ b/tests/lib/Security/Role/RoleHierarchyTest.php @@ -81,7 +81,7 @@ public function testGetReachableRoleNames(string $startingRole, array $expectedR } } - public static function getReachableRolesDataProvider(): array + public static function getReachableRolesDataProvider(): iterable { return [ [ diff --git a/tests/lib/Validator/ContentTypeValidatorTest.php b/tests/lib/Validator/ContentTypeValidatorTest.php index 935c1263..4138241c 100644 --- a/tests/lib/Validator/ContentTypeValidatorTest.php +++ b/tests/lib/Validator/ContentTypeValidatorTest.php @@ -118,7 +118,7 @@ public function testValidateThrowsUnexpectedTypeExceptionWithInvalidValue(): voi $this->assertValid(true, 42); } - public static function validateDataProvider(): array + public static function validateDataProvider(): iterable { return [ ['article', ['group1'], [], true], diff --git a/tests/lib/Validator/ObjectStateValidatorTest.php b/tests/lib/Validator/ObjectStateValidatorTest.php index 6f3fa69b..9d0c7b88 100644 --- a/tests/lib/Validator/ObjectStateValidatorTest.php +++ b/tests/lib/Validator/ObjectStateValidatorTest.php @@ -142,7 +142,7 @@ public function testValidateThrowsUnexpectedTypeExceptionWithInvalidValueFormat( $this->assertValid(true, 'state'); } - public static function validateDataProvider(): array + public static function validateDataProvider(): iterable { return [ ['group1|state1', [], true], diff --git a/tests/lib/Validator/SectionValidatorTest.php b/tests/lib/Validator/SectionValidatorTest.php index 1818a7c9..71aaa4c1 100644 --- a/tests/lib/Validator/SectionValidatorTest.php +++ b/tests/lib/Validator/SectionValidatorTest.php @@ -106,7 +106,7 @@ public function testValidateThrowsUnexpectedTypeExceptionWithInvalidValue(): voi $this->assertValid(true, 42); } - public static function validateDataProvider(): array + public static function validateDataProvider(): iterable { return [ ['media', [], true], diff --git a/tests/lib/Validator/SiteAccessGroupValidatorTest.php b/tests/lib/Validator/SiteAccessGroupValidatorTest.php index 8649d906..44ade2c9 100644 --- a/tests/lib/Validator/SiteAccessGroupValidatorTest.php +++ b/tests/lib/Validator/SiteAccessGroupValidatorTest.php @@ -54,7 +54,7 @@ public function testValidateThrowsUnexpectedTypeExceptionWithInvalidValue(): voi $this->assertValid(true, 42); } - public static function validateDataProvider(): array + public static function validateDataProvider(): iterable { return [ ['frontend', true], diff --git a/tests/lib/Validator/SiteAccessValidatorTest.php b/tests/lib/Validator/SiteAccessValidatorTest.php index 75a83ed1..eb27aadb 100644 --- a/tests/lib/Validator/SiteAccessValidatorTest.php +++ b/tests/lib/Validator/SiteAccessValidatorTest.php @@ -54,7 +54,7 @@ public function testValidateThrowsUnexpectedTypeExceptionWithInvalidValue(): voi $this->assertValid(true, 42); } - public static function validateDataProvider(): array + public static function validateDataProvider(): iterable { return [ ['eng', true], From 44b46491a391a3662a2bd9721828a4c6995427bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edi=20Modri=C4=87?= Date: Tue, 12 Sep 2023 16:06:22 +0200 Subject: [PATCH 3/3] Update layouts-core require --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index f2b4cf2f..c7777f30 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ } ], "require": { - "netgen/layouts-core": "~1.4.5", + "netgen/layouts-core": "~1.4.6", "netgen/content-browser-ezplatform": "^1.4", "ezsystems/ezplatform-admin-ui": "^1.5 || ^2.3", "ezsystems/ezplatform-http-cache": "^1.0 || ^2.3"