DX: apply rector rules up to php8.0

This commit is contained in:
2023-04-15 01:05:37 +02:00
parent d8870e906f
commit dde3002100
714 changed files with 2348 additions and 9263 deletions

View File

@@ -27,10 +27,8 @@ final class UserApiControllerTest extends WebTestCase
/**
* @depends testIndex
*
* @param mixed $existingUser
*/
public function testEntity($existingUser)
public function testEntity(mixed $existingUser)
{
$client = $this->getClientAuthenticated();

View File

@@ -130,10 +130,8 @@ final class UserControllerTest extends WebTestCase
/**
* @dataProvider dataGenerateUserId
*
* @param mixed $username
*/
public function testUpdatePassword(int $userId, $username)
public function testUpdatePassword(int $userId, mixed $username)
{
$crawler = $this->client->request('GET', "/fr/admin/user/{$userId}/edit_password");
$newPassword = '1234Password!';

View File

@@ -161,11 +161,8 @@ final class CronManagerTest extends TestCase
class JobCanRun implements CronJobInterface
{
private string $key;
public function __construct(string $key)
public function __construct(private string $key)
{
$this->key = $key;
}
public function canRun(?CronJobExecution $cronJobExecution): bool

View File

@@ -305,17 +305,11 @@ final class ExportManagerTest extends KernelTestCase
Argument::is(['cat a', 'cat b']),
Argument::is([])
)
->willReturn(static function ($value) {
switch ($value) {
case '_header': return 'foo_header';
case 'cat a': return 'label cat a';
case 'cat b': return 'label cat b';
default:
throw new RuntimeException(sprintf('This value (%s) is not valid', $value));
}
->willReturn(static fn ($value) => match ($value) {
'_header' => 'foo_header',
'cat a' => 'label cat a',
'cat b' => 'label cat b',
default => throw new RuntimeException(sprintf('This value (%s) is not valid', $value)),
});
$aggregator->addRole()->willReturn(null);
//$aggregator->addRole()->shouldBeCalled();

View File

@@ -110,17 +110,15 @@ final class PageTest extends KernelTestCase
/**
* @param int $itemPerPage
* @param string $route
* @param mixed $number
* @param mixed $totalItems
*
* @return Page
*/
protected function generatePage(
$number = 1,
mixed $number = 1,
$itemPerPage = 10,
$route = 'route',
array $routeParameters = [],
$totalItems = 100
mixed $totalItems = 100
) {
$urlGenerator = $this->prophet->prophesize();
$urlGenerator->willImplement(UrlGeneratorInterface::class);

View File

@@ -149,14 +149,13 @@ final class PaginatorTest extends KernelTestCase
* @param int $totalItems
* @param int $itemPerPage
* @param int $currentPage
* @param mixed $expectedHasNextPage
* @dataProvider generateHasPreviousPage
*/
public function testHasPreviousPage(
$totalItems,
$itemPerPage,
$currentPage,
$expectedHasNextPage
mixed $expectedHasNextPage
) {
$paginator = $this->generatePaginator($totalItems, $itemPerPage, $currentPage);
@@ -215,15 +214,13 @@ final class PaginatorTest extends KernelTestCase
/**
* @param int $itemPerPage
* @param string $route
* @param mixed $totalItems
* @param mixed $currentPageNumber
*
* @return Paginator
*/
protected function generatePaginator(
$totalItems,
mixed $totalItems,
$itemPerPage,
$currentPageNumber = 1,
mixed $currentPageNumber = 1,
$route = '',
array $routeParameters = []
) {

View File

@@ -46,14 +46,8 @@ final class ExtractPhonenumberFromPatternTest extends KernelTestCase
/**
* @dataProvider provideData
*
* @param mixed $subject
* @param mixed $expectedCount
* @param mixed $expected
* @param mixed $filteredSubject
* @param mixed $msg
*/
public function testExtract(string $defaultCarrierCode, $subject, $expectedCount, $expected, $filteredSubject, $msg)
public function testExtract(string $defaultCarrierCode, mixed $subject, mixed $expectedCount, mixed $expected, mixed $filteredSubject, mixed $msg)
{
$extractor = new ExtractPhonenumberFromPattern(new ParameterBag(['chill_main' => [
'phone_helper' => ['default_carrier_code' => $defaultCarrierCode],

View File

@@ -230,12 +230,8 @@ final class AuthorizationHelperTest extends KernelTestCase
/**
* @dataProvider dataProvider_getReachableCenters
*
* @param mixed $test
* @param mixed $result
* @param mixed $msg
*/
public function testGetReachableCenters($test, $result, $msg)
public function testGetReachableCenters(mixed $test, mixed $result, mixed $msg)
{
$this->assertEquals($test, $result, $msg);
}

View File

@@ -68,14 +68,8 @@ final class DateNormalizerTest extends KernelTestCase
/**
* @dataProvider generateDataNormalize
*
* @param mixed $expected
* @param mixed $date
* @param mixed $format
* @param mixed $locale
* @param mixed $msg
*/
public function testNormalize($expected, $date, $format, $locale, $msg)
public function testNormalize(mixed $expected, mixed $date, mixed $format, mixed $locale, mixed $msg)
{
$this->assertEquals($expected, $this->buildDateNormalizer($locale)->normalize($date, $format, []), $msg);
}

View File

@@ -51,10 +51,8 @@ final class DoctrineExistingEntityNormalizerTest extends KernelTestCase
/**
* @dataProvider dataProviderUserId
*
* @param mixed $userId
*/
public function testGetMappedClass($userId)
public function testGetMappedClass(mixed $userId)
{
$data = ['type' => 'user', 'id' => $userId];
$supports = $this->normalizer->supportsDenormalization($data, User::class);

View File

@@ -38,12 +38,8 @@ final class PhonenumberNormalizerTest extends TestCase
/**
* @dataProvider dataProviderNormalizePhonenumber
*
* @param mixed $format
* @param mixed $context
* @param mixed $expected
*/
public function testNormalize(?Phonenumber $phonenumber, $format, $context, $expected)
public function testNormalize(?Phonenumber $phonenumber, mixed $format, mixed $context, mixed $expected)
{
$parameterBag = $this->prophesize(ParameterBagInterface::class);
$parameterBag->get(Argument::exact('chill_main'))->willReturn(['phone_helper' => ['default_carrier_code' => 'BE']]);

View File

@@ -21,14 +21,12 @@ class TestHelper
/**
* create a client authenticated with an user.
*
* @param mixed $username
* @param mixed $password
*
* @return \Symfony\Component\BrowserKit\Client authenticated client
*/
public static function getAuthenticatedClientOptions(
$username = 'center a_social',
$password = 'password'
mixed $username = 'center a_social',
mixed $password = 'password'
) {
return [
'PHP_AUTH_USER' => $username,