Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade PHPStan to v1.11.1 #2205

Merged
merged 15 commits into from
May 15, 2024
Prev Previous commit
Next Next commit
minor improvements
mvorisek committed May 14, 2024

Verified

This commit was signed with the committer’s verified signature.
Kikobeats Kiko Beats
commit a69c18ec0991ea42377ab409642b72e76009e102
4 changes: 2 additions & 2 deletions src/Form/Control/Calendar.php
Original file line number Diff line number Diff line change
@@ -138,11 +138,11 @@ public function isDtFormatWith24hrTime(string $phpFormat): bool

public function isDtFormatWithSeconds(string $phpFormat): bool
{
return (bool) preg_match('~[suv]~', $this->expandPhpDtFormat($phpFormat));
return preg_match('~[suv]~', $this->expandPhpDtFormat($phpFormat)) === 1;
}

public function isDtFormatWithMicroseconds(string $phpFormat): bool
{
return (bool) preg_match('~[uv]~', $this->expandPhpDtFormat($phpFormat));
return preg_match('~[uv]~', $this->expandPhpDtFormat($phpFormat)) === 1;
}
}
2 changes: 1 addition & 1 deletion src/HtmlTemplate/Value.php
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ private function encodeValueToHtml(string $value): string
public function set(string $value): self
{
if (\PHP_VERSION_ID < 80200
? !preg_match('~~u', $value) // much faster in PHP 8.1 and lower
? preg_match('~~u', $value) === false // much faster in PHP 8.1 and lower
: !mb_check_encoding($value, 'UTF-8')
) {
throw new Exception('Value is not valid UTF-8');
2 changes: 1 addition & 1 deletion src/Js/JsExpression.php
Original file line number Diff line number Diff line change
@@ -97,7 +97,7 @@ protected function _jsEncode($value): string
}
} elseif (is_string($value)) {
$res = json_encode($value, \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE | \JSON_THROW_ON_ERROR);
$res = '\'' . str_replace('\'', '\\\'', str_replace('\"', '"', substr($res, 1, -1))) . '\'';
$res = '\'' . str_replace(['\'', '\"'], ['\\\'', '"'], substr($res, 1, -1)) . '\'';
} elseif (is_bool($value)) {
$res = $value ? 'true' : 'false';
} elseif (is_int($value)) {

Unchanged files with check annotations Beta

return $dummyModel->expr('[]', [$v]);
};
foreach ($entity->getFields() as $field) {

Check failure on line 791 in src/Form/Control/Multiline.php

GitHub Actions / Smoke (latest, StaticAnalysis)

Foreach overwrites $field with its value variable.

Check failure on line 791 in src/Form/Control/Multiline.php

GitHub Actions / Smoke (latest, StaticAnalysis)

Foreach overwrites $field with its value variable.
$dummyModel->addExpression($field->shortName, [
'expr' => isset($dummyFields[$field->shortName])
? $dummyFields[$field->shortName]->expr
$this->menu->removeElement($menuRight->shortName);
} finally {
$this->getApp()->uniqueNameHashes = $appUniqueHashesBackup;
\Closure::bind(fn () => $this->_elementNameCounts = $menuElementNameCountsBackup, $this->menu, AbstractView::class)();

Check failure on line 131 in src/Grid.php

GitHub Actions / Smoke (latest, StaticAnalysis)

Expression "\Closure::bind(fn() => $this->_elementNameCounts = $menuElementNameCountsBackup, $this->menu, \Atk4\Ui\AbstractView::class)()" on a separate line does not do anything.

Check failure on line 131 in src/Grid.php

GitHub Actions / Smoke (latest, StaticAnalysis)

Expression "\Closure::bind(fn() => $this->_elementNameCounts = $menuElementNameCountsBackup, $this->menu, \Atk4\Ui\AbstractView::class)()" on a separate line does not do anything.
}
}
}