Skip to content

Commit 5ca94db

Browse files
committed
refactor: phpstan strict comparison
1 parent 7f21bf7 commit 5ca94db

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

phpstan-baseline.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -973,12 +973,6 @@
973973
'count' => 1,
974974
'path' => __DIR__ . '/system/Common.php',
975975
];
976-
$ignoreErrors[] = [
977-
// identifier: empty.notAllowed
978-
'message' => '#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#',
979-
'count' => 4,
980-
'path' => __DIR__ . '/system/Common.php',
981-
];
982976
$ignoreErrors[] = [
983977
// identifier: missingType.iterableValue
984978
'message' => '#^Function cache\\(\\) return type has no value type specified in iterable type array\\.$#',

system/Common.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -580,8 +580,8 @@ function helper($filenames): void
580580
foreach ($filenames as $filename) {
581581
// Store our system and application helper
582582
// versions so that we can control the load ordering.
583-
$systemHelper = null;
584-
$appHelper = null;
583+
$systemHelper = '';
584+
$appHelper = '';
585585
$localIncludes = [];
586586

587587
if (! str_contains($filename, '_helper')) {
@@ -598,7 +598,7 @@ function helper($filenames): void
598598
if (str_contains($filename, '\\')) {
599599
$path = $loader->locateFile($filename, 'Helpers');
600600

601-
if (empty($path)) {
601+
if ($path !== '') {
602602
throw FileNotFoundException::forFileNotFound($filename);
603603
}
604604

@@ -620,7 +620,7 @@ function helper($filenames): void
620620
}
621621

622622
// App-level helpers should override all others
623-
if (! empty($appHelper)) {
623+
if ($appHelper !== '') {
624624
$includes[] = $appHelper;
625625
$loaded[] = $filename;
626626
}
@@ -629,7 +629,7 @@ function helper($filenames): void
629629
$includes = [...$includes, ...$localIncludes];
630630

631631
// And the system default one should be added in last.
632-
if (! empty($systemHelper)) {
632+
if ($systemHelper !== '') {
633633
$includes[] = $systemHelper;
634634
$loaded[] = $filename;
635635
}
@@ -1092,7 +1092,7 @@ function stringify_attributes($attributes, bool $js = false): string
10921092
{
10931093
$atts = '';
10941094

1095-
if (empty($attributes)) {
1095+
if ($attributes === '' || $attributes === [] || $attributes === null) {
10961096
return $atts;
10971097
}
10981098

0 commit comments

Comments
 (0)