apply rector rules: php up to php82

This commit is contained in:
2023-07-19 23:16:01 +02:00
parent 7b637d1287
commit 023a29cb78
744 changed files with 1369 additions and 1381 deletions

View File

@@ -38,7 +38,7 @@ class ParticipationController extends AbstractController
/**
* ParticipationController constructor.
*/
public function __construct(private LoggerInterface $logger)
public function __construct(private readonly LoggerInterface $logger)
{
}
@@ -584,7 +584,7 @@ class ParticipationController extends AbstractController
$persons_ids = $request->query->has('person_id') ?
[$request->query->getInt('person_id', 0)] // sf4 check:
// prevent error: `Argument 2 passed to ::getInt() must be of the type int, null given`
: explode(',', $request->query->get('persons_ids'));
: explode(',', (string) $request->query->get('persons_ids'));
$participations = [];
foreach ($persons_ids as $person_id) {
@@ -749,7 +749,7 @@ class ParticipationController extends AbstractController
if (true === $multiple) {
$persons_ids = $request->query->get('persons_ids');
if (!preg_match('/^([0-9]{1,},{0,1}){1,}[0-9]{0,}$/', $persons_ids)) {
if (!preg_match('/^([0-9]{1,},{0,1}){1,}[0-9]{0,}$/', (string) $persons_ids)) {
throw new RuntimeException('The persons_ids value should '
. "contains int separated by ','");
}

View File

@@ -176,7 +176,7 @@ class Event implements HasCenterInterface, HasScopeInterface
{
$iterator = iterator_to_array($this->participations->getIterator());
uasort($iterator, static fn ($first, $second) => strnatcasecmp($first->getPerson()->getFirstName(), $second->getPerson()->getFirstName()));
uasort($iterator, static fn ($first, $second) => strnatcasecmp((string) $first->getPerson()->getFirstName(), (string) $second->getPerson()->getFirstName()));
return new ArrayIterator($iterator);
}

View File

@@ -39,14 +39,14 @@ use function count;
*/
class EventSearch extends AbstractSearch
{
public const NAME = 'event_regular';
final public const NAME = 'event_regular';
public function __construct(
private Security $security,
private EventRepository $er,
private AuthorizationHelper $authorizationHelper,
private TemplatingEngine $templating,
private PaginatorFactory $paginationFactory
private readonly Security $security,
private readonly EventRepository $er,
private readonly AuthorizationHelper $authorizationHelper,
private readonly TemplatingEngine $templating,
private readonly PaginatorFactory $paginationFactory
) {
}

View File

@@ -31,20 +31,20 @@ use function in_array;
*/
class EventVoter extends AbstractChillVoter implements ProvideRoleHierarchyInterface
{
public const CREATE = 'CHILL_EVENT_CREATE';
final public const CREATE = 'CHILL_EVENT_CREATE';
public const ROLES = [
final public const ROLES = [
self::SEE,
self::SEE_DETAILS,
self::CREATE,
self::UPDATE,
];
public const SEE = 'CHILL_EVENT_SEE';
final public const SEE = 'CHILL_EVENT_SEE';
public const SEE_DETAILS = 'CHILL_EVENT_SEE_DETAILS';
final public const SEE_DETAILS = 'CHILL_EVENT_SEE_DETAILS';
public const UPDATE = 'CHILL_EVENT_UPDATE';
final public const UPDATE = 'CHILL_EVENT_UPDATE';
/**
* @var AccessDecisionManagerInterface

View File

@@ -28,20 +28,20 @@ use function in_array;
class ParticipationVoter extends AbstractChillVoter implements ProvideRoleHierarchyInterface
{
public const CREATE = 'CHILL_EVENT_PARTICIPATION_CREATE';
final public const CREATE = 'CHILL_EVENT_PARTICIPATION_CREATE';
public const ROLES = [
final public const ROLES = [
self::SEE,
self::SEE_DETAILS,
self::CREATE,
self::UPDATE,
];
public const SEE = 'CHILL_EVENT_PARTICIPATION_SEE';
final public const SEE = 'CHILL_EVENT_PARTICIPATION_SEE';
public const SEE_DETAILS = 'CHILL_EVENT_PARTICIPATION_SEE_DETAILS';
final public const SEE_DETAILS = 'CHILL_EVENT_PARTICIPATION_SEE_DETAILS';
public const UPDATE = 'CHILL_EVENT_PARTICIPATION_UPDATE';
final public const UPDATE = 'CHILL_EVENT_PARTICIPATION_UPDATE';
/**
* @var AccessDecisionManagerInterface

View File

@@ -19,7 +19,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
*/
final class EventControllerTest extends WebTestCase
{
public function testSkipped()
public function testSkipped(): never
{
$this->markTestSkipped();
}

View File

@@ -19,7 +19,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
*/
final class EventTypeControllerTest extends WebTestCase
{
public function testSkipped()
public function testSkipped(): never
{
$this->markTestSkipped();
}

View File

@@ -19,7 +19,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
*/
final class RoleControllerTest extends WebTestCase
{
public function testSkipped()
public function testSkipped(): never
{
$this->markTestSkipped();
}

View File

@@ -19,7 +19,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
*/
final class StatusControllerTest extends WebTestCase
{
public function testSkipped()
public function testSkipped(): never
{
$this->markTestSkipped();
}

View File

@@ -373,7 +373,7 @@ final class EventSearchTest extends WebTestCase
// get the second node, which should contains a date
$tdDate = $tr->filter('td')->eq(1);
// transform the date, which should be in french, into a DateTime object
$parts = explode(' ', $tdDate->text());
$parts = explode(' ', (string) $tdDate->text());
return DateTime::createFromFormat('Y-m-d', $parts[2] .
'-' . $months[$parts[1]] . '-' . $parts[0]);