Skip to content

Commit

Permalink
Merge pull request #4780 from ecamp/renovate/friendsofphp-php-cs-fixe…
Browse files Browse the repository at this point in the history
…r-3.x

chore(deps): update dependency friendsofphp/php-cs-fixer to v3.52.1
  • Loading branch information
BacLuc committed Mar 24, 2024
2 parents df27136 + 7e9fbbb commit a8ef19d
Show file tree
Hide file tree
Showing 26 changed files with 52 additions and 51 deletions.
2 changes: 1 addition & 1 deletion api/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"webonyx/graphql-php": "15.11.1"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "3.49.0",
"friendsofphp/php-cs-fixer": "3.52.1",
"hautelook/alice-bundle": "2.13.0",
"justinrainbow/json-schema": "5.2.13",
"php-coveralls/php-coveralls": "2.7.0",
Expand Down
19 changes: 10 additions & 9 deletions api/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions api/src/Doctrine/Filter/ContentNodePeriodFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ final class ContentNodePeriodFilter extends AbstractFilter {
public function __construct(
private IriConverterInterface $iriConverter,
ManagerRegistry $managerRegistry,
LoggerInterface $logger = null,
array $properties = null,
NameConverterInterface $nameConverter = null
?LoggerInterface $logger = null,
?array $properties = null,
?NameConverterInterface $nameConverter = null
) {
parent::__construct($managerRegistry, $logger, $properties, $nameConverter);
}
Expand All @@ -46,7 +46,7 @@ protected function filterProperty(
QueryBuilder $queryBuilder,
QueryNameGeneratorInterface $queryNameGenerator,
string $resourceClass,
Operation $operation = null,
?Operation $operation = null,
array $context = []
): void {
if (ContentNode::class !== $resourceClass) {
Expand Down
2 changes: 1 addition & 1 deletion api/src/Doctrine/Filter/ExpressionDateTimeFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ protected function filterProperty(
QueryBuilder $queryBuilder,
QueryNameGeneratorInterface $queryNameGenerator,
string $resourceClass,
Operation $operation = null,
?Operation $operation = null,
array $context = []
): void {
if (
Expand Down
8 changes: 4 additions & 4 deletions api/src/Doctrine/Filter/MaterialItemPeriodFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ final class MaterialItemPeriodFilter extends AbstractFilter {
public function __construct(
private IriConverterInterface $iriConverter,
ManagerRegistry $managerRegistry,
LoggerInterface $logger = null,
array $properties = null,
NameConverterInterface $nameConverter = null
?LoggerInterface $logger = null,
?array $properties = null,
?NameConverterInterface $nameConverter = null
) {
parent::__construct($managerRegistry, $logger, $properties, $nameConverter);
}
Expand All @@ -48,7 +48,7 @@ protected function filterProperty(
QueryBuilder $queryBuilder,
QueryNameGeneratorInterface $queryNameGenerator,
string $resourceClass,
Operation $operation = null,
?Operation $operation = null,
array $context = []
): void {
if (MaterialItem::class !== $resourceClass) {
Expand Down
4 changes: 2 additions & 2 deletions api/src/Doctrine/FilterByCurrentUserExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ public function __construct(Security $security, EntityManagerInterface $entityMa
$this->entityManager = $entityManager;
}

public function applyToCollection(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass = null, Operation $operation = null, array $context = []): void {
public function applyToCollection(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, ?string $resourceClass = null, ?Operation $operation = null, array $context = []): void {
$this->addWhere($queryBuilder, $resourceClass);
}

public function applyToItem(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, array $identifiers, Operation $operation = null, array $context = []): void {
public function applyToItem(QueryBuilder $queryBuilder, QueryNameGeneratorInterface $queryNameGenerator, string $resourceClass, array $identifiers, ?Operation $operation = null, array $context = []): void {
$this->addWhere($queryBuilder, $resourceClass);
}

Expand Down
2 changes: 1 addition & 1 deletion api/src/Entity/CampCollaboration.php
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ public function removeDayResponsible(DayResponsible $dayResponsible): self {
/**
* Returns user's email, fallback to inviteEmail if user not yet known (pending email invitation).
*/
public function getEmail(): null|string {
public function getEmail(): ?string {
return $this->user?->getEmail() ?? $this->inviteEmail;
}
}
4 changes: 2 additions & 2 deletions api/src/Entity/ScheduleEntry.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public function getCamp(): ?Camp {
return $this->activity?->getCamp();
}

public function getPeriod(): null|Period {
public function getPeriod(): ?Period {
return $this->period;
}

Expand Down Expand Up @@ -221,7 +221,7 @@ public function getEmbeddedActivity(): ?Activity {
*/
#[ApiProperty(writable: false, example: '/days/1a2b3c4d')]
#[Groups(['read'])]
public function getDay(): null|Day {
public function getDay(): ?Day {
$dayOffset = $this->getDayOffset();

$filteredDays = $this->period->days->filter(function (Day $day) use ($dayOffset) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function denormalize($data, $type, $format = null, array $context = []):
/**
* {@inheritdoc}
*/
public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool {
public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool {
// Make sure we don't run this denormalizer twice.
if (isset($context[self::ALREADY_CALLED])) {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function denormalize($data, $type, $format = null, array $context = []):
/**
* {@inheritdoc}
*/
public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool {
public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool {
// Make sure we don't run this denormalizer twice.
if (isset($context[self::ALREADY_CALLED])) {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ final class CircularReferenceDetectingHalItemNormalizer extends AbstractItemNorm
*/
protected const HAL_CIRCULAR_REFERENCE_LIMIT_COUNTERS = 'hal_circular_reference_limit_counters';

public function __construct(private NormalizerInterface $decorated, PropertyNameCollectionFactoryInterface $propertyNameCollectionFactory, PropertyMetadataFactoryInterface $propertyMetadataFactory, IriConverterInterface $iriConverter, ResourceClassResolverInterface $resourceClassResolver, PropertyAccessorInterface $propertyAccessor = null, NameConverterInterface $nameConverter = null, ClassMetadataFactoryInterface $classMetadataFactory = null, array $defaultContext = [], ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory = null, ?ResourceAccessCheckerInterface $resourceAccessChecker = null) {
public function __construct(private NormalizerInterface $decorated, PropertyNameCollectionFactoryInterface $propertyNameCollectionFactory, PropertyMetadataFactoryInterface $propertyMetadataFactory, IriConverterInterface $iriConverter, ResourceClassResolverInterface $resourceClassResolver, ?PropertyAccessorInterface $propertyAccessor = null, ?NameConverterInterface $nameConverter = null, ?ClassMetadataFactoryInterface $classMetadataFactory = null, array $defaultContext = [], ?ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory = null, ?ResourceAccessCheckerInterface $resourceAccessChecker = null) {
$defaultContext[AbstractNormalizer::CIRCULAR_REFERENCE_HANDLER] = function ($object) {
return ['_links' => ['self' => ['href' => $this->iriConverter->getIriFromResource($object)]]];
};
Expand Down Expand Up @@ -91,7 +91,7 @@ protected function isHalCircularReference(object $object, array &$context) {
*
* @throws CircularReferenceException
*/
protected function handleHalCircularReference(object $object, string $format = null, array $context = []) {
protected function handleHalCircularReference(object $object, ?string $format = null, array $context = []) {
$circularReferenceHandler = $context[AbstractNormalizer::CIRCULAR_REFERENCE_HANDLER] ?? $this->defaultContext[AbstractNormalizer::CIRCULAR_REFERENCE_HANDLER];
if ($circularReferenceHandler) {
return $circularReferenceHandler($object, $format, $context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ public function __construct(
private readonly TranslateToAllLocalesService $translateToAllLocalesService
) {}

public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool {
public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool {
return $this->getNormalizerCollection()->exists(fn ($_, $elem) => $elem->supportsNormalization($data, $format, $context));
}

public function normalize(mixed $object, string $format = null, array $context = []): null|array|\ArrayObject|bool|float|int|string {
public function normalize(mixed $object, ?string $format = null, array $context = []): null|array|\ArrayObject|bool|float|int|string {
$normalizer = $this->getNormalizerCollection()->filter(fn ($elem) => $elem->supportsNormalization($object, $format, $context))->first();
if (false === $normalizer) {
throw new \RuntimeException("Did not find a normalizer to normalize response to format {$format}");
Expand Down Expand Up @@ -75,7 +75,7 @@ public function getSupportedTypes(?string $format): array {
->map(function (AbstractConstraintViolationListNormalizer $normalizer) use ($format) {
return $normalizer->getSupportedTypes($format);
})
->reduce(fn (null|array $left, array $right) => array_merge($left ?? [], $right), [])
->reduce(fn (?array $left, array $right) => array_merge($left ?? [], $right), [])
;
}

Expand Down
2 changes: 1 addition & 1 deletion api/src/State/PeriodPersistProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function onBefore($data, Operation $operation, array $uriVariables = [],
return $data;
}

public static function moveDaysAndScheduleEntries(Period $period, Period $originalPeriod = null) {
public static function moveDaysAndScheduleEntries(Period $period, ?Period $originalPeriod = null) {
if (!$originalPeriod) {
return;
}
Expand Down
4 changes: 2 additions & 2 deletions api/src/Util/GetCampFromContentNodeTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Doctrine\ORM\EntityManagerInterface;

trait GetCampFromContentNodeTrait {
private function getCampFromInterface(mixed $subject, EntityManagerInterface $em): null|Camp {
private function getCampFromInterface(mixed $subject, EntityManagerInterface $em): ?Camp {
if ($subject instanceof BelongsToCampInterface) {
return $subject->getCamp();
}
Expand All @@ -22,7 +22,7 @@ private function getCampFromInterface(mixed $subject, EntityManagerInterface $em
return null;
}

private function getCampFromContentNode(BelongsToContentNodeTreeInterface $subject, EntityManagerInterface $em): null|Camp {
private function getCampFromContentNode(BelongsToContentNodeTreeInterface $subject, EntityManagerInterface $em): ?Camp {
$rootContentNode = $subject->getRoot();

$activity = $em
Expand Down
4 changes: 2 additions & 2 deletions api/src/Validator/AllowTransition/AssertAllowTransitions.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
class AssertAllowTransitions extends Constraint {
public function __construct(
public array $transitions,
array $options = null,
array $groups = null,
?array $options = null,
?array $groups = null,
$payload = null
) {
parent::__construct($options ?? [], $groups, $payload);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
class AssertAllowTransitionsValidator extends ConstraintValidator {
public const TO_VIOLATION_MESSAGE = 'value must be one of {{ to }}, was {{ value }}';
public const FROM_VIOLATION_MESSAGE = 'This value was previously in an unexpected state,'.
' expected one of {{ from }}, but was {{ previousValue }}';
' expected one of {{ from }}, but was {{ previousValue }}';

public function __construct(public RequestStack $requestStack) {}

Expand Down
2 changes: 1 addition & 1 deletion api/src/Validator/AssertBelongsToSameCamp.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class AssertBelongsToSameCamp extends Constraint {
*
* @param bool $compareToPrevious in case the camp getter considers the annotated property, use this option (only when updating)
*/
public function __construct(array $options = null, bool $compareToPrevious = false, string $message = null, array $groups = null, mixed $payload = null) {
public function __construct(?array $options = null, bool $compareToPrevious = false, ?string $message = null, ?array $groups = null, mixed $payload = null) {
parent::__construct($options ?? [], $groups, $payload);

$this->message = $message ?? $this->message;
Expand Down
2 changes: 1 addition & 1 deletion api/src/Validator/AssertContainsAtLeastOneManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
class AssertContainsAtLeastOneManager extends Constraint {
public string $message = 'must have at least one manager.';

public function __construct(array $options = null, array $groups = null, $payload = null) {
public function __construct(?array $options = null, ?array $groups = null, $payload = null) {
parent::__construct($options ?? [], $groups, $payload);
}
}
2 changes: 1 addition & 1 deletion api/src/Validator/AssertEitherIsNull.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class AssertEitherIsNull extends Constraint {
public string $messageNoneNull = 'Either this value or {{ other }} should be null.';
public string $other;

public function __construct(array $options = null, string $other = null, string $messageBothNull = null, string $messageNoneNull = null, array $groups = null, $payload = null) {
public function __construct(?array $options = null, ?string $other = null, ?string $messageBothNull = null, ?string $messageNoneNull = null, ?array $groups = null, $payload = null) {
parent::__construct($options ?? [], $groups, $payload);

$this->messageBothNull = $messageBothNull ?? $this->messageBothNull;
Expand Down
2 changes: 1 addition & 1 deletion api/src/Validator/AssertJsonSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class AssertJsonSchema extends Constraint {
'type' => 'object',
];

public function __construct(array $options = null, string $message = null, array $schema = null, array $groups = null, $payload = null) {
public function __construct(?array $options = null, ?string $message = null, ?array $schema = null, ?array $groups = null, $payload = null) {
parent::__construct($options ?? [], $groups, $payload);

$this->message = $message ?? $this->message;
Expand Down
6 changes: 3 additions & 3 deletions api/src/Validator/AssertLastCollectionItemIsNotDeleted.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ class AssertLastCollectionItemIsNotDeleted extends Constraint {
public string $message = 'Cannot delete the last entry.';

public function __construct(
array $options = null,
string $message = null,
array $groups = null,
?array $options = null,
?string $message = null,
?array $groups = null,
mixed $payload = null
) {
parent::__construct($options ?? [], $groups, $payload);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
class AssertColumWidthsSumTo12 extends Constraint {
public string $message = 'Expected column widths to sum to 12, but got a sum of {{ sum }}';

public function __construct(array $options = null, string $message = null, array $groups = null, $payload = null) {
public function __construct(?array $options = null, ?string $message = null, ?array $groups = null, $payload = null) {
parent::__construct($options ?? [], $groups, $payload);

$this->message = $message ?? $this->message;
Expand Down
2 changes: 1 addition & 1 deletion api/src/Validator/ColumnLayout/AssertNoOrphanChildren.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
class AssertNoOrphanChildren extends Constraint {
public string $message = 'The following slots still have child contents and should be present in the columns: {{ slots }}';

public function __construct(array $options = null, string $message = null, array $groups = null, $payload = null) {
public function __construct(?array $options = null, ?string $message = null, ?array $groups = null, $payload = null) {
parent::__construct($options ?? [], $groups, $payload);

$this->message = $message ?? $this->message;
Expand Down
4 changes: 2 additions & 2 deletions api/src/Validator/ContentNode/AssertSlotSupportedByParent.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ public function __construct(
public readonly string $message = self::MESSAGE,
public readonly string $noParentMessage = self::NO_PARENT_MESSAGE,
public readonly string $parentDoesNotSupportChildrenMessage = self::PARENT_DOES_NOT_SUPPORT_CHILDREN,
array $options = null,
array $groups = null,
?array $options = null,
?array $groups = null,
$payload = null
) {
parent::__construct($options ?? [], $groups, $payload);
Expand Down
2 changes: 1 addition & 1 deletion api/tests/Api/ECampApiTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ protected function delete(?BaseEntity $entity = null, ?User $user = null) {
return static::createClientWithCredentials($credentials)->request('DELETE', $this->endpoint.'/'.$entity->getId());
}

protected function create(array $payload = null, ?User $user = null) {
protected function create(?array $payload = null, ?User $user = null) {
$credentials = null;
if (null !== $user) {
$credentials = ['email' => $user->getEmail()];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ public static function getConstraintViolations(): array {

class MyConstraint extends Constraint {
public function __construct(
array $options = null,
array $groups = null,
?array $options = null,
?array $groups = null,
$payload = null
) {
parent::__construct($options ?? [], $groups, $payload);
Expand Down

0 comments on commit a8ef19d

Please sign in to comment.