Skip to content

Commit

Permalink
Merge 1.x into 2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
SonataCI authored Oct 15, 2023
2 parents 74f2a96 + 3961b61 commit d1c2016
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 19 deletions.
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 @@ -37,7 +37,7 @@
"phpunit/phpunit": "^9.5.13",
"psalm/plugin-phpunit": "^0.18",
"psalm/plugin-symfony": "^5.0",
"rector/rector": "^0.17",
"rector/rector": "^0.18",
"symfony/browser-kit": "^5.4 || ^6.2",
"symfony/cache": "^5.4 || ^6.2",
"symfony/filesystem": "^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,
]);
};
6 changes: 2 additions & 4 deletions src/Collection/AuditedCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\ReadableCollection;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use SimpleThings\EntityAudit\AuditConfiguration;
use SimpleThings\EntityAudit\AuditReader;
Expand Down Expand Up @@ -295,7 +294,6 @@ public function exists(\Closure $p)
*
* @phpstan-param \Closure(T, int|string):bool $p
* @psalm-param \Closure(T=):bool $p
* @phpstan-return ReadableCollection<TKey, T>
* @psalm-return Collection<TKey, T>
*/
#[\ReturnTypeWillChange]
Expand Down Expand Up @@ -324,8 +322,9 @@ public function forAll(\Closure $p)
*
* @phpstan-template U
* @phpstan-param \Closure(T):U $func
* @phpstan-return ReadableCollection<TKey, U>
* @psalm-return Collection<TKey, U>
*
* @psalm-suppress ImplementedParamTypeMismatch,InvalidArgument
*/
#[\ReturnTypeWillChange]
public function map(\Closure $func)
Expand All @@ -339,7 +338,6 @@ public function map(\Closure $func)
* @return array<Collection<TKey, T>>
*
* @phpstan-param \Closure(TKey, T):bool $p
* @phpstan-return array{0: ReadableCollection<TKey, T>, 1: ReadableCollection<TKey, T>}
* @psalm-return array{0: Collection<TKey, T>, 1: Collection<TKey, T>}
*/
#[\ReturnTypeWillChange]
Expand Down
4 changes: 2 additions & 2 deletions tests/Functional/SmokeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
final class SmokeTest extends WebTestCase
{
/**
* @dataProvider provideUrls
* @dataProvider provideSuccessfulResponsesCases
*/
public function testSuccessfulResponses(string $url): void
{
Expand All @@ -34,7 +34,7 @@ public function testSuccessfulResponses(string $url): void
/**
* @return iterable<array{string}>
*/
public function provideUrls(): iterable
public function provideSuccessfulResponsesCases(): iterable
{
yield 'index' => ['/audit'];
yield 'view revision' => ['/audit/viewrev/1'];
Expand Down
6 changes: 3 additions & 3 deletions tests/RelationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -928,9 +928,9 @@ public function testOneToManyCollectionDeletedElements(): void
$ids[] = $ownedElement->getId();
}

static::assertTrue(\in_array($ownedOne->getId(), $ids, true));
static::assertTrue(\in_array($ownedThree->getId(), $ids, true));
static::assertTrue(\in_array($ownedFour->getId(), $ids, true));
static::assertContains($ownedOne->getId(), $ids);
static::assertContains($ownedThree->getId(), $ids);
static::assertContains($ownedFour->getId(), $ids);
}

public function testOneToOneEdgeCase(): void
Expand Down
16 changes: 7 additions & 9 deletions tests/Utils/SimpleDiffTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
final class SimpleDiffTest extends TestCase
{
/**
* @dataProvider dataDiff
* @dataProvider provideDiffCases
*/
public function testDiff(string $old, string $new, string $output): void
{
Expand All @@ -32,14 +32,12 @@ public function testDiff(string $old, string $new, string $output): void
/**
* @return iterable<array{string, string, string}>
*/
public static function dataDiff(): iterable
public static function provideDiffCases(): iterable
{
return [
['Foo', 'foo', '<del>Foo</del> <ins>foo</ins> '],
['Foo Foo', 'Foo', 'Foo <del>Foo</del> '],
['Foo', 'Foo Foo', 'Foo <ins>Foo</ins> '],
['Foo Bar Baz', 'Foo Foo Foo', 'Foo <del>Bar Baz</del> <ins>Foo Foo</ins> '],
['Foo Bar Baz', 'Foo Baz', 'Foo <del>Bar</del> Baz '],
];
yield ['Foo', 'foo', '<del>Foo</del> <ins>foo</ins> '];
yield ['Foo Foo', 'Foo', 'Foo <del>Foo</del> '];
yield ['Foo', 'Foo Foo', 'Foo <ins>Foo</ins> '];
yield ['Foo Bar Baz', 'Foo Foo Foo', 'Foo <del>Bar Baz</del> <ins>Foo Foo</ins> '];
yield ['Foo Bar Baz', 'Foo Baz', 'Foo <del>Bar</del> Baz '];
}
}

0 comments on commit d1c2016

Please sign in to comment.