Skip to content

Commit

Permalink
Merge pull request #6317 from ecamp/renovate/major-phpstan-packages
Browse files Browse the repository at this point in the history
chore(deps): update dependency phpstan/phpstan and rector/rector to v2
  • Loading branch information
BacLuc authored Jan 14, 2025
2 parents b2c52ec + 2c495bf commit e5c46a1
Show file tree
Hide file tree
Showing 11 changed files with 35 additions and 38 deletions.
4 changes: 2 additions & 2 deletions api/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@
"justinrainbow/json-schema": "6.0.0",
"php-coveralls/php-coveralls": "2.7.0",
"phpspec/prophecy-phpunit": "2.3.0",
"phpstan/phpstan": "1.12.15",
"phpstan/phpstan": "2.1.0",
"phpunit/phpunit": "11.5.3",
"rector/rector": "1.2.10",
"rector/rector": "2.0.5",
"psalm/phar": "5.26.1",
"spatie/phpunit-snapshot-assertions": "5.1.7",
"symfony/browser-kit": "7.2.0",
Expand Down
30 changes: 15 additions & 15 deletions api/composer.lock

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

1 change: 1 addition & 0 deletions api/phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ parameters:
level: 5
paths:
- src
treatPhpDocTypesAsCertain: false
1 change: 1 addition & 0 deletions api/src/Entity/MaterialList.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ public function removeMaterialItem(MaterialItem $materialItem): self {
public function getName(): ?string {
return $this->name
?? $this->campCollaboration?->user?->getDisplayName()
// @phpstan-ignore nullsafe.neverNull
?? $this->campCollaboration?->inviteEmail
?? 'NoName';
}
Expand Down
3 changes: 3 additions & 0 deletions api/src/Entity/SortableEntityTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
use Gedmo\Mapping\Annotation as Gedmo;
use Symfony\Component\Serializer\Annotation\Groups;

/**
* @phpstan-ignore trait.unused
*/
trait SortableEntityTrait {
/**
* Property to sort items within the same sorting group. First entry starts with 0. Choose -1 to place item at the end of the list (e.g. for new items).
Expand Down
6 changes: 1 addition & 5 deletions api/src/Serializer/Normalizer/CollectionItemsNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,7 @@ public function normalize($data, $format = null, array $context = []): null|arra
}

public function getSupportedTypes(?string $format): array {
if (method_exists($this->decorated, 'getSupportedTypes')) {
return $this->decorated->getSupportedTypes($format);
}

return ['*' => false];
return $this->decorated->getSupportedTypes($format);
}

public function setNormalizer(NormalizerInterface $normalizer): void {
Expand Down
6 changes: 1 addition & 5 deletions api/src/Serializer/Normalizer/ContentTypeNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,7 @@ public function normalize($data, $format = null, array $context = []): null|arra
}

public function getSupportedTypes(?string $format): array {
if (method_exists($this->decorated, 'getSupportedTypes')) {
return $this->decorated->getSupportedTypes($format);
}

return ['*' => false];
return $this->decorated->getSupportedTypes($format);
}

public function setSerializer(SerializerInterface $serializer): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,15 @@ public function extract(ConstraintViolation $constraintViolation): TranslationIn
return new TranslationInfo($key, $paramsWithoutCurlyBraces);
}

/**
* @psalm-suppress InvalidReturnType
* @psalm-suppress InvalidReturnStatement
*/
public static function removeCurlyBraces(array $parameters): array {
$paramsWithoutCurlyBraces = [];
foreach ($parameters as $key => $value) {
/** @var int|string $key */
/** @phpstan-ignore varTag.nativeType */
$key = str_replace('{{ ', '', $key);
$key = str_replace(' }}', '', $key);
$paramsWithoutCurlyBraces[$key] = $value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,7 @@ public function normalize($data, $format = null, array $context = []): null|arra
}

public function getSupportedTypes(?string $format): array {
if (method_exists($this->decorated, 'getSupportedTypes')) {
return $this->decorated->getSupportedTypes($format);
}

return ['*' => false];
return $this->decorated->getSupportedTypes($format);
}

public function setSerializer(SerializerInterface $serializer): void {
Expand All @@ -152,8 +148,9 @@ public function setSerializer(SerializerInterface $serializer): void {
protected function getRelatedCollectionHref($object, $rel, array $context, &$href): bool {
$resourceClass = $this->getObjectClass($object);

// @phpstan-ignore instanceof.alwaysTrue
if ($this->nameConverter instanceof NameConverterInterface) {
// @phpstan-ignore-next-line
/** @phpstan-ignore arguments.count */
$rel = $this->nameConverter->denormalize($rel, $resourceClass, null, array_merge($context, ['groups' => ['read']]));
}

Expand All @@ -170,6 +167,7 @@ protected function getRelatedCollectionHref($object, $rel, array $context, &$hre
try {
$classMetadata = $this->getClassMetadata($resourceClass);

// @phpstan-ignore instanceof.alwaysTrue
if (!$classMetadata instanceof ClassMetadata) {
throw new \RuntimeException("The class metadata for {$resourceClass} must be an instance of ClassMetadata.");
}
Expand Down
6 changes: 1 addition & 5 deletions api/src/Serializer/Normalizer/UriTemplateNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,6 @@ public function normalize($data, $format = null, array $context = []): null|arra
}

public function getSupportedTypes(?string $format): array {
if (method_exists($this->decorated, 'getSupportedTypes')) {
return $this->decorated->getSupportedTypes($format);
}

return ['*' => false];
return $this->decorated->getSupportedTypes($format);
}
}
1 change: 1 addition & 0 deletions api/src/State/ActivityCreateProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public function __construct(
* @param Activity $data
*/
public function onBefore($data, Operation $operation, array $uriVariables = [], array $context = []): Activity {
// @phpstan-ignore nullsafe.neverNull
if (!isset($data->category?->rootContentNode)) {
throw new \UnexpectedValueException('Property rootContentNode of provided category is null. Object of type '.ColumnLayout::class.' expected.');
}
Expand Down

0 comments on commit e5c46a1

Please sign in to comment.