Skip to content

Commit

Permalink
refactor: phpstan strict comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
neznaika0 committed Nov 4, 2024
1 parent 9f48046 commit b6bba8a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
6 changes: 0 additions & 6 deletions phpstan-baseline.php
Original file line number Diff line number Diff line change
Expand Up @@ -973,12 +973,6 @@
'count' => 1,
'path' => __DIR__ . '/system/Common.php',
];
$ignoreErrors[] = [
// identifier: empty.notAllowed
'message' => '#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#',
'count' => 4,
'path' => __DIR__ . '/system/Common.php',
];
$ignoreErrors[] = [
// identifier: missingType.iterableValue
'message' => '#^Function cache\\(\\) return type has no value type specified in iterable type array\\.$#',
Expand Down
12 changes: 6 additions & 6 deletions system/Common.php
Original file line number Diff line number Diff line change
Expand Up @@ -580,8 +580,8 @@ function helper($filenames): void
foreach ($filenames as $filename) {
// Store our system and application helper
// versions so that we can control the load ordering.
$systemHelper = null;
$appHelper = null;
$systemHelper = '';
$appHelper = '';
$localIncludes = [];

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

if (empty($path)) {
if ($path !== '') {
throw FileNotFoundException::forFileNotFound($filename);
}

Expand All @@ -620,7 +620,7 @@ function helper($filenames): void
}

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

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

if (empty($attributes)) {
if ($attributes === '' || $attributes === [] || $attributes === null) {
return $atts;
}

Expand Down

0 comments on commit b6bba8a

Please sign in to comment.