Skip to content

Commit

Permalink
[TASK] Make the data providers static
Browse files Browse the repository at this point in the history
This is required in newer PHPUnit versions.

Also bump the PHPStan dependency as needed to have some methods static:
phpstan/phpstan-src@ea2670a
  • Loading branch information
oliverklee committed Jan 30, 2024
1 parent 2ff4e0c commit a40ae22
Show file tree
Hide file tree
Showing 15 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"prefer-stable": true,
"require": {
"php": "^7.4 || ^8.0",
"phpstan/phpstan": "^1.8.9",
"phpstan/phpstan": "^1.10.9",
"nikic/php-parser": "^4.15.1",
"typo3/cms-core": "^10.4 || ^11.5 || ^12.4 || ^13.0",
"typo3/cms-extbase": "^10.4 || ^11.5 || ^12.4 || ^13.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ final class ValidatorResolverOptionsRuleTest extends RuleTestCase
{

/**
* @dataProvider provideDataWithErrors()
* @dataProvider provideDataWithErrors
*
* @param list<array{0: string, 1: int, 2?: string}> $expectedErrorMessagesWithLines
*/
Expand All @@ -27,7 +27,7 @@ public function testRuleWithoutErrors(): void
$this->analyse([__DIR__ . '/Fixture/CreateValidatorWithCorrectOptions.php'], []);
}

public function provideDataWithErrors(): \Iterator
public static function provideDataWithErrors(): \Iterator
{
yield [
__DIR__ . '/Fixture/CreateValidatorWithUnresolvableType.php',
Expand Down
6 changes: 3 additions & 3 deletions tests/Unit/Type/ContextDynamicReturnTypeExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ class ContextDynamicReturnTypeExtensionTest extends TypeInferenceTestCase
/**
* @return iterable<mixed>
*/
public function dataFileAsserts(): iterable
public static function dataFileAsserts(): iterable
{
// path to a file with actual asserts of expected types:
yield from $this->gatherAssertTypes(__DIR__ . '/data/context-get-aspect-return-types.php');
yield from self::gatherAssertTypes(__DIR__ . '/data/context-get-aspect-return-types.php');
}

/**
Expand All @@ -23,7 +23,7 @@ public function dataFileAsserts(): iterable
* @param string $file
* @param mixed ...$args
*/
public function testFileAsserts(
public static function testFileAsserts(
string $assertType,
string $file,
...$args
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ final class DateTimeAspectGetDynamicReturnTypeExtensionTest extends TypeInferenc
*
* @return iterable<mixed>
*/
public function dataFileAsserts(): iterable
public static function dataFileAsserts(): iterable
{
yield from $this->gatherAssertTypes(__DIR__ . '/data/datetime-aspect-get-return-types.php');
yield from self::gatherAssertTypes(__DIR__ . '/data/datetime-aspect-get-return-types.php');
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ final class GeneralUtilityGetIndpEnvDynamicReturnTypeExtensionTest extends TypeI
/**
* @return iterable<mixed>
*/
public function dataFileAsserts(): iterable
public static function dataFileAsserts(): iterable
{
yield from $this->gatherAssertTypes(__DIR__ . '/data/GeneralUtilityGetIndpEnvTest.php');
yield from self::gatherAssertTypes(__DIR__ . '/data/GeneralUtilityGetIndpEnvTest.php');
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ final class MathUtilityTypeSpecifyingExtensionTest extends TypeInferenceTestCase
/**
* @return iterable<mixed>
*/
public function dataFileAsserts(): iterable
public static function dataFileAsserts(): iterable
{
yield from $this->gatherAssertTypes(__DIR__ . '/data/MathUtilityTest.php');
yield from self::gatherAssertTypes(__DIR__ . '/data/MathUtilityTest.php');
}

/**
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/Type/ObjectStorageStubFileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ class ObjectStorageStubFileTest extends TypeInferenceTestCase
/**
* @return iterable<mixed>
*/
public function dataFileAsserts(): iterable
public static function dataFileAsserts(): iterable
{
yield from $this->gatherAssertTypes(__DIR__ . '/data/object-storage-stub-files.php');
yield from self::gatherAssertTypes(__DIR__ . '/data/object-storage-stub-files.php');
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ final class PropertyMapperReturnTypeExtensionTest extends TypeInferenceTestCase
/**
* @return iterable<mixed>
*/
public function dataFileAsserts(): iterable
public static function dataFileAsserts(): iterable
{
yield from $this->gatherAssertTypes(__DIR__ . '/data/property-converter-types.php');
yield from self::gatherAssertTypes(__DIR__ . '/data/property-converter-types.php');
}

/**
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/Type/QueryFactoryStubFileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ class QueryFactoryStubFileTest extends TypeInferenceTestCase
/**
* @return iterable<mixed>
*/
public function dataFileAsserts(): iterable
public static function dataFileAsserts(): iterable
{
yield from $this->gatherAssertTypes(__DIR__ . '/data/query-factory-stub-files.php');
yield from self::gatherAssertTypes(__DIR__ . '/data/query-factory-stub-files.php');
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ final class QueryResultToArrayDynamicReturnTypeExtensionTest extends TypeInferen
/**
* @return iterable<mixed>
*/
public function dataFileAsserts(): iterable
public static function dataFileAsserts(): iterable
{
yield from $this->gatherAssertTypes(__DIR__ . '/data/query-result-to-array.php');
yield from self::gatherAssertTypes(__DIR__ . '/data/query-result-to-array.php');
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ class RepositoryQueryDynamicReturnTypeExtensionTest extends TypeInferenceTestCas
/**
* @return iterable<mixed>
*/
public function dataFileAsserts(): iterable
public static function dataFileAsserts(): iterable
{
yield from $this->gatherAssertTypes(__DIR__ . '/data/custom-query-type.php');
yield from self::gatherAssertTypes(__DIR__ . '/data/custom-query-type.php');
}

/**
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/Type/RepositoryStubFileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ class RepositoryStubFileTest extends TypeInferenceTestCase
/**
* @return iterable<mixed>
*/
public function dataFileAsserts(): iterable
public static function dataFileAsserts(): iterable
{
yield from $this->gatherAssertTypes(__DIR__ . '/data/repository-stub-files.php');
yield from self::gatherAssertTypes(__DIR__ . '/data/repository-stub-files.php');
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ class RequestGetAttributeDynamicReturnTypeExtensionTest extends TypeInferenceTes
/**
* @return iterable<mixed>
*/
public function dataFileAsserts(): iterable
public static function dataFileAsserts(): iterable
{
// path to a file with actual asserts of expected types:
yield from $this->gatherAssertTypes(__DIR__ . '/data/request-get-attribute-return-types.php');
yield from self::gatherAssertTypes(__DIR__ . '/data/request-get-attribute-return-types.php');
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ class SiteGetAttributeDynamicReturnTypeExtensionTest extends TypeInferenceTestCa
/**
* @return iterable<mixed>
*/
public function dataFileAsserts(): iterable
public static function dataFileAsserts(): iterable
{
// path to a file with actual asserts of expected types:
yield from $this->gatherAssertTypes(__DIR__ . '/data/site-get-attribute-return-types.php');
yield from self::gatherAssertTypes(__DIR__ . '/data/site-get-attribute-return-types.php');
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ final class UserAspectGetDynamicReturnTypeExtensionTest extends TypeInferenceTes
*
* @return iterable<mixed>
*/
public function dataFileAsserts(): iterable
public static function dataFileAsserts(): iterable
{
yield from $this->gatherAssertTypes(__DIR__ . '/data/user-aspect-get-return-types.php');
yield from self::gatherAssertTypes(__DIR__ . '/data/user-aspect-get-return-types.php');
}

/**
Expand Down

0 comments on commit a40ae22

Please sign in to comment.