diff --git a/composer.json b/composer.json index 5f8208b..3506ee6 100755 --- a/composer.json +++ b/composer.json @@ -10,11 +10,11 @@ } ], "require": { - "php": "^7.1 || ^8.0", + "php": "^7.4 || ^8.0", "ext-simplexml": "*", "composer/semver": "^1.4 || ^2.0 || ^3.0", "composer/package-versions-deprecated": "^1.10", - "vimeo/psalm": "dev-master || dev-4.x || ^4.7.1 || ^5@beta || ^5.0" + "vimeo/psalm": "dev-master || ^5@beta || ^5.0" }, "conflict": { "phpunit/phpunit": "<7.5" diff --git a/src/Hooks/TestCaseHandler.php b/src/Hooks/TestCaseHandler.php index e0c877b..7ac8229 100644 --- a/src/Hooks/TestCaseHandler.php +++ b/src/Hooks/TestCaseHandler.php @@ -106,6 +106,8 @@ public static function afterClassLikeVisit(AfterClassLikeVisitEvent $event) /** * {@inheritDoc} + * + * @psalm-suppress DeprecatedClass TList will be removed soon */ public static function afterStatementAnalysis(AfterClassLikeAnalysisEvent $event) { diff --git a/tests/acceptance/Prophecy.feature b/tests/acceptance/Prophecy.feature index 386ecfe..4f3031a 100644 --- a/tests/acceptance/Prophecy.feature +++ b/tests/acceptance/Prophecy.feature @@ -74,27 +74,7 @@ Feature: Prophecy When I run Psalm Then I see no errors - Scenario: Argument::that() only accepts callable with boolean return type [Psalm 4] - Given I have the following code - """ - class MyTestCase extends TestCase - { - /** @return void */ - public function testSomething() { - $_argument = Argument::that(function (): string { - return 'hello'; - }); - } - } - """ - And I have Psalm older than "5.0" (because of "changed issue type") - When I run Psalm - Then I see these errors - | Type | Message | - | InvalidScalarArgument | /Argument 1 of Prophecy\\Argument::that expects callable\(mixed...\):bool, (but )?(pure-)?Closure\(\):(string\(hello\)\|"hello"\|'hello') provided/ | - And I see no other errors - - Scenario: Argument::that() only accepts callable with boolean return type [Psalm 5] + Scenario: Argument::that() only accepts callable with boolean return type Given I have the following code """ class MyTestCase extends TestCase diff --git a/tests/acceptance/TestCase.feature b/tests/acceptance/TestCase.feature index 438bdf7..52e7686 100644 --- a/tests/acceptance/TestCase.feature +++ b/tests/acceptance/TestCase.feature @@ -612,31 +612,7 @@ Feature: TestCase When I run Psalm Then I see no errors - Scenario: Provider omitting offsets is fine when test method has defaults for those params (specified as constants) [Psalm 4] - Given I have the following code - """ - class MyTestCase extends TestCase - { - /** @var string */ - const S = "s"; - /** @return iterable */ - public function provide() { - yield "data set name" => rand(0,1) ? [1] : [1, "ss"]; - } - /** - * @return void - * @dataProvider provide - */ - public function testSomething(int $int, string $_str = self::S) { - $this->assertEquals(1, $int); - } - } - """ - And I have Psalm older than "5.0" (because of "sealed shapes") - When I run Psalm - Then I see no errors - - Scenario: Provider omitting offsets is fine when test method has defaults for those params (specified as constants) [Psalm 5] + Scenario: Provider omitting offsets is fine when test method has defaults for those params (specified as constants) Given I have the following code """ class MyTestCase extends TestCase @@ -1000,7 +976,7 @@ Feature: TestCase Given I have the following code """ class MyTestCase extends TestCase { - /** @return iterable */ + /** @return iterable */ public function provide() { yield "data set" => [1., "a"]; } @@ -1173,21 +1149,6 @@ Feature: TestCase When I run Psalm Then I see no errors - @ExternalProviders - Scenario: Missing external provider classes are reported - Given I have the following code - """ - class MyTestCase extends TestCase { - /** @dataProvider External::provide */ - public function testSomething(int $_p): void {} - } - """ - When I run Psalm - Then I see these errors - | Type | Message | - | UndefinedClass | Class NS\External does not exist | - - @ExternalProviders Scenario: External providers are not marked as unused Given I have the following code @@ -1260,12 +1221,26 @@ Feature: TestCase When I run Psalm on "test.php" Then I see no errors + @ExternalProviders + Scenario: Missing external provider classes are reported + Given I have the following code + """ + class MyTestCase extends TestCase { + /** @dataProvider External::provide */ + public function testSomething(int $_p): void {} + } + """ + When I run Psalm + Then I see these errors + | Type | Message | + | UndefinedClass | Class NS\External does not exist | + @List Scenario: Providers returning list are ok Given I have the following code """ class MyTestCase extends TestCase { - /** @return iterable> */ + /** @return iterable> */ public function provide(): iterable { yield "dataset name" => [1]; } @@ -1281,7 +1256,7 @@ Feature: TestCase Given I have the following code """ class MyTestCase extends TestCase { - /** @return iterable> */ + /** @return iterable> */ public function provide(): iterable { yield "dataset name" => ["1"]; } @@ -1292,7 +1267,7 @@ Feature: TestCase When I run Psalm Then I see these errors | Type | Message | - | InvalidArgument | Argument 1 of NS\MyTestCase::testSomething expects int, string provided by NS\MyTestCase::provide():(iterable>) | + | InvalidArgument | Argument 1 of NS\MyTestCase::testSomething expects int, string provided by NS\MyTestCase::provide():(iterable>) | Scenario: Providers returning nullable generator are ok Given I have the following code