apply more cs rules for php-cs

This commit is contained in:
2023-10-17 13:27:03 +02:00
parent 0b0cbed9db
commit bc2041cbdd
1485 changed files with 8169 additions and 9620 deletions

View File

@@ -24,16 +24,13 @@ use Chill\PersonBundle\Repository\SocialWork\SocialIssueRepository;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Query\Expr\Comparison;
use Doctrine\Persistence\ObjectRepository;
use Exception;
use function count;
final readonly class SocialWorkMetadata implements SocialWorkMetadataInterface
{
public function __construct(private SocialIssueRepository $socialIssueRepository, private SocialActionRepository $socialActionRepository, private GoalRepository $goalRepository, private ResultRepository $resultRepository, private EvaluationRepository $evaluationRepository, private EntityManagerInterface $entityManager) {}
/**
* @throws Exception
* @throws \Exception
*/
public function import(iterable $dataset): bool
{
@@ -130,9 +127,9 @@ final readonly class SocialWorkMetadata implements SocialWorkMetadataInterface
}
/**
* @throws Exception
*
* @return object
*
* @throws \Exception
*/
private function getOrCreateEntity(ObjectRepository $repository, string $field, array $jsonCriterias = [])
{
@@ -149,13 +146,11 @@ final readonly class SocialWorkMetadata implements SocialWorkMetadataInterface
return new $entity();
}
if (count($results) === 1) {
if (1 === \count($results)) {
return reset($results);
}
throw new Exception(
'Unable to create entity.'
);
throw new \Exception('Unable to create entity.');
}
private function handleEvaluation(?string $evaluationTitle, SocialAction $socialAction): ?Evaluation
@@ -220,9 +215,9 @@ final readonly class SocialWorkMetadata implements SocialWorkMetadataInterface
}
/**
* @throws Exception
*
* @return array<string, SocialAction|null>
*
* @throws \Exception
*/
private function handleSocialAction(
?string $socialActionTitle,
@@ -270,9 +265,9 @@ final readonly class SocialWorkMetadata implements SocialWorkMetadataInterface
}
/**
* @throws Exception
*
* @return array<string, SocialIssue|null>
*
* @throws \Exception
*/
private function handleSocialIssue(
?string $socialIssueTitle,
@@ -326,12 +321,12 @@ final readonly class SocialWorkMetadata implements SocialWorkMetadataInterface
* Index 5: Result
* Index 6: Evaluation
*
* @param array<int, ?string> $row
* @param array<string, array<string, <|array|null>|SocialIssue|string, SocialAction|null>|Evaluation|Goal|Result> $previousRow
* @param array<int, ?string> $row
* @param array{socialIssues: array<SocialIssue>, socialActions: array<SocialAction>, goal: Goal|null, result: Result|null, eval: Evaluation|null} $previousRow
*
* @throws Exception
* @return array{socialIssues: array<SocialIssue>, socialActions: array<SocialAction>, goal: Goal|null, result: Result|null, eval: Evaluation|null}
*
* @return array<string, array<string, <|array|null>|SocialIssue|string, SocialAction|null>|Evaluation|Goal|Result>
* @throws \Exception
*/
private function import1(int $key, array $row, array $previousRow): array
{
@@ -350,7 +345,7 @@ final readonly class SocialWorkMetadata implements SocialWorkMetadataInterface
$socialIssue = $socialIssues['socialIssueChild'] ?? $socialIssues['socialIssue'];
if (null === $socialIssue) {
throw new Exception(sprintf("no social issue on row {$key}, values: %s", implode(', ', $row)));
throw new \Exception(sprintf("no social issue on row {$key}, values: %s", implode(', ', $row)));
}
$socialActions = $this