Skip to content

Commit

Permalink
fix(quality): make ci happy
Browse files Browse the repository at this point in the history
  • Loading branch information
maxperei committed Mar 7, 2024
1 parent c4b3121 commit dabd74d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/Command/AnonymizeProcessCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
private function anonymizeEntityForClassName(string $className, bool $force, ?string $id = null): void
{
try {
$entity = $this->entityManager->getMetadataFactory()->getMetadataFor($className);
/** @var class-string $classString */
$classString = $className;
$entity = $this->entityManager->getMetadataFactory()->getMetadataFor($classString);
} catch (\Exception $exception) {
throw new \LogicException('Entity does not exist', 1, $exception);
}
Expand Down
6 changes: 5 additions & 1 deletion src/Provider/Anonymizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ public function anonymize(Object $entity, bool $reset = false, int $maxRetries =
$this->eventDispatcher->dispatch(new AfterAnonymize($entity, ['entity' => $clonedEntity]));
}

/**
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
private function anonymizeProcess(
Object $entity,
bool $reset,
Expand All @@ -128,6 +131,7 @@ private function anonymizeProcess(
}
if (\is_string($value) && str_starts_with($value, '@=')) {
$dynamicValue = substr($value, 2);
/** @var string $value */
$value = $this->expressionLanguage->evaluate($dynamicValue, ['object' => $entity]);
$this->setValue($entity, $propertyName, $type, $value);

Expand Down Expand Up @@ -181,7 +185,7 @@ private function anonymizeProcess(
$entity,
$propertyName,
$type,
is_array($value) ? $value : sprintf('%s%s', (string) $attributeMetaData->getPrefix(), (string) $value),
is_array($value) ? $value : sprintf('%s%s', $attributeMetaData->getPrefix(), $value),
);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/PHPUnit/Fixtures/YamlFoo.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function getId(): int
return $this->id;
}

public function setId(int $id): YamlFoo
public function setId(int $id): self
{
$this->id = $id;

Expand Down

0 comments on commit dabd74d

Please sign in to comment.