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

@@ -38,13 +38,14 @@ final readonly class Manager
/**
* @param list<string> $places
*
* @throws Exception
*/
public function countDocForAccompanyingPeriod(
AccompanyingPeriod $accompanyingPeriod,
?\DateTimeImmutable $startDate = null,
?\DateTimeImmutable $endDate = null,
?string $content = null,
\DateTimeImmutable $startDate = null,
\DateTimeImmutable $endDate = null,
string $content = null,
array $places = []
): int {
['sql' => $sql, 'params' => $params, 'types' => $types] = $this->buildUnionQuery($accompanyingPeriod, $startDate, $endDate, $content, $places);
@@ -54,7 +55,7 @@ final readonly class Manager
private function countDoc(string $sql, array $params, array $types): int
{
if ($sql === '') {
if ('' === $sql) {
return 0;
}
@@ -64,7 +65,7 @@ final readonly class Manager
$number = $result->fetchOne();
if (false === $number) {
throw new \UnexpectedValueException("number of documents failed to load");
throw new \UnexpectedValueException('number of documents failed to load');
}
return $number;
@@ -72,9 +73,9 @@ final readonly class Manager
public function countDocForPerson(
Person $person,
?\DateTimeImmutable $startDate = null,
?\DateTimeImmutable $endDate = null,
?string $content = null,
\DateTimeImmutable $startDate = null,
\DateTimeImmutable $endDate = null,
string $content = null,
array $places = []
): int {
['sql' => $sql, 'params' => $params, 'types' => $types] = $this->buildUnionQuery($person, $startDate, $endDate, $content, $places);
@@ -84,16 +85,18 @@ final readonly class Manager
/**
* @param list<string> $places places to search. When empty, search in all places
*
* @return iterable<GenericDocDTO>
*
* @throws Exception
*/
public function findDocForAccompanyingPeriod(
AccompanyingPeriod $accompanyingPeriod,
int $offset = 0,
int $limit = 20,
?\DateTimeImmutable $startDate = null,
?\DateTimeImmutable $endDate = null,
?string $content = null,
\DateTimeImmutable $startDate = null,
\DateTimeImmutable $endDate = null,
string $content = null,
array $places = []
): iterable {
['sql' => $sql, 'params' => $params, 'types' => $types] = $this->buildUnionQuery($accompanyingPeriod, $startDate, $endDate, $content, $places);
@@ -107,7 +110,7 @@ final readonly class Manager
*/
private function findDocs(AccompanyingPeriod|Person $linked, string $sql, array $params, array $types, int $offset, int $limit): iterable
{
if ($sql === '') {
if ('' === $sql) {
return [];
}
@@ -127,15 +130,16 @@ final readonly class Manager
/**
* @param list<string> $places places to search. When empty, search in all places
*
* @return iterable<GenericDocDTO>
*/
public function findDocForPerson(
Person $person,
int $offset = 0,
int $limit = 20,
?\DateTimeImmutable $startDate = null,
?\DateTimeImmutable $endDate = null,
?string $content = null,
\DateTimeImmutable $startDate = null,
\DateTimeImmutable $endDate = null,
string $content = null,
array $places = []
): iterable {
['sql' => $sql, 'params' => $params, 'types' => $types] = $this->buildUnionQuery($person, $startDate, $endDate, $content, $places);
@@ -159,7 +163,7 @@ final readonly class Manager
private function places(string $sql, array $params, array $types): array
{
if ($sql === '') {
if ('' === $sql) {
return [];
}
@@ -179,9 +183,9 @@ final readonly class Manager
*/
private function buildUnionQuery(
AccompanyingPeriod|Person $linked,
?\DateTimeImmutable $startDate = null,
?\DateTimeImmutable $endDate = null,
?string $content = null,
\DateTimeImmutable $startDate = null,
\DateTimeImmutable $endDate = null,
string $content = null,
array $places = [],
): array {
$queries = [];
@@ -210,7 +214,7 @@ final readonly class Manager
continue;
}
['sql' => $q, 'params' => $p, 'types' => $t ] = $this->builder->toSql($query);
['sql' => $q, 'params' => $p, 'types' => $t] = $this->builder->toSql($query);
$sql[] = $q;
$params = [...$params, ...$p];