apply rules rector up to php82

This commit is contained in:
2023-05-01 21:39:45 +02:00
parent 81e8928344
commit 6d63177ff4
733 changed files with 1257 additions and 1322 deletions

View File

@@ -86,7 +86,7 @@ final class AccompanyingPeriodConfidentialTest extends WebTestCase
}
}
public function testConfidentialValid()
public function testConfidentialValid(): never
{
$this->markTestIncomplete(
'Marked as incomplete because of a problem in the dataprovider, at line 81.'

View File

@@ -316,7 +316,7 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
json_encode(['type' => 'person', 'id' => $personId], JSON_THROW_ON_ERROR)
);
$response = $this->client->getResponse();
$data = json_decode($response->getContent(), true, 512, JSON_THROW_ON_ERROR);
$data = json_decode((string) $response->getContent(), true, 512, JSON_THROW_ON_ERROR);
$this->assertTrue(in_array($response->getStatusCode(), [200, 422], true));
@@ -338,7 +338,7 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
}
$response = $this->client->getResponse();
$data = json_decode($response->getContent(), null, 512, JSON_THROW_ON_ERROR);
$data = json_decode((string) $response->getContent(), null, 512, JSON_THROW_ON_ERROR);
// check that the person id is contained
$participationsPersonsIds = array_map(
@@ -358,7 +358,7 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
json_encode(['type' => 'person', 'id' => $personId], JSON_THROW_ON_ERROR)
);
$response = $this->client->getResponse();
$data = json_decode($response->getContent(), true, 512, JSON_THROW_ON_ERROR);
$data = json_decode((string) $response->getContent(), true, 512, JSON_THROW_ON_ERROR);
$this->assertTrue(in_array($response->getStatusCode(), [200, 422], true));
@@ -394,7 +394,7 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
$this->markTestSkipped('the next tests should appears only on valid accompanying period');
}
$data = json_decode($this->client->getResponse()->getContent(), true, 512, JSON_THROW_ON_ERROR);
$data = json_decode((string) $this->client->getResponse()->getContent(), true, 512, JSON_THROW_ON_ERROR);
$this->assertArrayHasKey('id', $data);
$this->assertArrayHasKey('type', $data);
$this->assertEquals('social_issue', $data['type']);
@@ -425,7 +425,7 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
$this->markTestSkipped('the next tests should appears only on valid accompanying period');
}
$data = json_decode($response->getContent(), null, 512, JSON_THROW_ON_ERROR);
$data = json_decode((string) $response->getContent(), null, 512, JSON_THROW_ON_ERROR);
$this->assertEquals(
$data->id,
$periodId,
@@ -487,7 +487,7 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
json_encode(['type' => 'accompanying_period_comment', 'content' => 'this is a text'])
);
$response = $this->client->getResponse();
$data = json_decode($response->getContent(), true, 512, JSON_THROW_ON_ERROR);
$data = json_decode((string) $response->getContent(), true, 512, JSON_THROW_ON_ERROR);
$this->assertTrue(in_array($response->getStatusCode(), [200, 422], true));
@@ -506,7 +506,7 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
json_encode(['type' => 'accompanying_period_comment', 'id' => $data['id']], JSON_THROW_ON_ERROR)
);
$response = $this->client->getResponse();
$data = json_decode($response->getContent(), true, 512, JSON_THROW_ON_ERROR);
$data = json_decode((string) $response->getContent(), true, 512, JSON_THROW_ON_ERROR);
$this->assertTrue(in_array($response->getStatusCode(), [200, 422], true));
}
@@ -563,7 +563,7 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
json_encode(['type' => 'person', 'id' => $personId], JSON_THROW_ON_ERROR)
);
$response = $this->client->getResponse();
$data = json_decode($response->getContent(), true, 512, JSON_THROW_ON_ERROR);
$data = json_decode((string) $response->getContent(), true, 512, JSON_THROW_ON_ERROR);
$this->assertTrue(in_array($response->getStatusCode(), [200, 422], true));
@@ -590,7 +590,7 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
json_encode(['type' => 'thirdparty', 'id' => $thirdPartyId], JSON_THROW_ON_ERROR)
);
$response = $this->client->getResponse();
$data = json_decode($response->getContent(), true, 512, JSON_THROW_ON_ERROR);
$data = json_decode((string) $response->getContent(), true, 512, JSON_THROW_ON_ERROR);
$this->assertTrue(in_array($response->getStatusCode(), [200, 422], true));
@@ -644,7 +644,7 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
json_encode(['type' => 'accompanying_period_resource', 'resource' => ['type' => 'person', 'id' => $personId]])
);
$response = $this->client->getResponse();
$data = json_decode($response->getContent(), true, 512, JSON_THROW_ON_ERROR);
$data = json_decode((string) $response->getContent(), true, 512, JSON_THROW_ON_ERROR);
$this->assertTrue(in_array($response->getStatusCode(), [200, 422], true));
@@ -688,7 +688,7 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
json_encode(['type' => 'accompanying_period_resource', 'resource' => ['type' => 'thirdparty', 'id' => $thirdPartyId]])
);
$response = $this->client->getResponse();
$data = json_decode($response->getContent(), true, 512, JSON_THROW_ON_ERROR);
$data = json_decode((string) $response->getContent(), true, 512, JSON_THROW_ON_ERROR);
$this->assertTrue(in_array($response->getStatusCode(), [200, 422], true));

View File

@@ -70,7 +70,7 @@ final class AccompanyingCourseControllerTest extends WebTestCase
$this->assertResponseRedirects();
$location = $this->client->getResponse()->headers->get('Location');
$this->assertEquals(1, preg_match('|^\\/[^\\/]+\\/parcours/([\\d]+)/edit$|', $location));
$this->assertEquals(1, preg_match('|^\\/[^\\/]+\\/parcours/([\\d]+)/edit$|', (string) $location));
}
/**
@@ -89,7 +89,7 @@ final class AccompanyingCourseControllerTest extends WebTestCase
$location = $this->client->getResponse()->headers->get('Location');
$matches = [];
$this->assertEquals(1, preg_match('|^\\/[^\\/]+\\/parcours/([\\d]+)/edit$|', $location, $matches));
$this->assertEquals(1, preg_match('|^\\/[^\\/]+\\/parcours/([\\d]+)/edit$|', (string) $location, $matches));
$id = $matches[1];
$period = self::$container->get(EntityManagerInterface::class)

View File

@@ -270,7 +270,7 @@ final class AccompanyingPeriodControllerTest extends WebTestCase
* Then the response should not redirect to any page
* and an error element is shown
*/
public function testCreatePeriodWithClosingAfterCurrentFails()
public function testCreatePeriodWithClosingAfterCurrentFails(): never
{
$this->markTestSkipped('Multiple period may now cover. This test is kept ' .
'in case of a configuration may add this feature again');
@@ -438,7 +438,7 @@ final class AccompanyingPeriodControllerTest extends WebTestCase
* Then the response should not redirect to any page
* and an error element is shown
*/
public function testCreatePeriodWithOpeningAndClosingAfterCurrentFails()
public function testCreatePeriodWithOpeningAndClosingAfterCurrentFails(): never
{
$this->markTestSkipped('Multiple period may now cover. This test is kept ' .
'in case of a configuration may add this feature again');
@@ -470,7 +470,7 @@ final class AccompanyingPeriodControllerTest extends WebTestCase
/**
* @group reopening
*/
public function testReOpeningPeriod()
public function testReOpeningPeriod(): never
{
// test that re-opening a period which is opened does not work
$this->client->request(

View File

@@ -69,7 +69,7 @@ final class PersonControllerViewWithHiddenFieldsTest extends WebTestCase
*
* @group configurable_fields
*/
public function testViewPerson()
public function testViewPerson(): never
{
$this->markTestSkipped('This configuration does not allow multiple environnements');
$client = self::createClient(

View File

@@ -51,7 +51,7 @@ final class PickPersonTypeTest extends KernelTestCase
/**
* test with an invalid center type in the option 'centers' (in an array).
*/
public function testWithInvalidOptionCenters()
public function testWithInvalidOptionCenters(): never
{
$this->expectException(RuntimeException::class);
@@ -128,7 +128,7 @@ final class PickPersonTypeTest extends KernelTestCase
);
}
public function testWithOptionRoleInvalid()
public function testWithOptionRoleInvalid(): never
{
$this->markTestSkipped('need to inject locale into url generator without request');
$form = $this->formFactory

View File

@@ -21,7 +21,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
*/
final class PersonSearchTest extends WebTestCase
{
public function testDefaultAccented()
public function testDefaultAccented(): never
{
$this->markTestSkipped('skipped until adapted to new fixtures');
$crawlerSpecial = $this->generateCrawlerForSearch('@person manço');
@@ -135,7 +135,7 @@ final class PersonSearchTest extends WebTestCase
$this->assertMatchesRegularExpression('/DEPARDIEU/', $crawler->filter('.list-with-period')->text());
}
public function testSearchCombineBirthdateAndLastName()
public function testSearchCombineBirthdateAndLastName(): never
{
$this->markTestSkipped('skipped until adapted to new fixtures');
$crawler = $this->generateCrawlerForSearch('@person birthdate:1948-12-27 lastname:(Van Snick)');
@@ -144,7 +144,7 @@ final class PersonSearchTest extends WebTestCase
$this->assertDoesNotMatchRegularExpression('/DEPARDIEU/', $crawler->filter('.list-with-period')->text());
}
public function testSearchCombineGenderAndLastName()
public function testSearchCombineGenderAndLastName(): never
{
$this->markTestSkipped('skipped until adapted to new fixtures');
$crawler = $this->generateCrawlerForSearch('@person gender:woman lastname:(Depardieu)');
@@ -153,7 +153,7 @@ final class PersonSearchTest extends WebTestCase
$this->assertDoesNotMatchRegularExpression('/Gérard/', $crawler->filter('.list-with-period')->text());
}
public function testSearchCombineLastnameAndFirstName()
public function testSearchCombineLastnameAndFirstName(): never
{
$this->markTestSkipped('skipped until adapted to new fixtures');
$crawler = $this->generateCrawlerForSearch('@person lastname:Depardieu firstname:Jean');
@@ -167,7 +167,7 @@ final class PersonSearchTest extends WebTestCase
);
}
public function testSearchCombineLastnameAndNationality()
public function testSearchCombineLastnameAndNationality(): never
{
$this->markTestSkipped('skipped until adapted to new fixtures');
$crawler = $this->generateCrawlerForSearch('@person lastname:Depardieu nationality:RU');
@@ -181,7 +181,7 @@ final class PersonSearchTest extends WebTestCase
);
}
public function testSearchMultipleTrigramUseAndClauseInDefault()
public function testSearchMultipleTrigramUseAndClauseInDefault(): never
{
$this->markTestSkipped('skipped until adapted to new fixtures');
$crawler = $this->generateCrawlerForSearch('@person cha dep');

View File

@@ -96,7 +96,7 @@ final class AccompanyingPeriodWorkEvaluationDenormalizerTest extends TestCase
"id": 382
}';
public function testAssociatedDocumentIsTheSame()
public function testAssociatedDocumentIsTheSame(): never
{
$this->markTestIncomplete('not yet finished');
$evaluation = new AccompanyingPeriodWorkEvaluation();

View File

@@ -30,7 +30,7 @@ final class HouseholdNormalizerTest extends KernelTestCase
private ?NormalizerInterface $normalizer;
private array $toDelete;
private readonly array $toDelete;
protected function setUp(): void
{

View File

@@ -95,11 +95,7 @@ final class PersonDocGenNormalizerTest extends KernelTestCase
->setFirstName('Renaud')
->setLastName('Mégane');
$expected = array_merge(
self::BLANK,
['firstName' => 'Renaud', 'lastName' => 'Mégane',
'text' => 'Renaud Mégane', ]
);
$expected = [...self::BLANK, 'firstName' => 'Renaud', 'lastName' => 'Mégane', 'text' => 'Renaud Mégane'];
yield [$person, $expected, 'partial normalization for a person'];

View File

@@ -59,7 +59,7 @@ final class TimelineAccompanyingPeriodTest extends WebTestCase
/**
* @dataProvider provideDataPersonWithAccompanyingPeriod
*/
public function testEntriesAreShown(mixed $personId)
public function testEntriesAreShown(mixed $personId): never
{
$this->markTestSkipped('page does not work');