Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): update dependency phpstan/phpstan and rector/rector to v2 #6317

Merged
merged 2 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading