Drop a few phan PhanImpossibleTypeComparison suppressions now we've dropped PHP 7.4

Change-Id: I3426e8d65c38f4e4c6e6d2ab8ff380b9d12a47fd
This commit is contained in:
James D. Forrester 2025-03-16 19:39:08 -04:00 committed by Reedy
parent ac8a5b0b59
commit 65c90be7ea
4 changed files with 9 additions and 16 deletions

View file

@ -1344,8 +1344,7 @@ MESSAGE;
*/
public static function ensureNewline( $str ) {
$end = substr( $str, -1 );
// @phan-suppress-next-line PhanImpossibleTypeComparison
if ( $end === false || $end === '' || $end === "\n" ) {
if ( $end === '' || $end === "\n" ) {
return $str;
}
return $str . "\n";

View file

@ -110,8 +110,7 @@ class ConverterRule {
$flags[$validFlags[$ff]] = true;
}
}
// @phan-suppress-next-line PhanRedundantCondition
$text = strval( substr( $text, $sepPos + 1 ) );
$text = substr( $text, $sepPos + 1 );
}
if ( !$flags ) {

View file

@ -1338,8 +1338,7 @@ class MessageCache implements LoggerAwareInterface {
// Message page exists as an override of a software messages
if ( substr( $entry, 0, 1 ) === ' ' ) {
// The message exists and is not '!TOO BIG' or '!ERROR'
// @phan-suppress-next-line PhanRedundantCondition
return (string)substr( $entry, 1 );
return substr( $entry, 1 );
} elseif ( $entry === '!NONEXISTENT' ) {
// The text might be '-' or missing due to some data loss
return false;
@ -1388,8 +1387,7 @@ class MessageCache implements LoggerAwareInterface {
$this->cache->setField( $code, $title, $entry );
}
// The message exists, so make sure a string is returned
// @phan-suppress-next-line PhanRedundantCondition
return (string)substr( $entry, 1 );
return substr( $entry, 1 );
}
$this->cache->setField( $code, $title, '!NONEXISTENT' );

View file

@ -239,10 +239,7 @@ class MemoryFileBackend extends FileBackendStore {
foreach ( $this->files as $path => $data ) {
if ( strpos( $path, $prefix ) === 0 ) {
$relPath = substr( $path, $prefixLen );
// @phan-suppress-next-line PhanImpossibleTypeComparisonInLoop
if ( $relPath === false ) {
continue;
} elseif ( strpos( $relPath, '/' ) === false ) {
if ( strpos( $relPath, '/' ) === false ) {
continue; // just a file
}
$parts = array_slice( explode( '/', $relPath ), 0, -1 ); // last part is file name
@ -269,10 +266,10 @@ class MemoryFileBackend extends FileBackendStore {
foreach ( $this->files as $path => $data ) {
if ( strpos( $path, $prefix ) === 0 ) {
$relPath = substr( $path, $prefixLen );
// @phan-suppress-next-line PhanImpossibleTypeComparisonInLoop
if ( $relPath === false ) {
continue;
} elseif ( !empty( $params['topOnly'] ) && strpos( $relPath, '/' ) !== false ) {
if (
$relPath === '' ||
( !empty( $params['topOnly'] ) && strpos( $relPath, '/' ) !== false )
) {
continue;
}
$files[] = $relPath;