Merge pull request #19310 from MauricioFauth/phpstan-deprecation-ext

Add phpstan/phpstan-deprecation-rules package
This commit is contained in:
Maurício Meneghini Fauth 2024-09-30 18:05:30 -03:00 committed by GitHub
commit f43f9168c0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 13 additions and 11 deletions

View File

@ -104,6 +104,7 @@
"phpmyadmin/coding-standard": "^3.0.0",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan": "^1.4.8",
"phpstan/phpstan-deprecation-rules": "^1.0",
"phpstan/phpstan-phpunit": "^1.0",
"phpstan/phpstan-webmozart-assert": "^1.0",
"phpunit/phpunit": "^8.5.16 || ^9.6",

View File

@ -682,12 +682,12 @@ class NavigationTree
foreach ($node->children as $child) {
$prefixPos = false;
foreach ($separators as $separator) {
$sepPos = mb_strpos((string) $child->name, $separator);
$sepPos = mb_strpos($child->name, $separator);
if (
$sepPos == false
|| $sepPos == mb_strlen($child->name)
|| $sepPos == 0
$sepPos === false
|| $sepPos === 0
|| ($prefixPos !== false && $sepPos >= $prefixPos)
|| $sepPos === mb_strlen($child->name)
) {
continue;
}

View File

@ -30,7 +30,7 @@ final class ForeignKey
$dbi->fetchValue('SELECT @@ndb_version_string') ?: ''
);
if (substr($ndbver, 0, 4) === 'ndb-') {
$ndbver = substr($ndbver, 4);
$ndbver = (string) substr($ndbver, 4);
}
return version_compare($ndbver, '7.3', '>=');

View File

@ -8920,6 +8920,11 @@ parameters:
count: 1
path: libraries/classes/UserPreferences.php
-
message: "#^Cannot access offset non\\-falsy\\-string on array\\{\\}\\|float\\|int\\|non\\-falsy\\-string\\.$#"
count: 1
path: libraries/classes/Util.php
-
message: "#^Cannot cast mixed to string\\.$#"
count: 1

View File

@ -8565,8 +8565,7 @@
<code>(int) $GLOBALS['cfg']['NavigationTreeDisplayDbFilterMinimum']</code>
<code>(int) $GLOBALS['cfg']['NavigationTreeDisplayItemFilterMinimum']</code>
</RedundantCast>
<RedundantCastGivenDocblockType occurrences="6">
<code>(string) $child-&gt;name</code>
<RedundantCastGivenDocblockType occurrences="5">
<code>(string) $child-&gt;name</code>
<code>(string) $key</code>
<code>(string) $key</code>
@ -15537,9 +15536,6 @@
</MixedInferredReturnType>
</file>
<file src="test/classes/Http/Factory/ServerRequestFactoryTest.php">
<DeprecatedMethod occurrences="1">
<code>setMethods</code>
</DeprecatedMethod>
<MixedArgument occurrences="1">
<code>$serverRequest</code>
</MixedArgument>

View File

@ -130,7 +130,7 @@ class ServerRequestFactoryTest extends AbstractTestCase
$_SERVER['HTTP_HOST'] = 'phpmyadmin.local';
$creator = $this->getMockBuilder(ServerRequestFactory::class)
->setMethods(['getallheaders'])
->onlyMethods(['getallheaders'])
->getMock();
$creator