Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DevKit updates for 3.x branch #647

Merged
merged 3 commits into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
]],
'php_unit_strict' => true,
'php_unit_test_case_static_method_calls' => true,
'php_unit_data_provider_name' => true,
'php_unit_data_provider_return_type' => true,
'phpdoc_to_comment' => ['ignored_tags' => ['psalm-suppress', 'phpstan-var']],
'single_line_throw' => false,
'static_lambda' => true,
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"phpunit/phpunit": "^9.5",
"psalm/plugin-phpunit": "^0.18",
"psalm/plugin-symfony": "^5.0",
"rector/rector": "^0.17",
"rector/rector": "^0.18",
"symfony/config": "^5.4 || ^6.2",
"symfony/dependency-injection": "^5.4 || ^6.2",
"symfony/http-foundation": "^5.4 || ^6.2",
Expand Down
8 changes: 8 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
use Rector\Config\RectorConfig;
use Rector\Php70\Rector\FunctionLike\ExceptionHandlerTypehintRector;
use Rector\Php71\Rector\FuncCall\CountOnNullRector;
use Rector\PHPUnit\CodeQuality\Rector\Class_\AddSeeTestAnnotationRector;
use Rector\PHPUnit\CodeQuality\Rector\Class_\PreferPHPUnitThisCallRector;
use Rector\PHPUnit\Set\PHPUnitLevelSetList;
use Rector\PHPUnit\Set\PHPUnitSetList;
use Rector\Set\ValueObject\LevelSetList;

return static function (RectorConfig $rectorConfig): void {
Expand All @@ -30,12 +34,16 @@

$rectorConfig->sets([
LevelSetList::UP_TO_PHP_80,
PHPUnitLevelSetList::UP_TO_PHPUNIT_90,
PHPUnitSetList::PHPUNIT_CODE_QUALITY,
]);

$rectorConfig->importNames();
$rectorConfig->importShortClasses(false);
$rectorConfig->skip([
CountOnNullRector::class,
ExceptionHandlerTypehintRector::class,
AddSeeTestAnnotationRector::class,
PreferPHPUnitThisCallRector::class,
]);
};
18 changes: 8 additions & 10 deletions tests/ExporterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function testGetAvailableFormats(): void
}

/**
* @dataProvider getGetResponseTests
* @dataProvider provideGetResponseCases
*/
public function testGetResponse(string $format, string $filename, string $contentType, string $expectedOutput): void
{
Expand Down Expand Up @@ -90,16 +90,14 @@ public function testGetResponse(string $format, string $filename, string $conten
}

/**
* @return array<array{string, string, string, string}>
* @return iterable<array{string, string, string, string}>
*/
public function getGetResponseTests(): array
public function provideGetResponseCases(): iterable
{
return [
['json', 'foo.json', 'application/json', '#foo#'],
['xml', 'foo.xml', 'text/xml', '#foo#'],
['xls', 'foo.xls', 'application/vnd.ms-excel', '#foo#'],
['csv', 'foo.csv', 'text/csv', '#foo#'],
['made-up', 'foo.made-up', 'application/made-up', '##'],
];
yield ['json', 'foo.json', 'application/json', '#foo#'];
yield ['xml', 'foo.xml', 'text/xml', '#foo#'];
yield ['xls', 'foo.xls', 'application/vnd.ms-excel', '#foo#'];
yield ['csv', 'foo.csv', 'text/csv', '#foo#'];
yield ['made-up', 'foo.made-up', 'application/made-up', '##'];
}
}
6 changes: 3 additions & 3 deletions tests/Source/AbstractPropertySourceIteratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
final class AbstractPropertySourceIteratorTest extends TestCase
{
/**
* @dataProvider getValueProvider
* @dataProvider provideGetValueCases
*/
public function testGetValue(mixed $value, mixed $expected, string $dateFormat = 'r'): void
{
Expand All @@ -41,9 +41,9 @@ public function getValue(mixed $value): bool|int|float|string|null
}

/**
* @return array<array{0: mixed, 1: mixed, 2?: string}>
* @return iterable<array{0: mixed, 1: mixed, 2?: string}>
*/
public function getValueProvider(): array
public function provideGetValueCases(): iterable
{
$datetime = new \DateTime();
$dateTimeImmutable = new \DateTimeImmutable();
Expand Down
2 changes: 1 addition & 1 deletion tests/Writer/JsonWriterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@ public function testWrite(): void
['john 3', 'doe', '1'],
];

static::assertSame($expected, json_decode($content, false));
static::assertSame($expected, json_decode($content, false, 512, \JSON_THROW_ON_ERROR));
}
}