From ed2ed5352951c96fe853f0df723e986e2f25c742 Mon Sep 17 00:00:00 2001 From: Daniel Badura Date: Mon, 30 Dec 2024 19:27:42 +0100 Subject: [PATCH 1/2] Update phpstan to v2 --- composer.json | 2 +- composer.lock | 14 +++---- phpstan-baseline.neon | 89 +++++++++++++++++++++++++++++++++++-------- 3 files changed, 81 insertions(+), 24 deletions(-) diff --git a/composer.json b/composer.json index 4433d3da7..cfbb2a4d3 100644 --- a/composer.json +++ b/composer.json @@ -43,7 +43,7 @@ "patchlevel/event-sourcing-psalm-plugin": "^3.0.0", "phpbench/phpbench": "^1.2.15", "phpspec/prophecy-phpunit": "^2.1.0", - "phpstan/phpstan": "^1.10.49", + "phpstan/phpstan": "^2.0.4", "phpunit/phpunit": "^10.5.2", "psalm/plugin-phpunit": "^0.19.0", "roave/infection-static-analysis-plugin": "^1.34.0", diff --git a/composer.lock b/composer.lock index 35a358fc1..c1e2792ca 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "56954cdc5fba7a7ef15f8e3db1cab367", + "content-hash": "963ca2ed17462b8f909306b07da5f0dd", "packages": [ { "name": "brick/math", @@ -5307,20 +5307,20 @@ }, { "name": "phpstan/phpstan", - "version": "1.12.13", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "9b469068840cfa031e1deaf2fa1886d00e20680f" + "reference": "50d276fc3bf1430ec315f2f109bbde2769821524" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/9b469068840cfa031e1deaf2fa1886d00e20680f", - "reference": "9b469068840cfa031e1deaf2fa1886d00e20680f", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/50d276fc3bf1430ec315f2f109bbde2769821524", + "reference": "50d276fc3bf1430ec315f2f109bbde2769821524", "shasum": "" }, "require": { - "php": "^7.2|^8.0" + "php": "^7.4|^8.0" }, "conflict": { "phpstan/phpstan-shim": "*" @@ -5361,7 +5361,7 @@ "type": "github" } ], - "time": "2024-12-17T17:00:20+00:00" + "time": "2024-12-17T17:14:01+00:00" }, { "name": "phpunit/php-code-coverage", diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 823aef586..d2eaeb3bd 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,76 +1,133 @@ parameters: ignoreErrors: - - message: "#^Cannot unset offset 'url' on array\\{application_name\\?\\: string, charset\\?\\: string, dbname\\?\\: string, defaultTableOptions\\?\\: array\\, driver\\?\\: 'ibm_db2'\\|'mysqli'\\|'oci8'\\|'pdo_mysql'\\|'pdo_oci'\\|'pdo_pgsql'\\|'pdo_sqlite'\\|'pdo_sqlsrv'\\|'pgsql'\\|'sqlite3'\\|'sqlsrv', driverClass\\?\\: class\\-string\\, driverOptions\\?\\: array, host\\?\\: string, \\.\\.\\.\\}\\.$#" + message: '#^Cannot unset offset ''url'' on array\{application_name\?\: string, charset\?\: string, dbname\?\: string, defaultTableOptions\?\: array\, driver\?\: ''ibm_db2''\|''mysqli''\|''oci8''\|''pdo_mysql''\|''pdo_oci''\|''pdo_pgsql''\|''pdo_sqlite''\|''pdo_sqlsrv''\|''pgsql''\|''sqlite3''\|''sqlsrv'', driverClass\?\: class\-string\, driverOptions\?\: array\, host\?\: string, \.\.\.\}\.$#' + identifier: unset.offset count: 1 path: src/Console/DoctrineHelper.php - - message: "#^Parameter \\#1 \\$key of class Patchlevel\\\\Hydrator\\\\Cryptography\\\\Cipher\\\\CipherKey constructor expects non\\-empty\\-string, string given\\.$#" + message: '#^Parameter \#1 \$key of class Patchlevel\\Hydrator\\Cryptography\\Cipher\\CipherKey constructor expects non\-empty\-string, string given\.$#' + identifier: argument.type count: 1 path: src/Cryptography/DoctrineCipherKeyStore.php - - message: "#^Parameter \\#3 \\$iv of class Patchlevel\\\\Hydrator\\\\Cryptography\\\\Cipher\\\\CipherKey constructor expects non\\-empty\\-string, string given\\.$#" + message: '#^Parameter \#3 \$iv of class Patchlevel\\Hydrator\\Cryptography\\Cipher\\CipherKey constructor expects non\-empty\-string, string given\.$#' + identifier: argument.type count: 1 path: src/Cryptography/DoctrineCipherKeyStore.php - - message: "#^Parameter \\#2 \\$data of method Patchlevel\\\\Hydrator\\\\Hydrator\\:\\:hydrate\\(\\) expects array\\, mixed given\\.$#" + message: '#^Call to function method_exists\(\) with ReflectionFunction and ''isAnonymous'' will always evaluate to true\.$#' + identifier: function.alreadyNarrowedType + count: 1 + path: src/EventBus/ListenerDescriptor.php + + - + message: '#^@readonly property Patchlevel\\EventSourcing\\Message\\Message\:\:\$headers is assigned outside of the constructor\.$#' + identifier: property.readOnlyByPhpDocAssignNotInConstructor + count: 3 + path: src/Message/Message.php + + - + message: '#^@readonly property cannot have a default value\.$#' + identifier: property.readOnlyByPhpDocDefaultValue + count: 1 + path: src/Message/Message.php + + - + message: '#^Parameter \#2 \$data of method Patchlevel\\Hydrator\\Hydrator\:\:hydrate\(\) expects array\, array\ given\.$#' + identifier: argument.type + count: 1 + path: src/Message/Serializer/DefaultHeadersSerializer.php + + - + message: '#^Parameter \#2 \$data of method Patchlevel\\Hydrator\\Hydrator\:\:hydrate\(\) expects array\, mixed given\.$#' + identifier: argument.type count: 1 path: src/Snapshot/DefaultSnapshotStore.php - - message: "#^Property Patchlevel\\\\EventSourcing\\\\Store\\\\ArrayStream\\:\\:\\$index \\(int\\<1, max\\>\\|null\\) does not accept int\\<0, max\\>\\.$#" + message: '#^Method Patchlevel\\EventSourcing\\Store\\ArrayStream\:\:current\(\) never returns null so it can be removed from the return type\.$#' + identifier: return.unusedType count: 1 path: src/Store/ArrayStream.php - - message: "#^Ternary operator condition is always true\\.$#" + message: '#^Property Patchlevel\\EventSourcing\\Store\\ArrayStream\:\:\$index \(int\<1, max\>\|null\) does not accept int\<0, max\>\.$#' + identifier: assign.propertyType count: 1 path: src/Store/ArrayStream.php - - message: "#^Method Patchlevel\\\\EventSourcing\\\\Store\\\\Criteria\\\\Criteria\\:\\:get\\(\\) should return T of object but returns object\\.$#" + message: '#^Ternary operator condition is always true\.$#' + identifier: ternary.alwaysTrue + count: 1 + path: src/Store/ArrayStream.php + + - + message: '#^Method Patchlevel\\EventSourcing\\Store\\Criteria\\Criteria\:\:get\(\) should return T of object but returns object\.$#' + identifier: return.type count: 1 path: src/Store/Criteria/Criteria.php - - message: "#^Parameter \\#3 \\$playhead of class Patchlevel\\\\EventSourcing\\\\Aggregate\\\\AggregateHeader constructor expects int\\<1, max\\>, int given\\.$#" + message: '#^Method Patchlevel\\EventSourcing\\Store\\DoctrineDbalStoreStream\:\:current\(\) never returns null so it can be removed from the return type\.$#' + identifier: return.unusedType count: 1 path: src/Store/DoctrineDbalStoreStream.php - - message: "#^Parameter \\#4 \\$recordedOn of class Patchlevel\\\\EventSourcing\\\\Aggregate\\\\AggregateHeader constructor expects DateTimeImmutable, mixed given\\.$#" + message: '#^Parameter \#3 \$playhead of class Patchlevel\\EventSourcing\\Aggregate\\AggregateHeader constructor expects int\<1, max\>, int given\.$#' + identifier: argument.type count: 1 path: src/Store/DoctrineDbalStoreStream.php - - message: "#^Ternary operator condition is always true\\.$#" + message: '#^Parameter \#4 \$recordedOn of class Patchlevel\\EventSourcing\\Aggregate\\AggregateHeader constructor expects DateTimeImmutable, mixed given\.$#' + identifier: argument.type count: 1 path: src/Store/DoctrineDbalStoreStream.php - - message: "#^Property Patchlevel\\\\EventSourcing\\\\Store\\\\InMemoryStore\\:\\:\\$messages \\(array\\, Patchlevel\\\\EventSourcing\\\\Message\\\\Message\\>\\) does not accept array\\\\.$#" + message: '#^Ternary operator condition is always true\.$#' + identifier: ternary.alwaysTrue count: 1 - path: src/Store/InMemoryStore.php + path: src/Store/DoctrineDbalStoreStream.php - - message: "#^Parameter \\#1 \\$playhead of class Patchlevel\\\\EventSourcing\\\\Store\\\\Header\\\\PlayheadHeader constructor expects int\\<1, max\\>, int given\\.$#" + message: '#^Method Patchlevel\\EventSourcing\\Store\\StreamDoctrineDbalStoreStream\:\:current\(\) never returns null so it can be removed from the return type\.$#' + identifier: return.unusedType count: 1 path: src/Store/StreamDoctrineDbalStoreStream.php - - message: "#^Ternary operator condition is always true\\.$#" + message: '#^Parameter \#1 \$playhead of class Patchlevel\\EventSourcing\\Store\\Header\\PlayheadHeader constructor expects int\<1, max\>, int given\.$#' + identifier: argument.type count: 1 path: src/Store/StreamDoctrineDbalStoreStream.php - - message: "#^Strict comparison using \\=\\=\\= between DateTimeImmutable and false will always evaluate to false\\.$#" + message: '#^Ternary operator condition is always true\.$#' + identifier: ternary.alwaysTrue + count: 1 + path: src/Store/StreamDoctrineDbalStoreStream.php + + - + message: '#^Strict comparison using \=\=\= between DateTimeImmutable and false will always evaluate to false\.$#' + identifier: identical.alwaysFalse count: 1 path: src/Subscription/RetryStrategy/ClockBasedRetryStrategy.php - - message: "#^Parameter \\#3 \\$errorContext of class Patchlevel\\\\EventSourcing\\\\Subscription\\\\SubscriptionError constructor expects array\\\\}\\>\\|null, mixed given\\.$#" + message: '#^Parameter \#3 \$errorContext of class Patchlevel\\EventSourcing\\Subscription\\SubscriptionError constructor expects list\\}\>\}\>\|null, mixed given\.$#' + identifier: argument.type count: 1 path: src/Subscription/Store/DoctrineSubscriptionStore.php + + - + message: '#^Trait Patchlevel\\EventSourcing\\Subscription\\Subscriber\\SubscriberUtil is used zero times and is not analysed\.$#' + identifier: trait.unused + count: 1 + path: src/Subscription/Subscriber/SubscriberUtil.php From b521015c0ab4e9d2af66e711398680816e1e013e Mon Sep 17 00:00:00 2001 From: Daniel Badura Date: Mon, 30 Dec 2024 19:39:20 +0100 Subject: [PATCH 2/2] Add plugins for tests, update baseline --- composer.json | 2 + composer.lock | 114 ++++++++++++++++- phpstan-baseline.neon | 282 +++++++++++++++++++++++++++++++++++++++++- phpstan.neon.dist | 3 + 4 files changed, 397 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index cfbb2a4d3..27f5f077b 100644 --- a/composer.json +++ b/composer.json @@ -38,12 +38,14 @@ "cspray/phinal": "^2.0.0", "doctrine/orm": "^2.18.0|^3.0.0", "infection/infection": "^0.27.10", + "jangregor/phpstan-prophecy": "^2.0", "league/commonmark": "^2.4", "patchlevel/coding-standard": "^1.3.0", "patchlevel/event-sourcing-psalm-plugin": "^3.0.0", "phpbench/phpbench": "^1.2.15", "phpspec/prophecy-phpunit": "^2.1.0", "phpstan/phpstan": "^2.0.4", + "phpstan/phpstan-phpunit": "^2.0", "phpunit/phpunit": "^10.5.2", "psalm/plugin-phpunit": "^0.19.0", "roave/infection-static-analysis-plugin": "^1.34.0", diff --git a/composer.lock b/composer.lock index c1e2792ca..febc232ea 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "963ca2ed17462b8f909306b07da5f0dd", + "content-hash": "9e370bfaf9e161b78856391982ea4092", "packages": [ { "name": "brick/math", @@ -3879,6 +3879,67 @@ ], "time": "2024-02-20T00:08:52+00:00" }, + { + "name": "jangregor/phpstan-prophecy", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/Jan0707/phpstan-prophecy.git", + "reference": "8937c0f084eefb928032b438f0f57ad5cba3dbdc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Jan0707/phpstan-prophecy/zipball/8937c0f084eefb928032b438f0f57ad5cba3dbdc", + "reference": "8937c0f084eefb928032b438f0f57ad5cba3dbdc", + "shasum": "" + }, + "require": { + "php": "^7.4 || ^8.0", + "phpstan/phpstan": "^2.0.0" + }, + "conflict": { + "phpspec/prophecy": "<1.17.0 || >=2.0.0", + "phpspec/prophecy-phpunit": "<2.3.0 || >=3.0.0", + "phpunit/phpunit": "<9.1.0 || >=12.0.0" + }, + "require-dev": { + "ergebnis/composer-normalize": "^2.1.1", + "ergebnis/license": "^2.6.0", + "ergebnis/php-cs-fixer-config": "^4.0 || ^5.0 || ^6.0", + "phpspec/prophecy": "^1.7.0", + "phpspec/prophecy-phpunit": "^2.3", + "phpunit/phpunit": "^9.1.0" + }, + "type": "phpstan-extension", + "extra": { + "phpstan": { + "includes": [ + "extension.neon" + ] + } + }, + "autoload": { + "psr-4": { + "JanGregor\\Prophecy\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jan Gregor Emge-Triebel", + "email": "jan@jangregor.me" + } + ], + "description": "Provides a phpstan/phpstan extension for phpspec/prophecy", + "support": { + "issues": "https://github.com/Jan0707/phpstan-prophecy/issues", + "source": "https://github.com/Jan0707/phpstan-prophecy/tree/2.0.0" + }, + "time": "2024-11-21T13:41:50+00:00" + }, { "name": "justinrainbow/json-schema", "version": "5.3.0", @@ -5363,6 +5424,57 @@ ], "time": "2024-12-17T17:14:01+00:00" }, + { + "name": "phpstan/phpstan-phpunit", + "version": "2.0.3", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan-phpunit.git", + "reference": "e32ac656788a5bf3dedda89e6a2cad5643bf1a18" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/e32ac656788a5bf3dedda89e6a2cad5643bf1a18", + "reference": "e32ac656788a5bf3dedda89e6a2cad5643bf1a18", + "shasum": "" + }, + "require": { + "php": "^7.4 || ^8.0", + "phpstan/phpstan": "^2.0.4" + }, + "conflict": { + "phpunit/phpunit": "<7.0" + }, + "require-dev": { + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpstan/phpstan-strict-rules": "^2.0", + "phpunit/phpunit": "^9.6" + }, + "type": "phpstan-extension", + "extra": { + "phpstan": { + "includes": [ + "extension.neon", + "rules.neon" + ] + } + }, + "autoload": { + "psr-4": { + "PHPStan\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPUnit extensions and rules for PHPStan", + "support": { + "issues": "https://github.com/phpstan/phpstan-phpunit/issues", + "source": "https://github.com/phpstan/phpstan-phpunit/tree/2.0.3" + }, + "time": "2024-12-19T09:14:43+00:00" + }, { "name": "phpunit/php-code-coverage", "version": "10.1.16", diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index d2eaeb3bd..ffc9e0dc0 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -127,7 +127,283 @@ parameters: path: src/Subscription/Store/DoctrineSubscriptionStore.php - - message: '#^Trait Patchlevel\\EventSourcing\\Subscription\\Subscriber\\SubscriberUtil is used zero times and is not analysed\.$#' - identifier: trait.unused + message: '#^Parameter \#1 \$id of static method Patchlevel\\EventSourcing\\Tests\\Benchmark\\BasicImplementation\\Profile\:\:create\(\) expects Patchlevel\\EventSourcing\\Tests\\Benchmark\\BasicImplementation\\ProfileId, Patchlevel\\EventSourcing\\Aggregate\\AggregateRootId given\.$#' + identifier: argument.type + count: 1 + path: tests/Benchmark/SplitStreamBench.php + + - + message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''Patchlevel\\\\EventSourcing\\\\Tests\\\\Integration\\\\BankAccountSplitStream\\\\BankAccount'' and Patchlevel\\EventSourcing\\Tests\\Integration\\BankAccountSplitStream\\BankAccount will always evaluate to true\.$#' + identifier: staticMethod.alreadyNarrowedType + count: 4 + path: tests/Integration/BankAccountSplitStream/IntegrationTest.php + + - + message: '#^Access to an undefined property object\:\:\$accountId\.$#' + identifier: property.notFound + count: 2 + path: tests/Integration/BankAccountSplitStream/Projection/BankAccountProjector.php + + - + message: '#^Access to an undefined property object\:\:\$balanceInCents\.$#' + identifier: property.notFound + count: 1 + path: tests/Integration/BankAccountSplitStream/Projection/BankAccountProjector.php + + - + message: '#^Access to an undefined property object\:\:\$name\.$#' + identifier: property.notFound + count: 1 + path: tests/Integration/BankAccountSplitStream/Projection/BankAccountProjector.php + + - + message: '#^Cannot call method toString\(\) on mixed\.$#' + identifier: method.nonObject + count: 2 + path: tests/Integration/BankAccountSplitStream/Projection/BankAccountProjector.php + + - + message: '#^Access to an undefined property object\:\:\$name\.$#' + identifier: property.notFound + count: 2 + path: tests/Integration/BasicImplementation/BasicIntegrationTest.php + + - + message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''Patchlevel\\\\EventSourcing\\\\Tests\\\\Integration\\\\BasicImplementation\\\\Profile'' and Patchlevel\\EventSourcing\\Tests\\Integration\\BasicImplementation\\Profile will always evaluate to true\.$#' + identifier: staticMethod.alreadyNarrowedType + count: 2 + path: tests/Integration/BasicImplementation/BasicIntegrationTest.php + + - + message: '#^Property Patchlevel\\EventSourcing\\Tests\\Integration\\BasicImplementation\\Profile\:\:\$id is never read, only written\.$#' + identifier: property.onlyWritten + count: 1 + path: tests/Integration/BasicImplementation/Profile.php + + - + message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''Patchlevel\\\\EventSourcing\\\\Tests\\\\Integration\\\\ChildAggregate\\\\Profile'' and Patchlevel\\EventSourcing\\Tests\\Integration\\ChildAggregate\\Profile will always evaluate to true\.$#' + identifier: staticMethod.alreadyNarrowedType + count: 2 + path: tests/Integration/ChildAggregate/ChildAggregateIntegrationTest.php + + - + message: '#^Property Patchlevel\\EventSourcing\\Tests\\Integration\\ChildAggregate\\Profile\:\:\$id is never read, only written\.$#' + identifier: property.onlyWritten + count: 1 + path: tests/Integration/ChildAggregate/Profile.php + + - + message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''Patchlevel\\\\EventSourcing\\\\Tests\\\\Integration\\\\MicroAggregate\\\\Profile'' and Patchlevel\\EventSourcing\\Tests\\Integration\\MicroAggregate\\Profile will always evaluate to true\.$#' + identifier: staticMethod.alreadyNarrowedType + count: 2 + path: tests/Integration/MicroAggregate/MicroAggregateIntegrationTest.php + + - + message: '#^Property Patchlevel\\EventSourcing\\Tests\\Integration\\MicroAggregate\\Profile\:\:\$id is never read, only written\.$#' + identifier: property.onlyWritten + count: 1 + path: tests/Integration/MicroAggregate/Profile.php + + - + message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertArrayHasKey\(\) with 0 and array\{array\\} will always evaluate to true\.$#' + identifier: staticMethod.alreadyNarrowedType + count: 1 + path: tests/Integration/PersonalData/PersonalDataTest.php + + - + message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''Patchlevel\\\\EventSourcing\\\\Tests\\\\Integration\\\\PersonalData\\\\Profile'' and Patchlevel\\EventSourcing\\Tests\\Integration\\PersonalData\\Profile will always evaluate to true\.$#' + identifier: staticMethod.alreadyNarrowedType + count: 6 + path: tests/Integration/PersonalData/PersonalDataTest.php + + - + message: '#^Parameter \#2 \$haystack of static method PHPUnit\\Framework\\Assert\:\:assertStringNotContainsString\(\) expects string, mixed given\.$#' + identifier: argument.type + count: 1 + path: tests/Integration/PersonalData/PersonalDataTest.php + + - + message: '#^Property Patchlevel\\EventSourcing\\Tests\\Integration\\Store\\Profile\:\:\$id is never read, only written\.$#' + identifier: property.onlyWritten + count: 1 + path: tests/Integration/Store/Profile.php + + - + message: '#^Property Patchlevel\\EventSourcing\\Tests\\Integration\\Subscription\\Profile\:\:\$id is never read, only written\.$#' + identifier: property.onlyWritten + count: 1 + path: tests/Integration/Subscription/Profile.php + + - + message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertArrayHasKey\(\) with 0 and array\{Patchlevel\\EventSourcing\\Subscription\\Subscription\} will always evaluate to true\.$#' + identifier: staticMethod.alreadyNarrowedType + count: 1 + path: tests/Integration/Subscription/SubscriptionTest.php + + - + message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertArrayHasKey\(\) with 2 and array\{Patchlevel\\EventSourcing\\Message\\Message, Patchlevel\\EventSourcing\\Message\\Message, Patchlevel\\EventSourcing\\Message\\Message\} will always evaluate to true\.$#' + identifier: staticMethod.alreadyNarrowedType + count: 1 + path: tests/Integration/Subscription/SubscriptionTest.php + + - + message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''Patchlevel\\\\EventSourcing\\\\Metadata\\\\AggregateRoot\\\\AggregateRootMetadata'' and Patchlevel\\EventSourcing\\Metadata\\AggregateRoot\\AggregateRootMetadata\ will always evaluate to true\.$#' + identifier: staticMethod.alreadyNarrowedType + count: 1 + path: tests/Unit/Aggregate/AggregateRootTest.php + + - + message: '#^Parameter \#1 \$data of static method Patchlevel\\EventSourcing\\Tests\\Unit\\Fixture\\Message\:\:fromArray\(\) expects array\{id\: string, text\: string, createdAt\: string\}, array\ given\.$#' + identifier: argument.type + count: 1 + path: tests/Unit/Fixture/MessageNormalizer.php + + - + message: '#^Property Patchlevel\\EventSourcing\\Tests\\Unit\\Fixture\\ProfileInvalid\:\:\$email is never read, only written\.$#' + identifier: property.onlyWritten + count: 1 + path: tests/Unit/Fixture/ProfileInvalid.php + + - + message: '#^Property Patchlevel\\EventSourcing\\Tests\\Unit\\Fixture\\ProfileInvalid\:\:\$id is never read, only written\.$#' + identifier: property.onlyWritten + count: 1 + path: tests/Unit/Fixture/ProfileInvalid.php + + - + message: '#^Property Patchlevel\\EventSourcing\\Tests\\Unit\\Fixture\\ProfileWithBrokenApplyBothUsage\:\:\$id is unused\.$#' + identifier: property.unused + count: 1 + path: tests/Unit/Fixture/ProfileWithBrokenApplyBothUsage.php + + - + message: '#^Property Patchlevel\\EventSourcing\\Tests\\Unit\\Fixture\\ProfileWithBrokenApplyIntersection\:\:\$id is unused\.$#' + identifier: property.unused + count: 1 + path: tests/Unit/Fixture/ProfileWithBrokenApplyIntersection.php + + - + message: '#^Property Patchlevel\\EventSourcing\\Tests\\Unit\\Fixture\\ProfileWithBrokenApplyMultipleApply\:\:\$id is unused\.$#' + identifier: property.unused + count: 1 + path: tests/Unit/Fixture/ProfileWithBrokenApplyMultipleApply.php + + - + message: '#^Method Patchlevel\\EventSourcing\\Tests\\Unit\\Fixture\\ProfileWithBrokenApplyNoType\:\:applyWithNoType\(\) has parameter \$event with no type specified\.$#' + identifier: missingType.parameter + count: 1 + path: tests/Unit/Fixture/ProfileWithBrokenApplyNoType.php + + - + message: '#^Property Patchlevel\\EventSourcing\\Tests\\Unit\\Fixture\\ProfileWithBrokenApplyNoType\:\:\$id is unused\.$#' + identifier: property.unused + count: 1 + path: tests/Unit/Fixture/ProfileWithBrokenApplyNoType.php + + - + message: '#^Property Patchlevel\\EventSourcing\\Tests\\Unit\\Fixture\\ProfileWithBrokenId\:\:\$id is never read, only written\.$#' + identifier: property.onlyWritten + count: 1 + path: tests/Unit/Fixture/ProfileWithBrokenId.php + + - + message: '#^Property Patchlevel\\EventSourcing\\Tests\\Unit\\Fixture\\ProfileWithEmptyApply\:\:\$id is unused\.$#' + identifier: property.unused + count: 1 + path: tests/Unit/Fixture/ProfileWithEmptyApply.php + + - + message: '#^Property Patchlevel\\EventSourcing\\Tests\\Unit\\Fixture\\ProfileWithSuppressAll\:\:\$id is unused\.$#' + identifier: property.unused + count: 1 + path: tests/Unit/Fixture/ProfileWithSuppressAll.php + + - + message: '#^Property Patchlevel\\EventSourcing\\Tests\\Unit\\Fixture\\WrongNormalizerBasicAggregate\:\:\$id is unused\.$#' + identifier: property.unused + count: 1 + path: tests/Unit/Fixture/WrongNormalizerBasicAggregate.php + + - + message: '#^Parameter \#2 \$callable of class Patchlevel\\EventSourcing\\Message\\Translator\\ReplaceEventTranslator constructor expects callable\(Patchlevel\\EventSourcing\\Tests\\Unit\\Fixture\\MessagePublished\)\: object, Closure\(Patchlevel\\EventSourcing\\Tests\\Unit\\Fixture\\ProfileCreated\)\: Patchlevel\\EventSourcing\\Tests\\Unit\\Fixture\\ProfileVisited given\.$#' + identifier: argument.type + count: 1 + path: tests/Unit/Message/Translator/ReplaceEventTranslatorTest.php + + - + message: '#^Method class@anonymous/tests/Unit/Metadata/Subscriber/AttributeSubscriberMetadataFactoryTest\.php\:210\:\:profileVisited\(\) has parameter \$message with no type specified\.$#' + identifier: missingType.parameter + count: 1 + path: tests/Unit/Metadata/Subscriber/AttributeSubscriberMetadataFactoryTest.php + + - + message: '#^Trying to invoke mixed but it''s not a callable\.$#' + identifier: callable.nonCallable + count: 15 + path: tests/Unit/Store/DoctrineDbalStoreTest.php + + - + message: '#^Trying to invoke mixed but it''s not a callable\.$#' + identifier: callable.nonCallable + count: 15 + path: tests/Unit/Store/StreamDoctrineDbalStoreTest.php + + - + message: '#^Match expression does not handle remaining value\: string$#' + identifier: match.unhandled + count: 1 + path: tests/Unit/Subscription/Engine/DefaultSubscriptionEngineTest.php + + - + message: '#^Parameter \#1 \$error of static method Patchlevel\\EventSourcing\\Subscription\\ThrowableToErrorContextTransformer\:\:transform\(\) expects Throwable, Throwable\|null given\.$#' + identifier: argument.type + count: 8 + path: tests/Unit/Subscription/Engine/DefaultSubscriptionEngineTest.php + + - + message: '#^Trying to invoke mixed but it''s not a callable\.$#' + identifier: callable.nonCallable + count: 2 + path: tests/Unit/Subscription/Engine/DefaultSubscriptionEngineTest.php + + - + message: '#^Trying to invoke mixed but it''s not a callable\.$#' + identifier: callable.nonCallable + count: 1 + path: tests/Unit/Subscription/Engine/SubscriptionManagerTest.php + + - + message: '#^Offset ''args'' on array\{file\: literal\-string&non\-falsy\-string, line\: int, function\: ''createException'', class\: ''Patchlevel\\\\EventSourcing\\\\Tests\\\\Unit\\\\Subscription\\\\ErrorContextTest'', type\: ''\-\>'', args\: array\\} on left side of \?\? always exists and is not nullable\.$#' + identifier: nullCoalesce.offset + count: 1 + path: tests/Unit/Subscription/ErrorContextTest.php + + - + message: '#^Offset ''class'' on array\{file\: literal\-string&non\-falsy\-string, line\: int, function\: ''createException'', class\: string, type\?\: string, args\?\: array\\} on left side of \?\? always exists and is not nullable\.$#' + identifier: nullCoalesce.offset + count: 1 + path: tests/Unit/Subscription/ErrorContextTest.php + + - + message: '#^Offset ''file'' on array\{file\: string, line\?\: int, function\?\: string, class\?\: string, type\?\: string, args\?\: array\\} on left side of \?\? always exists and is not nullable\.$#' + identifier: nullCoalesce.offset + count: 1 + path: tests/Unit/Subscription/ErrorContextTest.php + + - + message: '#^Offset ''type'' on array\{file\: literal\-string&non\-falsy\-string, line\: int, function\: ''createException'', class\: ''Patchlevel\\\\EventSourcing\\\\Tests\\\\Unit\\\\Subscription\\\\ErrorContextTest'', type\: string, args\?\: array\\} on left side of \?\? always exists and is not nullable\.$#' + identifier: nullCoalesce.offset + count: 1 + path: tests/Unit/Subscription/ErrorContextTest.php + + - + message: '#^Parameter \#1 \$stream of function fclose expects resource, resource\|false given\.$#' + identifier: argument.type + count: 1 + path: tests/Unit/Subscription/ErrorContextTest.php + + - + message: '#^Parameter \#3 \$resource of method Patchlevel\\EventSourcing\\Tests\\Unit\\Subscription\\ErrorContextTest\:\:createException\(\) expects resource, resource\|false given\.$#' + identifier: argument.type count: 1 - path: src/Subscription/Subscriber/SubscriberUtil.php + path: tests/Unit/Subscription/ErrorContextTest.php diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 6452d44b2..4f09aed39 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -1,10 +1,13 @@ includes: - phpstan-baseline.neon + - vendor/phpstan/phpstan-phpunit/extension.neon + - vendor/jangregor/phpstan-prophecy/extension.neon parameters: level: max paths: - src + - tests ignoreErrors: - identifier: missingType.generics