Skip to content

Commit 06c55f9

Browse files
committed
cs fix
1 parent 53d98e1 commit 06c55f9

28 files changed

Lines changed: 159 additions & 154 deletions

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
},
2222
"require-dev": {
2323
"blitz-php/coding-standard": "^1.3",
24+
"blitz-php/framework": "^0.12.2",
2425
"kahlan/kahlan": "^5.2",
2526
"phpstan/phpstan": "^1.4.7"
2627
},

src/Builder/BaseBuilder.php

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ public function getTable(): string
184184
/**
185185
* Génère la partie FROM de la requête
186186
*
187-
* @param string|string[]|null $from
187+
* @param list<string>|string|null $from
188188
*/
189189
final public function from($from, bool $overwrite = false): self
190190
{
@@ -227,7 +227,7 @@ public function fromSubquery(BuilderInterface $from, string $alias = ''): self
227227
/**
228228
*Génère la partie FROM de la requête
229229
*
230-
* @param string|string[]|null $from
230+
* @param list<string>|string|null $from
231231
*
232232
* @alias self::from()
233233
*/
@@ -357,7 +357,7 @@ final public function rightJoin(string $table, array|string $fields, bool $outer
357357
* Génère la partie JOIN (de type NATURAL JOIN) de la requête
358358
* Uniquement pour ceux qui utilisent MySql
359359
*
360-
* @param string|string[] $table Table à joindre
360+
* @param list<string>|string $table Table à joindre
361361
*/
362362
final public function naturalJoin(array|string $table): self
363363
{
@@ -740,7 +740,7 @@ final public function orNotLike($field, $match = '', string $side = 'both', bool
740740
* Génère la partie WHERE (de type WHERE x IS NULL) de la requête.
741741
* Sépare plusieurs appels avec 'AND'.
742742
*
743-
* @param string|string[] $field Un nom de champ ou un tableau de champs
743+
* @param list<string>|string $field Un nom de champ ou un tableau de champs
744744
*/
745745
final public function whereNull($field): self
746746
{
@@ -755,7 +755,7 @@ final public function whereNull($field): self
755755
* Génère la partie WHERE (de type WHERE x IS NOT NULL) de la requête.
756756
* Sépare plusieurs appels avec 'AND'.
757757
*
758-
* @param string|string[] $field Un nom de champ ou un tableau de champs
758+
* @param list<string>|string $field Un nom de champ ou un tableau de champs
759759
*/
760760
final public function whereNotNull($field): self
761761
{
@@ -770,7 +770,7 @@ final public function whereNotNull($field): self
770770
* Génère la partie WHERE (de type WHERE x IS NULL) de la requête.
771771
* Sépare plusieurs appels avec 'OR'.
772772
*
773-
* @param string|string[] $field Un nom de champ ou un tableau de champs
773+
* @param list<string>|string $field Un nom de champ ou un tableau de champs
774774
*/
775775
final public function orWhereNull($field): self
776776
{
@@ -785,7 +785,7 @@ final public function orWhereNull($field): self
785785
* Génère la partie WHERE (de type WHERE x IS NOT NULL) de la requête.
786786
* Sépare plusieurs appels avec 'OR'.
787787
*
788-
* @param string|string[] $field Un nom de champ ou un tableau de champs
788+
* @param list<string>|string $field Un nom de champ ou un tableau de champs
789789
*/
790790
final public function orWhereNotNull($field): self
791791
{
@@ -1124,7 +1124,7 @@ protected function addWhereExistsQuery(self $query, string $boolean = 'and', boo
11241124
*
11251125
* @param array<string, DateTimeInterface|int|string|null>|string $field Un nom de champ ou un tableau de champs et de valeurs.
11261126
*/
1127-
public function whereDate($field, null|DateTimeInterface|int|string $value = null, string $bool = 'and'): self
1127+
public function whereDate($field, DateTimeInterface|int|string|null $value = null, string $bool = 'and'): self
11281128
{
11291129
$field = $this->buildDateBasedWhere($field, $value, 'Y-m-d');
11301130

@@ -1141,7 +1141,7 @@ public function whereDate($field, null|DateTimeInterface|int|string $value = nul
11411141
*
11421142
* @param array<string, DateTimeInterface|int|string|null>|string $field Un nom de champ ou un tableau de champs et de valeurs.
11431143
*/
1144-
public function orWhereDate($field, null|DateTimeInterface|int|string $value = null): self
1144+
public function orWhereDate($field, DateTimeInterface|int|string|null $value = null): self
11451145
{
11461146
return $this->whereDate($field, $value, 'or');
11471147
}
@@ -1151,7 +1151,7 @@ public function orWhereDate($field, null|DateTimeInterface|int|string $value = n
11511151
*
11521152
* @param array<string, DateTimeInterface|int|string|null>|string $field Un nom de champ ou un tableau de champs et de valeurs.
11531153
*/
1154-
public function whereTime($field, null|DateTimeInterface|int|string $value = null, string $bool = 'and'): self
1154+
public function whereTime($field, DateTimeInterface|int|string|null $value = null, string $bool = 'and'): self
11551155
{
11561156
$field = $this->buildDateBasedWhere($field, $value, 'H:i:s');
11571157

@@ -1168,7 +1168,7 @@ public function whereTime($field, null|DateTimeInterface|int|string $value = nul
11681168
*
11691169
* @param array<string, DateTimeInterface|int|string|null>|string $field Un nom de champ ou un tableau de champs et de valeurs.
11701170
*/
1171-
public function orWhereTime($field, null|DateTimeInterface|int|string $value = null): self
1171+
public function orWhereTime($field, DateTimeInterface|int|string|null $value = null): self
11721172
{
11731173
return $this->whereTime($field, $value, 'or');
11741174
}
@@ -1178,7 +1178,7 @@ public function orWhereTime($field, null|DateTimeInterface|int|string $value = n
11781178
*
11791179
* @param array<string, DateTimeInterface|int|string|null>|string $field Un nom de champ ou un tableau de champs et de valeurs.
11801180
*/
1181-
public function whereDay($field, null|DateTimeInterface|int|string $value = null, string $bool = 'and'): self
1181+
public function whereDay($field, DateTimeInterface|int|string|null $value = null, string $bool = 'and'): self
11821182
{
11831183
$field = $this->buildDateBasedWhere($field, $value, 'd');
11841184

@@ -1195,7 +1195,7 @@ public function whereDay($field, null|DateTimeInterface|int|string $value = null
11951195
*
11961196
* @param array<string, DateTimeInterface|int|string|null>|string $field Un nom de champ ou un tableau de champs et de valeurs.
11971197
*/
1198-
public function orWhereDay($field, null|DateTimeInterface|int|string $value = null): self
1198+
public function orWhereDay($field, DateTimeInterface|int|string|null $value = null): self
11991199
{
12001200
return $this->whereDay($field, $value, 'or');
12011201
}
@@ -1205,7 +1205,7 @@ public function orWhereDay($field, null|DateTimeInterface|int|string $value = nu
12051205
*
12061206
* @param array<string, DateTimeInterface|int|string|null>|string $field Un nom de champ ou un tableau de champs et de valeurs.
12071207
*/
1208-
public function whereMonth($field, null|DateTimeInterface|int|string $value = null, string $bool = 'and'): self
1208+
public function whereMonth($field, DateTimeInterface|int|string|null $value = null, string $bool = 'and'): self
12091209
{
12101210
$field = $this->buildDateBasedWhere($field, $value, 'm');
12111211

@@ -1222,7 +1222,7 @@ public function whereMonth($field, null|DateTimeInterface|int|string $value = nu
12221222
*
12231223
* @param array<string, DateTimeInterface|int|string|null>|string $field Un nom de champ ou un tableau de champs et de valeurs.
12241224
*/
1225-
public function orWhereMonth($field, null|DateTimeInterface|int|string $value = null): self
1225+
public function orWhereMonth($field, DateTimeInterface|int|string|null $value = null): self
12261226
{
12271227
return $this->whereMonth($field, $value, 'or');
12281228
}
@@ -1232,7 +1232,7 @@ public function orWhereMonth($field, null|DateTimeInterface|int|string $value =
12321232
*
12331233
* @param array<string, DateTimeInterface|int|string|null>|string $field Un nom de champ ou un tableau de champs et de valeurs.
12341234
*/
1235-
public function whereYear($field, null|DateTimeInterface|int|string $value = null, string $bool = 'and'): self
1235+
public function whereYear($field, DateTimeInterface|int|string|null $value = null, string $bool = 'and'): self
12361236
{
12371237
$field = $this->buildDateBasedWhere($field, $value, 'Y');
12381238

@@ -1249,15 +1249,15 @@ public function whereYear($field, null|DateTimeInterface|int|string $value = nul
12491249
*
12501250
* @param array<string, DateTimeInterface|int|string|null>|string $field Un nom de champ ou un tableau de champs et de valeurs.
12511251
*/
1252-
public function orWhereYear($field, null|DateTimeInterface|int|string $value = null): self
1252+
public function orWhereYear($field, DateTimeInterface|int|string|null $value = null): self
12531253
{
12541254
return $this->whereYear($field, $value, 'or');
12551255
}
12561256

12571257
/**
12581258
* @param array<string, DateTimeInterface|int|string|null>|string $field Un nom de champ ou un tableau de champs et de valeurs.
12591259
*/
1260-
protected function buildDateBasedWhere($field, null|DateTimeInterface|int|string $value, string $format): array
1260+
protected function buildDateBasedWhere($field, DateTimeInterface|int|string|null $value, string $format): array
12611261
{
12621262
if (! is_array($field)) {
12631263
$field = [$field => $value];
@@ -1332,7 +1332,7 @@ public function params(array $params): self
13321332
/**
13331333
* Ajouter des champs pour les tri
13341334
*
1335-
* @param string|string[] $field Un nom de champ ou un tableau de champs
1335+
* @param list<string>|string $field Un nom de champ ou un tableau de champs
13361336
*/
13371337
public function orderBy(array|string $field, string $direction = 'ASC', bool $escape = true): self
13381338
{
@@ -1368,7 +1368,7 @@ public function orderBy(array|string $field, string $direction = 'ASC', bool $es
13681368
/**
13691369
* Ajouter des champs pour les tri.
13701370
*
1371-
* @param string|string[] $field Un nom de champ ou un tableau de champs
1371+
* @param list<string>|string $field Un nom de champ ou un tableau de champs
13721372
*
13731373
* @alias self::orderBy()
13741374
*/
@@ -1380,7 +1380,7 @@ final public function order(array|string $field, string $direction = 'ASC', bool
13801380
/**
13811381
* Ajoute un tri croissant pour un champ.
13821382
*
1383-
* @param string|string[] $field Un nom de champ ou un tableau de champs
1383+
* @param list<string>|string $field Un nom de champ ou un tableau de champs
13841384
*/
13851385
final public function sortAsc(array|string $field, bool $escape = true): self
13861386
{
@@ -1390,7 +1390,7 @@ final public function sortAsc(array|string $field, bool $escape = true): self
13901390
/**
13911391
* Ajoute un tri decroissant pour un champ.
13921392
*
1393-
* @param string|string[] $field Un nom de champ ou un tableau de champs
1393+
* @param list<string>|string $field Un nom de champ ou un tableau de champs
13941394
*/
13951395
final public function sortDesc(array|string $field, bool $escape = true): self
13961396
{
@@ -1438,7 +1438,7 @@ public function oldest(array|string $column = 'created_at', bool $escape = true)
14381438
/**
14391439
* Ajoute des champs à regrouper.
14401440
*
1441-
* @param string|string[] $field Nom de champ ou tableau de noms de champs
1441+
* @param list<string>|string $field Nom de champ ou tableau de noms de champs
14421442
*/
14431443
public function groupBy($field, bool $escape = true): self
14441444
{
@@ -1462,7 +1462,7 @@ public function groupBy($field, bool $escape = true): self
14621462
/**
14631463
* Ajoute des champs à regrouper.
14641464
*
1465-
* @param string|string[] $field Nom de champ ou tableau de noms de champs
1465+
* @param list<string>|string $field Nom de champ ou tableau de noms de champs
14661466
*
14671467
* @alias self::orderBy()
14681468
*/
@@ -1706,7 +1706,7 @@ final public function distinct(bool $value = true): self
17061706
/**
17071707
* Construit une requête de sélection.
17081708
*
1709-
* @param string|string[] $fields Nom de champ ou tableau de noms de champs à sélectionner
1709+
* @param list<string>|string $fields Nom de champ ou tableau de noms de champs à sélectionner
17101710
*/
17111711
public function select($fields = '*', ?int $limit = null, ?int $offset = null): self
17121712
{
@@ -1807,7 +1807,7 @@ final public function insertIgnore(array|object $data, bool $escape = true, $exe
18071807
/**
18081808
* Construit une requête d'insertion multiple.
18091809
*
1810-
* @param array<array|object> $data Tableau a deux dimensions contenant les valeurs a inserer
1810+
* @param list<array|object> $data Tableau a deux dimensions contenant les valeurs a inserer
18111811
*
18121812
* @return BaseResult|string
18131813
*/
@@ -1844,7 +1844,7 @@ final public function bulckInsert(array $data, bool $escape = true, bool $ignore
18441844
/**
18451845
* Construit une requête d'insertion multiple de type INSERT IGNORE.
18461846
*
1847-
* @param array<array|object> $data Tableau a deux dimensions contenant les valeurs a inserer
1847+
* @param list<array|object> $data Tableau a deux dimensions contenant les valeurs a inserer
18481848
*
18491849
* @return BaseResult|string
18501850
*/
@@ -2262,11 +2262,11 @@ public function row(int $index, $type = PDO::FETCH_OBJ, ?string $key = null, int
22622262
/**
22632263
* Recupere la valeur d'un ou de plusieurs champs.
22642264
*
2265-
* @param string|string[] $name Le nom du/des champs de la base de donnees
2266-
* @param string|null $key Cle du cache
2267-
* @param int $expire Délai d'expiration en secondes
2265+
* @param list<string>|string $name Le nom du/des champs de la base de donnees
2266+
* @param string|null $key Cle du cache
2267+
* @param int $expire Délai d'expiration en secondes
22682268
*
2269-
* @return mixed|mixed[] La valeur du/des champs
2269+
* @return list<mixed>|mixed La valeur du/des champs
22702270
*/
22712271
final public function value(array|string $name, ?string $key = null, int $expire = 0)
22722272
{
@@ -2286,11 +2286,11 @@ final public function value(array|string $name, ?string $key = null, int $expire
22862286
/**
22872287
* Recupere les valeurs d'un ou de plusieurs champs.
22882288
*
2289-
* @param string|string[] $name Le nom du/des champs de la base de donnees
2290-
* @param string|null $key Cle du cache
2291-
* @param int $expire Délai d'expiration en secondes
2289+
* @param list<string>|string $name Le nom du/des champs de la base de donnees
2290+
* @param string|null $key Cle du cache
2291+
* @param int $expire Délai d'expiration en secondes
22922292
*
2293-
* @return mixed[] La/les valeurs du/des champs
2293+
* @return list<mixed> La/les valeurs du/des champs
22942294
*/
22952295
final public function values(array|string $name, ?string $key = null, int $expire = 0): array
22962296
{
@@ -2573,7 +2573,7 @@ private function makeSql($sql): string
25732573
*
25742574
* @param mixed $match
25752575
*
2576-
* @return string[] [column, match, condition]
2576+
* @return list<string> [column, match, condition]
25772577
*/
25782578
protected function _likeStatement(string $column, $match, bool $not, bool $insensitiveSearch = false): array
25792579
{
@@ -2589,7 +2589,7 @@ protected function _likeStatement(string $column, $match, bool $not, bool $insen
25892589
/**
25902590
* Genere la chaine REPLACE INTO conformement a la plateforme
25912591
*
2592-
* @return string|string[]
2592+
* @return list<string>|string
25932593
*/
25942594
protected function _replaceStatement(string $table, string $keys, string $values)
25952595
{
@@ -2605,7 +2605,7 @@ protected function _replaceStatement(string $table, string $keys, string $values
26052605
/**
26062606
* Genere la chaine INSERT conformement a la plateforme
26072607
*
2608-
* @return string|string[]
2608+
* @return list<string>|string
26092609
*/
26102610
protected function _insertStatement(string $table, string $keys, string $values)
26112611
{

src/Builder/Postgre.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ protected function _likeStatement(string $column, $match, bool $not, bool $insen
237237
/**
238238
* Genere la chaine INSERT conformement a la plateforme
239239
*
240-
* @return string|string[]
240+
* @return list<string>|string
241241
*/
242242
protected function _insertStatement(string $table, string $keys, string $values)
243243
{
@@ -265,7 +265,7 @@ public function join(string $table, array|string $fields, string $type = 'INNER'
265265
/**
266266
* {@inheritDoc}
267267
*/
268-
public function whereDate($field, null|DateTimeInterface|int|string $value = null, string $bool = 'and'): self
268+
public function whereDate($field, DateTimeInterface|int|string|null $value = null, string $bool = 'and'): self
269269
{
270270
$field = $this->buildDateBasedWhere($field, $value, 'Y-m-d');
271271
$bool = $bool === 'or' ? '|' : '';
@@ -281,7 +281,7 @@ public function whereDate($field, null|DateTimeInterface|int|string $value = nul
281281
/**
282282
* {@inheritDoc}
283283
*/
284-
public function whereTime($field, null|DateTimeInterface|int|string $value = null, string $bool = 'and'): self
284+
public function whereTime($field, DateTimeInterface|int|string|null $value = null, string $bool = 'and'): self
285285
{
286286
$field = $this->buildDateBasedWhere($field, $value, 'H:i:s');
287287
$bool = $bool === 'or' ? '|' : '';

src/Collectors/DatabaseCollector.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class DatabaseCollector extends BaseCollector
5353
/**
5454
* Tableau de connexions à la base de données.
5555
*
56-
* @var BaseConnection[]
56+
* @var list<BaseConnection>
5757
*/
5858
protected array $connections = [];
5959

@@ -86,7 +86,7 @@ public static function collect(EventInterface $event)
8686
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
8787

8888
if (! is_cli()) {
89-
// lorsqu'ils sont appelés dans le navigateur, les deux premiers tableaux de traces
89+
// lorsqu'ils sont appelés dans le navigateur, les deux premiers tableaux de traces
9090
// proviennent du déclencheur d'événement de la base de données, qui ne sont pas nécessaires
9191
$backtrace = array_slice($backtrace, 2);
9292
}
@@ -247,7 +247,7 @@ private function getConnections()
247247
private function highlight(string $statement): string
248248
{
249249
// Liste des mots-clés à mettre en gras
250-
$replacements = array_map(fn($term) => "<strong>{$term}</strong>", $search = [
250+
$replacements = array_map(static fn ($term) => "<strong>{$term}</strong>", $search = [
251251
'SELECT',
252252
'DISTINCT',
253253
'FROM',
@@ -290,6 +290,6 @@ private function highlight(string $statement): string
290290
')',
291291
]);
292292

293-
return strtr($statement, array_combine($search, $replacements));
293+
return strtr($statement, array_combine($search, $replacements));
294294
}
295295
}

src/Commands/DatabaseCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ public function __set($name, $value)
5858
if (property_exists($this, $name = '_' . $name)) {
5959
$this->{$name} = $value;
6060
} else {
61-
throw new RuntimeException();
62-
}
61+
throw new RuntimeException();
62+
}
6363
}
6464

6565
protected function db(): BaseConnection

src/Commands/Helper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Helper
2525
*
2626
* @return array [group, configuration]
2727
*/
28-
public static function connectionInfo(null|array|string $group = null): array
28+
public static function connectionInfo(array|string|null $group = null): array
2929
{
3030
return Services::container()->get(ConnectionResolverInterface::class)->connectionInfo($group);
3131
}

0 commit comments

Comments
 (0)