From 11de213bcb32908d64671b3c7248921adc2b0a65 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Tue, 11 Feb 2025 21:13:59 +0100 Subject: [PATCH 01/10] Use PHPStan 2 --- composer.json | 8 +- phpstan-baseline.neon | 308 ++++++++++++++++++++++++++++++++++++++---- 2 files changed, 283 insertions(+), 33 deletions(-) diff --git a/composer.json b/composer.json index fb14e14..0d4f6fb 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ "symfony/cache": "^7.0", "symfony/cache-contracts": "^3.5", "symfony/http-client": "^6.0 || ^7.0", - "thecodingmachine/safe": "^2.0", + "thecodingmachine/safe": "^3.0", "webmozart/assert": "^1.11" }, "require-dev": { @@ -34,10 +34,10 @@ "ergebnis/php-cs-fixer-config": "^6.28", "ergebnis/test-util": "^1.5", "phpstan/extension-installer": "^1.0", - "phpstan/phpstan": "^1.0", - "phpstan/phpstan-webmozart-assert": "^1.0", + "phpstan/phpstan": "^2.0", + "phpstan/phpstan-webmozart-assert": "^2.0", "phpunit/phpunit": "^9.0", - "thecodingmachine/phpstan-safe-rule": "^1.0" + "thecodingmachine/phpstan-safe-rule": "^1.4" }, "config": { "sort-packages": true, diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 763d0bc..2fb1bf6 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,82 +1,332 @@ parameters: ignoreErrors: - - message: "#^Method Storyblok\\\\Api\\\\Bridge\\\\Faker\\\\Provider\\\\StoryblokProvider\\:\\:assetResponse\\(\\) should return array\\{asset\\: array\\{filename\\: string, created_at\\: string, updated_at\\: string, expire_at\\: string\\|null, content_length\\: int, signed_url\\: string, content_type\\: string\\}\\} but returns array\\.$#" + message: '#^Class Storyblok\\Api\\Bridge\\Faker\\Generator has PHPDoc tag @method for method assetResponse\(\) parameter \#1 \$overrides with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue count: 1 - path: src/Bridge/Faker/Provider/StoryblokProvider.php + path: src/Bridge/Faker/Generator.php - - message: "#^Method Storyblok\\\\Api\\\\Bridge\\\\Faker\\\\Provider\\\\StoryblokProvider\\:\\:datasourceDimensionResponse\\(\\) should return array\\{id\\: int, name\\: string, entry_value\\: string, datasource_id\\: int, created_at\\: string, updated_at\\: string\\} but returns array\\.$#" + message: '#^Class Storyblok\\Api\\Bridge\\Faker\\Generator has PHPDoc tag @method for method assetResponse\(\) return type with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue count: 1 - path: src/Bridge/Faker/Provider/StoryblokProvider.php + path: src/Bridge/Faker/Generator.php - - message: "#^Method Storyblok\\\\Api\\\\Bridge\\\\Faker\\\\Provider\\\\StoryblokProvider\\:\\:datasourceEntriesResponse\\(\\) should return array\\{datasource_entries\\: array\\\\} but returns array\\.$#" + message: '#^Class Storyblok\\Api\\Bridge\\Faker\\Generator has PHPDoc tag @method for method datasourceDimensionResponse\(\) parameter \#1 \$overrides with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue count: 1 - path: src/Bridge/Faker/Provider/StoryblokProvider.php + path: src/Bridge/Faker/Generator.php - - message: "#^Method Storyblok\\\\Api\\\\Bridge\\\\Faker\\\\Provider\\\\StoryblokProvider\\:\\:datasourceEntryResponse\\(\\) should return array\\{id\\: int, name\\: string, value\\: string, dimension_value\\: string\\|null\\} but returns array\\.$#" + message: '#^Class Storyblok\\Api\\Bridge\\Faker\\Generator has PHPDoc tag @method for method datasourceDimensionResponse\(\) return type with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue count: 1 - path: src/Bridge/Faker/Provider/StoryblokProvider.php + path: src/Bridge/Faker/Generator.php - - message: "#^Method Storyblok\\\\Api\\\\Bridge\\\\Faker\\\\Provider\\\\StoryblokProvider\\:\\:datasourceResponse\\(\\) should return array\\{id\\: int, name\\: string, slug\\: string, dimensions\\: array\\\\} but returns array\\.$#" + message: '#^Class Storyblok\\Api\\Bridge\\Faker\\Generator has PHPDoc tag @method for method datasourceEntriesResponse\(\) parameter \#1 \$overrides with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue count: 1 - path: src/Bridge/Faker/Provider/StoryblokProvider.php + path: src/Bridge/Faker/Generator.php - - message: "#^Method Storyblok\\\\Api\\\\Bridge\\\\Faker\\\\Provider\\\\StoryblokProvider\\:\\:datasourcesResponse\\(\\) should return array\\{datasources\\: array\\\\>\\} but returns array\\.$#" + message: '#^Class Storyblok\\Api\\Bridge\\Faker\\Generator has PHPDoc tag @method for method datasourceEntriesResponse\(\) return type with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue count: 1 - path: src/Bridge/Faker/Provider/StoryblokProvider.php + path: src/Bridge/Faker/Generator.php - - message: "#^Method Storyblok\\\\Api\\\\Bridge\\\\Faker\\\\Provider\\\\StoryblokProvider\\:\\:linkAlternateResponse\\(\\) should return array\\{lang\\: string, name\\: string, path\\: string, published\\: bool, translated_slug\\: string\\} but returns array\\.$#" + message: '#^Class Storyblok\\Api\\Bridge\\Faker\\Generator has PHPDoc tag @method for method datasourceEntryResponse\(\) parameter \#1 \$overrides with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue count: 1 - path: src/Bridge/Faker/Provider/StoryblokProvider.php + path: src/Bridge/Faker/Generator.php - - message: "#^Method Storyblok\\\\Api\\\\Bridge\\\\Faker\\\\Provider\\\\StoryblokProvider\\:\\:linkResponse\\(\\) should return array\\{uuid\\: string, id\\: int, parent_id\\: int\\|null, name\\: string, slug\\: string, path\\: string, real_path\\: string, is_folder\\: bool, \\.\\.\\.\\} but returns array\\.$#" + message: '#^Class Storyblok\\Api\\Bridge\\Faker\\Generator has PHPDoc tag @method for method datasourceEntryResponse\(\) return type with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue count: 1 - path: src/Bridge/Faker/Provider/StoryblokProvider.php + path: src/Bridge/Faker/Generator.php - - message: "#^Method Storyblok\\\\Api\\\\Bridge\\\\Faker\\\\Provider\\\\StoryblokProvider\\:\\:linksResponse\\(\\) should return array\\{links\\: array\\\\>\\} but returns array\\.$#" + message: '#^Class Storyblok\\Api\\Bridge\\Faker\\Generator has PHPDoc tag @method for method datasourceResponse\(\) parameter \#1 \$overrides with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue count: 1 - path: src/Bridge/Faker/Provider/StoryblokProvider.php + path: src/Bridge/Faker/Generator.php - - message: "#^Method Storyblok\\\\Api\\\\Bridge\\\\Faker\\\\Provider\\\\StoryblokProvider\\:\\:spaceResponse\\(\\) should return array\\{id\\: int, name\\: string, domain\\: string, version\\: int, language_codes\\: array\\\\} but returns array\\.$#" + message: '#^Class Storyblok\\Api\\Bridge\\Faker\\Generator has PHPDoc tag @method for method datasourceResponse\(\) return type with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue count: 1 - path: src/Bridge/Faker/Provider/StoryblokProvider.php + path: src/Bridge/Faker/Generator.php - - message: "#^Method Storyblok\\\\Api\\\\Bridge\\\\Faker\\\\Provider\\\\StoryblokProvider\\:\\:storiesResponse\\(\\) should return array\\{cv\\: int, stories\\: array\\\\>, links\\: array\\, rels\\: array\\\\} but returns array\\.$#" + message: '#^Class Storyblok\\Api\\Bridge\\Faker\\Generator has PHPDoc tag @method for method datasourcesResponse\(\) parameter \#1 \$overrides with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue count: 1 - path: src/Bridge/Faker/Provider/StoryblokProvider.php + path: src/Bridge/Faker/Generator.php - - message: "#^Method Storyblok\\\\Api\\\\Bridge\\\\Faker\\\\Provider\\\\StoryblokProvider\\:\\:storyResponse\\(\\) should return array\\{cv\\: int, story\\: array\\, links\\: array\\, rels\\: array\\\\} but returns array\\.$#" + message: '#^Class Storyblok\\Api\\Bridge\\Faker\\Generator has PHPDoc tag @method for method datasourcesResponse\(\) return type with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue count: 1 - path: src/Bridge/Faker/Provider/StoryblokProvider.php + path: src/Bridge/Faker/Generator.php - - message: "#^Method Storyblok\\\\Api\\\\Bridge\\\\Faker\\\\Provider\\\\StoryblokProvider\\:\\:tagsResponse\\(\\) should return array\\{tags\\: array\\\\} but returns array\\.$#" + message: '#^Class Storyblok\\Api\\Bridge\\Faker\\Generator has PHPDoc tag @method for method linkAlternateResponse\(\) parameter \#1 \$overrides with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue count: 1 - path: src/Bridge/Faker/Provider/StoryblokProvider.php + path: src/Bridge/Faker/Generator.php - - message: "#^Method Storyblok\\\\Api\\\\Domain\\\\Value\\\\Filter\\\\FilterCollection\\:\\:toArray\\(\\) return type has no value type specified in iterable type array\\.$#" + message: '#^Class Storyblok\\Api\\Bridge\\Faker\\Generator has PHPDoc tag @method for method linkAlternateResponse\(\) return type with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: src/Bridge/Faker/Generator.php + + - + message: '#^Class Storyblok\\Api\\Bridge\\Faker\\Generator has PHPDoc tag @method for method linkResponse\(\) parameter \#1 \$overrides with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: src/Bridge/Faker/Generator.php + + - + message: '#^Class Storyblok\\Api\\Bridge\\Faker\\Generator has PHPDoc tag @method for method linkResponse\(\) return type with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: src/Bridge/Faker/Generator.php + + - + message: '#^Class Storyblok\\Api\\Bridge\\Faker\\Generator has PHPDoc tag @method for method linksResponse\(\) parameter \#1 \$overrides with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: src/Bridge/Faker/Generator.php + + - + message: '#^Class Storyblok\\Api\\Bridge\\Faker\\Generator has PHPDoc tag @method for method linksResponse\(\) return type with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: src/Bridge/Faker/Generator.php + + - + message: '#^Class Storyblok\\Api\\Bridge\\Faker\\Generator has PHPDoc tag @method for method spaceResponse\(\) parameter \#1 \$overrides with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: src/Bridge/Faker/Generator.php + + - + message: '#^Class Storyblok\\Api\\Bridge\\Faker\\Generator has PHPDoc tag @method for method spaceResponse\(\) return type with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: src/Bridge/Faker/Generator.php + + - + message: '#^Class Storyblok\\Api\\Bridge\\Faker\\Generator has PHPDoc tag @method for method storiesResponse\(\) parameter \#1 \$overrides with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: src/Bridge/Faker/Generator.php + + - + message: '#^Class Storyblok\\Api\\Bridge\\Faker\\Generator has PHPDoc tag @method for method storiesResponse\(\) return type with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: src/Bridge/Faker/Generator.php + + - + message: '#^Class Storyblok\\Api\\Bridge\\Faker\\Generator has PHPDoc tag @method for method storyResponse\(\) parameter \#1 \$overrides with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: src/Bridge/Faker/Generator.php + + - + message: '#^Class Storyblok\\Api\\Bridge\\Faker\\Generator has PHPDoc tag @method for method storyResponse\(\) return type with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: src/Bridge/Faker/Generator.php + + - + message: '#^Class Storyblok\\Api\\Bridge\\Faker\\Generator has PHPDoc tag @method for method tagsResponse\(\) parameter \#1 \$overrides with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: src/Bridge/Faker/Generator.php + + - + message: '#^Class Storyblok\\Api\\Bridge\\Faker\\Generator has PHPDoc tag @method for method tagsResponse\(\) return type with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: src/Bridge/Faker/Generator.php + + - + message: '#^Parameter \#1 \$headers of static method Storyblok\\Api\\Domain\\Value\\Total\:\:fromHeaders\(\) expects array\\>, array\\> given\.$#' + identifier: argument.type + count: 4 + path: src/DatasourceEntriesApi.php + + - + message: '#^Parameter \#1 \$headers of static method Storyblok\\Api\\Domain\\Value\\Total\:\:fromHeaders\(\) expects array\\>, array\\> given\.$#' + identifier: argument.type + count: 1 + path: src/DatasourcesApi.php + + - + message: '#^Property Storyblok\\Api\\Domain\\Value\\Datasource\:\:\$dimensions \(list\\) does not accept array\\.$#' + identifier: assign.propertyType + count: 1 + path: src/Domain/Value/Datasource.php + + - + message: '#^Call to static method Webmozart\\Assert\\Assert\:\:notSame\(\) with int\<1, max\> and 0 will always evaluate to true\.$#' + identifier: staticMethod.alreadyNarrowedType + count: 1 + path: src/Domain/Value/Dto/Pagination.php + + - + message: '#^Property Storyblok\\Api\\Domain\\Value\\Field\\FieldCollection\:\:\$items \(list\\) does not accept array\, Storyblok\\Api\\Domain\\Value\\Field\\Field\>\.$#' + identifier: assign.propertyType + count: 1 + path: src/Domain/Value/Field/FieldCollection.php + + - + message: '#^Method Storyblok\\Api\\Domain\\Value\\Filter\\FilterCollection\:\:toArray\(\) return type has no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: src/Domain/Value/Filter/FilterCollection.php + + - + message: '#^PHPDoc tag @return contains unresolvable type\.$#' + identifier: return.unresolvableType count: 1 path: src/Domain/Value/Filter/FilterCollection.php - - message: "#^PHPDoc tag @return contains unresolvable type\\.$#" + message: '#^Property Storyblok\\Api\\Domain\\Value\\Filter\\FilterCollection\:\:\$items \(list\\) does not accept array\, Storyblok\\Api\\Domain\\Value\\Filter\\Filters\\Filter\>\.$#' + identifier: assign.propertyType count: 1 path: src/Domain/Value/Filter/FilterCollection.php - - message: "#^Cannot call method format\\(\\) on DateTimeImmutable\\|null\\.$#" + message: '#^Call to static method Webmozart\\Assert\\Assert\:\:allString\(\) with non\-empty\-array\ will always evaluate to true\.$#' + identifier: staticMethod.alreadyNarrowedType + count: 1 + path: src/Domain/Value/Filter/Filters/AllInArrayFilter.php + + - + message: '#^Call to static method Webmozart\\Assert\\Assert\:\:allString\(\) with non\-empty\-array\ will always evaluate to true\.$#' + identifier: staticMethod.alreadyNarrowedType + count: 1 + path: src/Domain/Value/Filter/Filters/AnyInArrayFilter.php + + - + message: '#^Call to static method Webmozart\\Assert\\Assert\:\:allString\(\) with non\-empty\-array\ will always evaluate to true\.$#' + identifier: staticMethod.alreadyNarrowedType + count: 1 + path: src/Domain/Value/Filter/Filters/InFilter.php + + - + message: '#^Call to static method Webmozart\\Assert\\Assert\:\:allString\(\) with non\-empty\-array\ will always evaluate to true\.$#' + identifier: staticMethod.alreadyNarrowedType + count: 1 + path: src/Domain/Value/Filter/Filters/NotInFilter.php + + - + message: '#^Property Storyblok\\Api\\Domain\\Value\\IdCollection\:\:\$items \(list\\) does not accept array\, Storyblok\\Api\\Domain\\Value\\Id\>\.$#' + identifier: assign.propertyType + count: 1 + path: src/Domain/Value/IdCollection.php + + - + message: '#^PHPDoc tag @var has invalid value \(list\1\)\: Unexpected token "1", expected TOKEN_HORIZONTAL_WS at offset 35 on line 2$#' + identifier: phpDoc.parseError + count: 1 + path: src/Domain/Value/Link.php + + - + message: '#^Property Storyblok\\Api\\Domain\\Value\\Link\:\:\$alternates type has no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: src/Domain/Value/Link.php + + - + message: '#^Property Storyblok\\Api\\Domain\\Value\\Resolver\\RelationCollection\:\:\$items \(list\\) does not accept array\, Storyblok\\Api\\Domain\\Value\\Resolver\\Relation\>\.$#' + identifier: assign.propertyType + count: 1 + path: src/Domain/Value/Resolver/RelationCollection.php + + - + message: '#^Property Storyblok\\Api\\Domain\\Value\\Tag\\TagCollection\:\:\$items \(list\\) does not accept array\, Storyblok\\Api\\Domain\\Value\\Tag\\Tag\>\.$#' + identifier: assign.propertyType + count: 1 + path: src/Domain/Value/Tag/TagCollection.php + + - + message: '#^Parameter \#1 \$headers of static method Storyblok\\Api\\Domain\\Value\\Total\:\:fromHeaders\(\) expects array\\>, array\\> given\.$#' + identifier: argument.type + count: 3 + path: src/LinksApi.php + + - + message: '#^Method Storyblok\\Api\\Request\\StoriesRequest\:\:toArray\(\) should return array\{language\: string, page\: int, per_page\: int, sort_by\?\: string, filter_query\?\: list\, with_tag\?\: string, excluding_fields\?\: string, excluding_ids\?\: string, \.\.\.\} but returns array\{language\: string, page\: int, per_page\: int, sort_by\?\: string, filter_query\?\: array, with_tag\?\: string, excluding_fields\?\: string, excluding_ids\?\: string, \.\.\.\}\.$#' + identifier: return.type + count: 1 + path: src/Request/StoriesRequest.php + + - + message: '#^Property Storyblok\\Api\\Response\\DatasourceEntriesResponse\:\:\$datasourceEntries \(list\\) does not accept array\\.$#' + identifier: assign.propertyType + count: 1 + path: src/Response/DatasourceEntriesResponse.php + + - + message: '#^Property Storyblok\\Api\\Response\\DatasourcesResponse\:\:\$datasources \(list\\) does not accept array\\.$#' + identifier: assign.propertyType + count: 1 + path: src/Response/DatasourcesResponse.php + + - + message: '#^Property Storyblok\\Api\\Response\\TagsResponse\:\:\$tags \(list\\) does not accept array\\.$#' + identifier: assign.propertyType + count: 1 + path: src/Response/TagsResponse.php + + - + message: '#^Parameter \#1 \$headers of static method Storyblok\\Api\\Domain\\Value\\Total\:\:fromHeaders\(\) expects array\\>, array\\> given\.$#' + identifier: argument.type + count: 2 + path: src/StoriesApi.php + + - + message: '#^Cannot call method format\(\) on DateTimeImmutable\|null\.$#' + identifier: method.nonObject count: 1 path: tests/Unit/Domain/Value/AssetTest.php + - + message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertEmpty\(\) with Storyblok\\Api\\Domain\\Value\\Field\\FieldCollection will always evaluate to false\.$#' + identifier: staticMethod.impossibleType + count: 2 + path: tests/Unit/Domain/Value/Field/FieldCollectionTest.php + + - + message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertEmpty\(\) with Storyblok\\Api\\Domain\\Value\\Filter\\FilterCollection will always evaluate to false\.$#' + identifier: staticMethod.impossibleType + count: 2 + path: tests/Unit/Domain/Value/Filter/FilterCollectionTest.php + + - + message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertEmpty\(\) with Storyblok\\Api\\Domain\\Value\\IdCollection will always evaluate to false\.$#' + identifier: staticMethod.impossibleType + count: 2 + path: tests/Unit/Domain/Value/IdCollectionTest.php + + - + message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertEmpty\(\) with Storyblok\\Api\\Domain\\Value\\Resolver\\RelationCollection will always evaluate to false\.$#' + identifier: staticMethod.impossibleType + count: 2 + path: tests/Unit/Domain/Value/Resolver/RelationCollectionTest.php + + - + message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertEmpty\(\) with Storyblok\\Api\\Domain\\Value\\Tag\\TagCollection will always evaluate to false\.$#' + identifier: staticMethod.impossibleType + count: 2 + path: tests/Unit/Domain/Value/Tag/TagCollectionTest.php + From bb1bba43c2e90b5551efeda3525b1b1e4108903c Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Tue, 11 Feb 2025 21:14:54 +0100 Subject: [PATCH 02/10] - --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 0d4f6fb..b2c780f 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ "symfony/cache": "^7.0", "symfony/cache-contracts": "^3.5", "symfony/http-client": "^6.0 || ^7.0", - "thecodingmachine/safe": "^3.0", + "thecodingmachine/safe": "^2.0", "webmozart/assert": "^1.11" }, "require-dev": { From 030016d5edf42cafdec1422a78b484b8d06e565a Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Tue, 11 Feb 2025 21:15:18 +0100 Subject: [PATCH 03/10] - --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index b2c780f..49c55ed 100644 --- a/composer.json +++ b/composer.json @@ -37,7 +37,7 @@ "phpstan/phpstan": "^2.0", "phpstan/phpstan-webmozart-assert": "^2.0", "phpunit/phpunit": "^9.0", - "thecodingmachine/phpstan-safe-rule": "^1.4" + "thecodingmachine/phpstan-safe-rule": "^1.2" }, "config": { "sort-packages": true, From 7cce885bf8eaa9b9760b3fb585dd238a0b07b23f Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Tue, 11 Feb 2025 21:15:58 +0100 Subject: [PATCH 04/10] - --- phpstan-baseline.neon | 78 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 2fb1bf6..5641b0c 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -156,6 +156,84 @@ parameters: count: 1 path: src/Bridge/Faker/Generator.php + - + message: '#^Method Storyblok\\Api\\Bridge\\Faker\\Provider\\StoryblokProvider\:\:assetResponse\(\) should return array\{asset\: array\{filename\: string, created_at\: string, updated_at\: string, expire_at\: string\|null, content_length\: int, signed_url\: string, content_type\: string\}\} but returns array\.$#' + identifier: return.type + count: 1 + path: src/Bridge/Faker/Provider/StoryblokProvider.php + + - + message: '#^Method Storyblok\\Api\\Bridge\\Faker\\Provider\\StoryblokProvider\:\:datasourceDimensionResponse\(\) should return array\{id\: int, name\: string, entry_value\: string, datasource_id\: int, created_at\: string, updated_at\: string\} but returns array\.$#' + identifier: return.type + count: 1 + path: src/Bridge/Faker/Provider/StoryblokProvider.php + + - + message: '#^Method Storyblok\\Api\\Bridge\\Faker\\Provider\\StoryblokProvider\:\:datasourceEntriesResponse\(\) should return array\{datasource_entries\: list\\} but returns array\.$#' + identifier: return.type + count: 1 + path: src/Bridge/Faker/Provider/StoryblokProvider.php + + - + message: '#^Method Storyblok\\Api\\Bridge\\Faker\\Provider\\StoryblokProvider\:\:datasourceEntryResponse\(\) should return array\{id\: int, name\: string, value\: string, dimension_value\: string\|null\} but returns array\.$#' + identifier: return.type + count: 1 + path: src/Bridge/Faker/Provider/StoryblokProvider.php + + - + message: '#^Method Storyblok\\Api\\Bridge\\Faker\\Provider\\StoryblokProvider\:\:datasourceResponse\(\) should return array\{id\: int, name\: string, slug\: string, dimensions\: list\\} but returns array\.$#' + identifier: return.type + count: 1 + path: src/Bridge/Faker/Provider/StoryblokProvider.php + + - + message: '#^Method Storyblok\\Api\\Bridge\\Faker\\Provider\\StoryblokProvider\:\:datasourcesResponse\(\) should return array\{datasources\: list\\>\} but returns array\.$#' + identifier: return.type + count: 1 + path: src/Bridge/Faker/Provider/StoryblokProvider.php + + - + message: '#^Method Storyblok\\Api\\Bridge\\Faker\\Provider\\StoryblokProvider\:\:linkAlternateResponse\(\) should return array\{lang\: string, name\: string, path\: string, published\: bool, translated_slug\: string\} but returns array\.$#' + identifier: return.type + count: 1 + path: src/Bridge/Faker/Provider/StoryblokProvider.php + + - + message: '#^Method Storyblok\\Api\\Bridge\\Faker\\Provider\\StoryblokProvider\:\:linkResponse\(\) should return array\{uuid\: string, id\: int, parent_id\: int\|null, name\: string, slug\: string, path\: string, real_path\: string, is_folder\: bool, \.\.\.\} but returns array\.$#' + identifier: return.type + count: 1 + path: src/Bridge/Faker/Provider/StoryblokProvider.php + + - + message: '#^Method Storyblok\\Api\\Bridge\\Faker\\Provider\\StoryblokProvider\:\:linksResponse\(\) should return array\{links\: list\\>\} but returns array\.$#' + identifier: return.type + count: 1 + path: src/Bridge/Faker/Provider/StoryblokProvider.php + + - + message: '#^Method Storyblok\\Api\\Bridge\\Faker\\Provider\\StoryblokProvider\:\:spaceResponse\(\) should return array\{id\: int, name\: string, domain\: string, version\: int, language_codes\: list\\} but returns array\.$#' + identifier: return.type + count: 1 + path: src/Bridge/Faker/Provider/StoryblokProvider.php + + - + message: '#^Method Storyblok\\Api\\Bridge\\Faker\\Provider\\StoryblokProvider\:\:storiesResponse\(\) should return array\{cv\: int, stories\: list\\>, links\: array\, rels\: array\\} but returns array\.$#' + identifier: return.type + count: 1 + path: src/Bridge/Faker/Provider/StoryblokProvider.php + + - + message: '#^Method Storyblok\\Api\\Bridge\\Faker\\Provider\\StoryblokProvider\:\:storyResponse\(\) should return array\{cv\: int, story\: array\, links\: array\, rels\: array\\} but returns array\.$#' + identifier: return.type + count: 1 + path: src/Bridge/Faker/Provider/StoryblokProvider.php + + - + message: '#^Method Storyblok\\Api\\Bridge\\Faker\\Provider\\StoryblokProvider\:\:tagsResponse\(\) should return array\{tags\: list\\} but returns array\.$#' + identifier: return.type + count: 1 + path: src/Bridge/Faker/Provider/StoryblokProvider.php + - message: '#^Parameter \#1 \$headers of static method Storyblok\\Api\\Domain\\Value\\Total\:\:fromHeaders\(\) expects array\\>, array\\> given\.$#' identifier: argument.type From eb8dd4f10578785bd03e03459c7fe375cee19423 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Wed, 12 Feb 2025 08:28:43 +0100 Subject: [PATCH 05/10] Allow `thecodingmachine/safe` 3 (#18) --- composer.json | 4 +-- phpstan-baseline.neon | 78 ------------------------------------------- 2 files changed, 2 insertions(+), 80 deletions(-) diff --git a/composer.json b/composer.json index 49c55ed..87c25ab 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ "symfony/cache": "^7.0", "symfony/cache-contracts": "^3.5", "symfony/http-client": "^6.0 || ^7.0", - "thecodingmachine/safe": "^2.0", + "thecodingmachine/safe": "^2.0 || ^3.0", "webmozart/assert": "^1.11" }, "require-dev": { @@ -37,7 +37,7 @@ "phpstan/phpstan": "^2.0", "phpstan/phpstan-webmozart-assert": "^2.0", "phpunit/phpunit": "^9.0", - "thecodingmachine/phpstan-safe-rule": "^1.2" + "thecodingmachine/phpstan-safe-rule": "^1.4" }, "config": { "sort-packages": true, diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 5641b0c..2fb1bf6 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -156,84 +156,6 @@ parameters: count: 1 path: src/Bridge/Faker/Generator.php - - - message: '#^Method Storyblok\\Api\\Bridge\\Faker\\Provider\\StoryblokProvider\:\:assetResponse\(\) should return array\{asset\: array\{filename\: string, created_at\: string, updated_at\: string, expire_at\: string\|null, content_length\: int, signed_url\: string, content_type\: string\}\} but returns array\.$#' - identifier: return.type - count: 1 - path: src/Bridge/Faker/Provider/StoryblokProvider.php - - - - message: '#^Method Storyblok\\Api\\Bridge\\Faker\\Provider\\StoryblokProvider\:\:datasourceDimensionResponse\(\) should return array\{id\: int, name\: string, entry_value\: string, datasource_id\: int, created_at\: string, updated_at\: string\} but returns array\.$#' - identifier: return.type - count: 1 - path: src/Bridge/Faker/Provider/StoryblokProvider.php - - - - message: '#^Method Storyblok\\Api\\Bridge\\Faker\\Provider\\StoryblokProvider\:\:datasourceEntriesResponse\(\) should return array\{datasource_entries\: list\\} but returns array\.$#' - identifier: return.type - count: 1 - path: src/Bridge/Faker/Provider/StoryblokProvider.php - - - - message: '#^Method Storyblok\\Api\\Bridge\\Faker\\Provider\\StoryblokProvider\:\:datasourceEntryResponse\(\) should return array\{id\: int, name\: string, value\: string, dimension_value\: string\|null\} but returns array\.$#' - identifier: return.type - count: 1 - path: src/Bridge/Faker/Provider/StoryblokProvider.php - - - - message: '#^Method Storyblok\\Api\\Bridge\\Faker\\Provider\\StoryblokProvider\:\:datasourceResponse\(\) should return array\{id\: int, name\: string, slug\: string, dimensions\: list\\} but returns array\.$#' - identifier: return.type - count: 1 - path: src/Bridge/Faker/Provider/StoryblokProvider.php - - - - message: '#^Method Storyblok\\Api\\Bridge\\Faker\\Provider\\StoryblokProvider\:\:datasourcesResponse\(\) should return array\{datasources\: list\\>\} but returns array\.$#' - identifier: return.type - count: 1 - path: src/Bridge/Faker/Provider/StoryblokProvider.php - - - - message: '#^Method Storyblok\\Api\\Bridge\\Faker\\Provider\\StoryblokProvider\:\:linkAlternateResponse\(\) should return array\{lang\: string, name\: string, path\: string, published\: bool, translated_slug\: string\} but returns array\.$#' - identifier: return.type - count: 1 - path: src/Bridge/Faker/Provider/StoryblokProvider.php - - - - message: '#^Method Storyblok\\Api\\Bridge\\Faker\\Provider\\StoryblokProvider\:\:linkResponse\(\) should return array\{uuid\: string, id\: int, parent_id\: int\|null, name\: string, slug\: string, path\: string, real_path\: string, is_folder\: bool, \.\.\.\} but returns array\.$#' - identifier: return.type - count: 1 - path: src/Bridge/Faker/Provider/StoryblokProvider.php - - - - message: '#^Method Storyblok\\Api\\Bridge\\Faker\\Provider\\StoryblokProvider\:\:linksResponse\(\) should return array\{links\: list\\>\} but returns array\.$#' - identifier: return.type - count: 1 - path: src/Bridge/Faker/Provider/StoryblokProvider.php - - - - message: '#^Method Storyblok\\Api\\Bridge\\Faker\\Provider\\StoryblokProvider\:\:spaceResponse\(\) should return array\{id\: int, name\: string, domain\: string, version\: int, language_codes\: list\\} but returns array\.$#' - identifier: return.type - count: 1 - path: src/Bridge/Faker/Provider/StoryblokProvider.php - - - - message: '#^Method Storyblok\\Api\\Bridge\\Faker\\Provider\\StoryblokProvider\:\:storiesResponse\(\) should return array\{cv\: int, stories\: list\\>, links\: array\, rels\: array\\} but returns array\.$#' - identifier: return.type - count: 1 - path: src/Bridge/Faker/Provider/StoryblokProvider.php - - - - message: '#^Method Storyblok\\Api\\Bridge\\Faker\\Provider\\StoryblokProvider\:\:storyResponse\(\) should return array\{cv\: int, story\: array\, links\: array\, rels\: array\\} but returns array\.$#' - identifier: return.type - count: 1 - path: src/Bridge/Faker/Provider/StoryblokProvider.php - - - - message: '#^Method Storyblok\\Api\\Bridge\\Faker\\Provider\\StoryblokProvider\:\:tagsResponse\(\) should return array\{tags\: list\\} but returns array\.$#' - identifier: return.type - count: 1 - path: src/Bridge/Faker/Provider/StoryblokProvider.php - - message: '#^Parameter \#1 \$headers of static method Storyblok\\Api\\Domain\\Value\\Total\:\:fromHeaders\(\) expects array\\>, array\\> given\.$#' identifier: argument.type From a0b5ac24fa05350973acd32c0a062a0349a00af9 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Wed, 12 Feb 2025 11:51:03 +0100 Subject: [PATCH 06/10] - --- phpstan-baseline.neon | 168 ------------------------------------------ phpstan.neon.dist | 3 + 2 files changed, 3 insertions(+), 168 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 2fb1bf6..195bedc 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,161 +1,5 @@ parameters: ignoreErrors: - - - message: '#^Class Storyblok\\Api\\Bridge\\Faker\\Generator has PHPDoc tag @method for method assetResponse\(\) parameter \#1 \$overrides with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/Bridge/Faker/Generator.php - - - - message: '#^Class Storyblok\\Api\\Bridge\\Faker\\Generator has PHPDoc tag @method for method assetResponse\(\) return type with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/Bridge/Faker/Generator.php - - - - message: '#^Class Storyblok\\Api\\Bridge\\Faker\\Generator has PHPDoc tag @method for method datasourceDimensionResponse\(\) parameter \#1 \$overrides with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/Bridge/Faker/Generator.php - - - - message: '#^Class Storyblok\\Api\\Bridge\\Faker\\Generator has PHPDoc tag @method for method datasourceDimensionResponse\(\) return type with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/Bridge/Faker/Generator.php - - - - message: '#^Class Storyblok\\Api\\Bridge\\Faker\\Generator has PHPDoc tag @method for method datasourceEntriesResponse\(\) parameter \#1 \$overrides with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/Bridge/Faker/Generator.php - - - - message: '#^Class Storyblok\\Api\\Bridge\\Faker\\Generator has PHPDoc tag @method for method datasourceEntriesResponse\(\) return type with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/Bridge/Faker/Generator.php - - - - message: '#^Class Storyblok\\Api\\Bridge\\Faker\\Generator has PHPDoc tag @method for method datasourceEntryResponse\(\) parameter \#1 \$overrides with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/Bridge/Faker/Generator.php - - - - message: '#^Class Storyblok\\Api\\Bridge\\Faker\\Generator has PHPDoc tag @method for method datasourceEntryResponse\(\) return type with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/Bridge/Faker/Generator.php - - - - message: '#^Class Storyblok\\Api\\Bridge\\Faker\\Generator has PHPDoc tag @method for method datasourceResponse\(\) parameter \#1 \$overrides with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/Bridge/Faker/Generator.php - - - - message: '#^Class Storyblok\\Api\\Bridge\\Faker\\Generator has PHPDoc tag @method for method datasourceResponse\(\) return type with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/Bridge/Faker/Generator.php - - - - message: '#^Class Storyblok\\Api\\Bridge\\Faker\\Generator has PHPDoc tag @method for method datasourcesResponse\(\) parameter \#1 \$overrides with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/Bridge/Faker/Generator.php - - - - message: '#^Class Storyblok\\Api\\Bridge\\Faker\\Generator has PHPDoc tag @method for method datasourcesResponse\(\) return type with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/Bridge/Faker/Generator.php - - - - message: '#^Class Storyblok\\Api\\Bridge\\Faker\\Generator has PHPDoc tag @method for method linkAlternateResponse\(\) parameter \#1 \$overrides with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/Bridge/Faker/Generator.php - - - - message: '#^Class Storyblok\\Api\\Bridge\\Faker\\Generator has PHPDoc tag @method for method linkAlternateResponse\(\) return type with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/Bridge/Faker/Generator.php - - - - message: '#^Class Storyblok\\Api\\Bridge\\Faker\\Generator has PHPDoc tag @method for method linkResponse\(\) parameter \#1 \$overrides with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/Bridge/Faker/Generator.php - - - - message: '#^Class Storyblok\\Api\\Bridge\\Faker\\Generator has PHPDoc tag @method for method linkResponse\(\) return type with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/Bridge/Faker/Generator.php - - - - message: '#^Class Storyblok\\Api\\Bridge\\Faker\\Generator has PHPDoc tag @method for method linksResponse\(\) parameter \#1 \$overrides with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/Bridge/Faker/Generator.php - - - - message: '#^Class Storyblok\\Api\\Bridge\\Faker\\Generator has PHPDoc tag @method for method linksResponse\(\) return type with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/Bridge/Faker/Generator.php - - - - message: '#^Class Storyblok\\Api\\Bridge\\Faker\\Generator has PHPDoc tag @method for method spaceResponse\(\) parameter \#1 \$overrides with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/Bridge/Faker/Generator.php - - - - message: '#^Class Storyblok\\Api\\Bridge\\Faker\\Generator has PHPDoc tag @method for method spaceResponse\(\) return type with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/Bridge/Faker/Generator.php - - - - message: '#^Class Storyblok\\Api\\Bridge\\Faker\\Generator has PHPDoc tag @method for method storiesResponse\(\) parameter \#1 \$overrides with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/Bridge/Faker/Generator.php - - - - message: '#^Class Storyblok\\Api\\Bridge\\Faker\\Generator has PHPDoc tag @method for method storiesResponse\(\) return type with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/Bridge/Faker/Generator.php - - - - message: '#^Class Storyblok\\Api\\Bridge\\Faker\\Generator has PHPDoc tag @method for method storyResponse\(\) parameter \#1 \$overrides with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/Bridge/Faker/Generator.php - - - - message: '#^Class Storyblok\\Api\\Bridge\\Faker\\Generator has PHPDoc tag @method for method storyResponse\(\) return type with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/Bridge/Faker/Generator.php - - - - message: '#^Class Storyblok\\Api\\Bridge\\Faker\\Generator has PHPDoc tag @method for method tagsResponse\(\) parameter \#1 \$overrides with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/Bridge/Faker/Generator.php - - - - message: '#^Class Storyblok\\Api\\Bridge\\Faker\\Generator has PHPDoc tag @method for method tagsResponse\(\) return type with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/Bridge/Faker/Generator.php - - message: '#^Parameter \#1 \$headers of static method Storyblok\\Api\\Domain\\Value\\Total\:\:fromHeaders\(\) expects array\\>, array\\> given\.$#' identifier: argument.type @@ -186,12 +30,6 @@ parameters: count: 1 path: src/Domain/Value/Field/FieldCollection.php - - - message: '#^Method Storyblok\\Api\\Domain\\Value\\Filter\\FilterCollection\:\:toArray\(\) return type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/Domain/Value/Filter/FilterCollection.php - - message: '#^PHPDoc tag @return contains unresolvable type\.$#' identifier: return.unresolvableType @@ -240,12 +78,6 @@ parameters: count: 1 path: src/Domain/Value/Link.php - - - message: '#^Property Storyblok\\Api\\Domain\\Value\\Link\:\:\$alternates type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/Domain/Value/Link.php - - message: '#^Property Storyblok\\Api\\Domain\\Value\\Resolver\\RelationCollection\:\:\$items \(list\\) does not accept array\, Storyblok\\Api\\Domain\\Value\\Resolver\\Relation\>\.$#' identifier: assign.propertyType diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 241484d..8d09bd9 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -2,6 +2,9 @@ includes: - phpstan-baseline.neon parameters: + ignoreErrors: + - + identifier: missingType.iterableValue inferPrivatePropertyTypeFromConstructor: true level: 8 paths: From 16f7dbc4b8d7f90acb6cb5ebbd4b3a3a89138791 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Wed, 12 Feb 2025 11:54:15 +0100 Subject: [PATCH 07/10] - --- phpstan-baseline.neon | 30 ------------------------------ phpstan.neon.dist | 2 ++ 2 files changed, 2 insertions(+), 30 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 195bedc..faee37e 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -18,12 +18,6 @@ parameters: count: 1 path: src/Domain/Value/Datasource.php - - - message: '#^Call to static method Webmozart\\Assert\\Assert\:\:notSame\(\) with int\<1, max\> and 0 will always evaluate to true\.$#' - identifier: staticMethod.alreadyNarrowedType - count: 1 - path: src/Domain/Value/Dto/Pagination.php - - message: '#^Property Storyblok\\Api\\Domain\\Value\\Field\\FieldCollection\:\:\$items \(list\\) does not accept array\, Storyblok\\Api\\Domain\\Value\\Field\\Field\>\.$#' identifier: assign.propertyType @@ -42,30 +36,6 @@ parameters: count: 1 path: src/Domain/Value/Filter/FilterCollection.php - - - message: '#^Call to static method Webmozart\\Assert\\Assert\:\:allString\(\) with non\-empty\-array\ will always evaluate to true\.$#' - identifier: staticMethod.alreadyNarrowedType - count: 1 - path: src/Domain/Value/Filter/Filters/AllInArrayFilter.php - - - - message: '#^Call to static method Webmozart\\Assert\\Assert\:\:allString\(\) with non\-empty\-array\ will always evaluate to true\.$#' - identifier: staticMethod.alreadyNarrowedType - count: 1 - path: src/Domain/Value/Filter/Filters/AnyInArrayFilter.php - - - - message: '#^Call to static method Webmozart\\Assert\\Assert\:\:allString\(\) with non\-empty\-array\ will always evaluate to true\.$#' - identifier: staticMethod.alreadyNarrowedType - count: 1 - path: src/Domain/Value/Filter/Filters/InFilter.php - - - - message: '#^Call to static method Webmozart\\Assert\\Assert\:\:allString\(\) with non\-empty\-array\ will always evaluate to true\.$#' - identifier: staticMethod.alreadyNarrowedType - count: 1 - path: src/Domain/Value/Filter/Filters/NotInFilter.php - - message: '#^Property Storyblok\\Api\\Domain\\Value\\IdCollection\:\:\$items \(list\\) does not accept array\, Storyblok\\Api\\Domain\\Value\\Id\>\.$#' identifier: assign.propertyType diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 8d09bd9..d229600 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -5,6 +5,8 @@ parameters: ignoreErrors: - identifier: missingType.iterableValue + - + identifier: staticMethod.alreadyNarrowedType inferPrivatePropertyTypeFromConstructor: true level: 8 paths: From df0ae47c394b8a4f3a501cc53e6a8a21d20bf305 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Wed, 12 Feb 2025 11:54:55 +0100 Subject: [PATCH 08/10] - --- src/Domain/Value/Link.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Domain/Value/Link.php b/src/Domain/Value/Link.php index a6aa708..a59886f 100644 --- a/src/Domain/Value/Link.php +++ b/src/Domain/Value/Link.php @@ -34,7 +34,7 @@ public bool $isPublished; /** - * @var list1 + * @var list */ public array $alternates; From 268ef19f0e15d01f64dc86d9772e094b2cd9354e Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Wed, 12 Feb 2025 14:24:29 +0100 Subject: [PATCH 09/10] - --- src/Domain/Value/Total.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Domain/Value/Total.php b/src/Domain/Value/Total.php index dddc2bb..4beb307 100644 --- a/src/Domain/Value/Total.php +++ b/src/Domain/Value/Total.php @@ -27,7 +27,7 @@ public function __construct( } /** - * @param array> $headers + * @param array> $headers */ public static function fromHeaders(array $headers): self { From 684e3eeb9b2dcd761e1222f7795d8443deb7c77c Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Wed, 12 Feb 2025 14:24:53 +0100 Subject: [PATCH 10/10] - --- phpstan-baseline.neon | 28 ++-------------------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index faee37e..9858206 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,17 +1,5 @@ parameters: ignoreErrors: - - - message: '#^Parameter \#1 \$headers of static method Storyblok\\Api\\Domain\\Value\\Total\:\:fromHeaders\(\) expects array\\>, array\\> given\.$#' - identifier: argument.type - count: 4 - path: src/DatasourceEntriesApi.php - - - - message: '#^Parameter \#1 \$headers of static method Storyblok\\Api\\Domain\\Value\\Total\:\:fromHeaders\(\) expects array\\>, array\\> given\.$#' - identifier: argument.type - count: 1 - path: src/DatasourcesApi.php - - message: '#^Property Storyblok\\Api\\Domain\\Value\\Datasource\:\:\$dimensions \(list\\) does not accept array\\.$#' identifier: assign.propertyType @@ -43,8 +31,8 @@ parameters: path: src/Domain/Value/IdCollection.php - - message: '#^PHPDoc tag @var has invalid value \(list\1\)\: Unexpected token "1", expected TOKEN_HORIZONTAL_WS at offset 35 on line 2$#' - identifier: phpDoc.parseError + message: '#^Property Storyblok\\Api\\Domain\\Value\\Link\:\:\$alternates \(list\\) does not accept array\\.$#' + identifier: assign.propertyType count: 1 path: src/Domain/Value/Link.php @@ -60,12 +48,6 @@ parameters: count: 1 path: src/Domain/Value/Tag/TagCollection.php - - - message: '#^Parameter \#1 \$headers of static method Storyblok\\Api\\Domain\\Value\\Total\:\:fromHeaders\(\) expects array\\>, array\\> given\.$#' - identifier: argument.type - count: 3 - path: src/LinksApi.php - - message: '#^Method Storyblok\\Api\\Request\\StoriesRequest\:\:toArray\(\) should return array\{language\: string, page\: int, per_page\: int, sort_by\?\: string, filter_query\?\: list\, with_tag\?\: string, excluding_fields\?\: string, excluding_ids\?\: string, \.\.\.\} but returns array\{language\: string, page\: int, per_page\: int, sort_by\?\: string, filter_query\?\: array, with_tag\?\: string, excluding_fields\?\: string, excluding_ids\?\: string, \.\.\.\}\.$#' identifier: return.type @@ -90,12 +72,6 @@ parameters: count: 1 path: src/Response/TagsResponse.php - - - message: '#^Parameter \#1 \$headers of static method Storyblok\\Api\\Domain\\Value\\Total\:\:fromHeaders\(\) expects array\\>, array\\> given\.$#' - identifier: argument.type - count: 2 - path: src/StoriesApi.php - - message: '#^Cannot call method format\(\) on DateTimeImmutable\|null\.$#' identifier: method.nonObject