aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/common/TestsAutoLoader.php2
-rw-r--r--tests/phpunit/MediaWikiIntegrationTestCase.php6
-rw-r--r--tests/phpunit/includes/actions/ActionEntryPointTest.php4
-rw-r--r--tests/phpunit/includes/api/ApiWatchTest.php2
-rw-r--r--tests/phpunit/includes/api/query/ApiQueryContinueTestBase.php4
-rw-r--r--tests/phpunit/includes/api/query/ApiQuerySiteinfoTest.php2
-rw-r--r--tests/phpunit/includes/editpage/EditPageTest.php2
-rw-r--r--tests/phpunit/includes/http/MWHttpRequestTest.php2
-rw-r--r--tests/phpunit/includes/logging/LogFormatterTest.php2
-rw-r--r--tests/phpunit/includes/page/ParserOutputAccessTest.php2
-rw-r--r--tests/phpunit/includes/search/SearchEngineTest.php2
-rw-r--r--tests/phpunit/includes/session/SessionManagerTest.php6
-rw-r--r--tests/phpunit/includes/skins/SkinMustacheTest.php10
-rw-r--r--tests/phpunit/includes/specialpage/ChangesListSpecialPageTest.php2
-rw-r--r--tests/phpunit/includes/specials/QueryAllSpecialPagesTest.php8
-rw-r--r--tests/phpunit/includes/xml/XmlTest.php2
-rw-r--r--tests/phpunit/integration/includes/ExtensionJsonTestBase.php4
-rw-r--r--tests/phpunit/structure/AvailableRightsTest.php7
-rw-r--r--tests/phpunit/structure/BundleSizeTestBase.php4
-rw-r--r--tests/phpunit/structure/PHPUnitConfigTest.php2
-rw-r--r--tests/phpunit/suites/ParserTestTopLevelSuite.php4
-rw-r--r--tests/phpunit/unit/includes/exception/MWExceptionHandlerTest.php2
-rw-r--r--tests/phpunit/unit/includes/libs/DebugInfo/DebugInfoTraitTest.php2
-rw-r--r--tests/phpunit/unit/includes/page/MovePageTest.php8
-rw-r--r--tests/phpunit/unit/maintenance/MaintenanceParametersTest.php2
25 files changed, 46 insertions, 47 deletions
diff --git a/tests/common/TestsAutoLoader.php b/tests/common/TestsAutoLoader.php
index e41df85cd12c..41ab2357c129 100644
--- a/tests/common/TestsAutoLoader.php
+++ b/tests/common/TestsAutoLoader.php
@@ -332,7 +332,7 @@ $wgAutoloadClasses += [
* should be considered deprecated and eventually removed.
*/
spl_autoload_register( static function ( $class ) {
- if ( strpos( $class, 'PHPUnit_' ) !== 0 ) {
+ if ( !str_starts_with( $class, 'PHPUnit_' ) ) {
// Skip if it doesn't start with the old prefix
return;
}
diff --git a/tests/phpunit/MediaWikiIntegrationTestCase.php b/tests/phpunit/MediaWikiIntegrationTestCase.php
index 7fb5d3720067..5d4ce5632abf 100644
--- a/tests/phpunit/MediaWikiIntegrationTestCase.php
+++ b/tests/phpunit/MediaWikiIntegrationTestCase.php
@@ -611,7 +611,7 @@ abstract class MediaWikiIntegrationTestCase extends PHPUnit\Framework\TestCase {
final protected function mediaWikiSetUp(): void {
$reflection = new ReflectionClass( $this );
// TODO: Eventually we should assert for test presence in /integration/
- if ( strpos( $reflection->getFileName(), '/unit/' ) !== false ) {
+ if ( str_contains( $reflection->getFileName(), '/unit/' ) ) {
$this->fail( 'This integration test should not be in "tests/phpunit/unit" !' );
}
if ( $this->tablesUsed && !self::isTestInDatabaseGroup() ) {
@@ -1849,7 +1849,7 @@ abstract class MediaWikiIntegrationTestCase extends PHPUnit\Framework\TestCase {
$defaultArray = (array)$wgDefaultExternalStore;
$dbws = [];
foreach ( $defaultArray as $url ) {
- if ( strpos( $url, 'DB://' ) === 0 ) {
+ if ( str_starts_with( $url, 'DB://' ) ) {
[ $proto, $cluster ] = explode( '://', $url, 2 );
// Avoid getPrimary() because setupDatabaseWithTestPrefix()
// requires Database instead of plain DBConnRef/IDatabase
@@ -1873,7 +1873,7 @@ abstract class MediaWikiIntegrationTestCase extends PHPUnit\Framework\TestCase {
$defaultArray = (array)$wgDefaultExternalStore;
foreach ( $defaultArray as $url ) {
- if ( strpos( $url, 'DB://' ) === 0 ) {
+ if ( str_starts_with( $url, 'DB://' ) ) {
return true;
}
}
diff --git a/tests/phpunit/includes/actions/ActionEntryPointTest.php b/tests/phpunit/includes/actions/ActionEntryPointTest.php
index 807b363d5e1d..72f9f579373b 100644
--- a/tests/phpunit/includes/actions/ActionEntryPointTest.php
+++ b/tests/phpunit/includes/actions/ActionEntryPointTest.php
@@ -339,7 +339,7 @@ class ActionEntryPointTest extends MediaWikiIntegrationTestCase {
}
/**
- * Test a post-send update can not set cookies (T191537).
+ * Test a post-send update cannot set cookies (T191537).
* @coversNothing
*/
public function testPostSendJobDoesNotSetCookie() {
@@ -364,7 +364,7 @@ class ActionEntryPointTest extends MediaWikiIntegrationTestCase {
$mw->doPostOutputShutdown();
// restInPeace() might have been registered to a callback of
- // register_postsend_function() and thus can not be triggered from
+ // register_postsend_function() and thus cannot be triggered from
// PHPUnit.
if ( $jobHasRun === false ) {
$mw->restInPeace();
diff --git a/tests/phpunit/includes/api/ApiWatchTest.php b/tests/phpunit/includes/api/ApiWatchTest.php
index 66b4e792140e..8e43d34813f9 100644
--- a/tests/phpunit/includes/api/ApiWatchTest.php
+++ b/tests/phpunit/includes/api/ApiWatchTest.php
@@ -152,7 +152,7 @@ class ApiWatchTest extends ApiTestCase {
// Previous tests may insert an invalid title
// like ":ApiEditPageTest testNonTextEdit", which
// can't be cleared.
- if ( strpos( $item['title'], ':' ) === 0 ) {
+ if ( str_starts_with( $item['title'], ':' ) ) {
unset( $data[0]['query']['watchlist'][$index] );
}
}
diff --git a/tests/phpunit/includes/api/query/ApiQueryContinueTestBase.php b/tests/phpunit/includes/api/query/ApiQueryContinueTestBase.php
index 06e737577ff6..a038fe25e536 100644
--- a/tests/phpunit/includes/api/query/ApiQueryContinueTestBase.php
+++ b/tests/phpunit/includes/api/query/ApiQueryContinueTestBase.php
@@ -61,8 +61,8 @@ abstract class ApiQueryContinueTestBase extends ApiQueryTestBase {
$request = array_merge( $params, $continue );
uksort( $request, static function ( $a, $b ) {
// put 'continue' params at the end - lazy method
- $a = strpos( $a, 'continue' ) !== false ? 'zzz ' . $a : $a;
- $b = strpos( $b, 'continue' ) !== false ? 'zzz ' . $b : $b;
+ $a = str_contains( $a, 'continue' ) ? 'zzz ' . $a : $a;
+ $b = str_contains( $b, 'continue' ) ? 'zzz ' . $b : $b;
return strcmp( $a, $b );
} );
diff --git a/tests/phpunit/includes/api/query/ApiQuerySiteinfoTest.php b/tests/phpunit/includes/api/query/ApiQuerySiteinfoTest.php
index 2d11e162f478..e327415a35e1 100644
--- a/tests/phpunit/includes/api/query/ApiQuerySiteinfoTest.php
+++ b/tests/phpunit/includes/api/query/ApiQuerySiteinfoTest.php
@@ -432,7 +432,7 @@ class ApiQuerySiteinfoTest extends ApiTestCase {
$expected = array_filter( $expected,
static function ( $info ) {
- return strpos( $info['type'], 'mediawiki-' ) !== 0;
+ return !str_starts_with( $info['type'], 'mediawiki-' );
}
);
diff --git a/tests/phpunit/includes/editpage/EditPageTest.php b/tests/phpunit/includes/editpage/EditPageTest.php
index c2adb6bfc56c..600143c67839 100644
--- a/tests/phpunit/includes/editpage/EditPageTest.php
+++ b/tests/phpunit/includes/editpage/EditPageTest.php
@@ -816,7 +816,7 @@ hello
// create page
$ns = $this->getDefaultWikitextNS();
- $title = Title::makeTitle( NS_MAIN, 'EditPageTest_testAutoMerge', $ns );
+ $title = Title::makeTitle( $ns, 'EditPageTest_testAutoMerge' );
$wikiPageFactory = $this->getServiceContainer()->getWikiPageFactory();
$page = $wikiPageFactory->newFromTitle( $title );
diff --git a/tests/phpunit/includes/http/MWHttpRequestTest.php b/tests/phpunit/includes/http/MWHttpRequestTest.php
index 74809ebdeb41..7a5da173bf1b 100644
--- a/tests/phpunit/includes/http/MWHttpRequestTest.php
+++ b/tests/phpunit/includes/http/MWHttpRequestTest.php
@@ -43,7 +43,7 @@ class MWHttpRequestTest extends PHPUnit\Framework\TestCase {
// commented these out in order to remove @group Broken
// @todo are these valid tests? if so, fix MWHttpRequest::isValidURI so it can handle them
// [ false, 'http://!"èèè¿¿¿~~\'', 'hostname is made of any non whitespace' ],
- // [ false, 'http://exam:ple.org/', 'hostname can not use colons!' ],
+ // [ false, 'http://exam:ple.org/', 'hostname cannot use colons!' ],
# (:[0-9]+)? - port number
[ true, 'http://example.org:80/' ],
diff --git a/tests/phpunit/includes/logging/LogFormatterTest.php b/tests/phpunit/includes/logging/LogFormatterTest.php
index bd306a6ee186..8e04d58cb2d8 100644
--- a/tests/phpunit/includes/logging/LogFormatterTest.php
+++ b/tests/phpunit/includes/logging/LogFormatterTest.php
@@ -447,7 +447,7 @@ class LogFormatterTest extends MediaWikiLangTestCase {
* Third parties bots listen to those messages. They are clever enough
* to fetch the i18n messages from the wiki and then analyze the IRC feed
* to reverse engineer the $1, $2 messages.
- * One thing bots can not detect is when MediaWiki change the meaning of
+ * One thing bots cannot detect is when MediaWiki change the meaning of
* a message like what happened when we deployed 1.19. $1 became the user
* performing the action which broke basically all bots around.
*
diff --git a/tests/phpunit/includes/page/ParserOutputAccessTest.php b/tests/phpunit/includes/page/ParserOutputAccessTest.php
index 27ff2968cda7..23029dc6bbef 100644
--- a/tests/phpunit/includes/page/ParserOutputAccessTest.php
+++ b/tests/phpunit/includes/page/ParserOutputAccessTest.php
@@ -647,7 +647,7 @@ class ParserOutputAccessTest extends MediaWikiIntegrationTestCase {
}
/**
- * Tests that a RevisionRecord with no ID can not be rendered if OPT_NO_CACHE is not set.
+ * Tests that a RevisionRecord with no ID cannot be rendered if OPT_NO_CACHE is not set.
*/
public function testFakeRevisionError() {
$access = $this->getParserOutputAccessNoCache();
diff --git a/tests/phpunit/includes/search/SearchEngineTest.php b/tests/phpunit/includes/search/SearchEngineTest.php
index 9519b20c30f1..efc5ef009eaa 100644
--- a/tests/phpunit/includes/search/SearchEngineTest.php
+++ b/tests/phpunit/includes/search/SearchEngineTest.php
@@ -508,7 +508,7 @@ class SearchEngineTest extends MediaWikiLangTestCase {
*/
public function testParseNamespacePrefix( array $params, $expected ) {
$this->setTemporaryHook( 'PrefixSearchExtractNamespace', static function ( &$namespaces, &$query ) {
- if ( strpos( $query, 'hélp:' ) === 0 ) {
+ if ( str_starts_with( $query, 'hélp:' ) ) {
$namespaces = [ NS_HELP ];
$query = substr( $query, strlen( 'hélp:' ) );
}
diff --git a/tests/phpunit/includes/session/SessionManagerTest.php b/tests/phpunit/includes/session/SessionManagerTest.php
index 6937c1330b61..83282b0d6cdb 100644
--- a/tests/phpunit/includes/session/SessionManagerTest.php
+++ b/tests/phpunit/includes/session/SessionManagerTest.php
@@ -40,10 +40,10 @@ class SessionManagerTest extends MediaWikiIntegrationTestCase {
]
] );
$this->logger = new \TestLogger( false, static function ( $m ) {
- return ( strpos( $m, 'SessionBackend ' ) === 0
- || strpos( $m, 'SessionManager using store ' ) === 0
+ return ( str_starts_with( $m, 'SessionBackend ' )
+ || str_starts_with( $m, 'SessionManager using store ' )
// These were added for T264793 and behave somewhat erratically, not worth testing
- || strpos( $m, 'Failed to load session, unpersisting' ) === 0
+ || str_starts_with( $m, 'Failed to load session, unpersisting' )
|| preg_match( '/^(Persisting|Unpersisting) session (for|due to)/', $m )
) ? null : $m;
} );
diff --git a/tests/phpunit/includes/skins/SkinMustacheTest.php b/tests/phpunit/includes/skins/SkinMustacheTest.php
index af2af3295139..9b8fadaf067f 100644
--- a/tests/phpunit/includes/skins/SkinMustacheTest.php
+++ b/tests/phpunit/includes/skins/SkinMustacheTest.php
@@ -51,7 +51,7 @@ class SkinMustacheTest extends MediaWikiIntegrationTestCase {
return;
} elseif ( is_array( $value ) ) {
$this->assertTrue(
- strpos( $key, 'data-' ) === 0 || strpos( $key, 'array-' ) === 0,
+ str_starts_with( $key, 'data-' ) || str_starts_with( $key, 'array-' ),
"Template data that is an object should be associated with a key" .
" prefixed with `data-` or `array-` ($key)"
);
@@ -69,20 +69,20 @@ class SkinMustacheTest extends MediaWikiIntegrationTestCase {
}
}
} elseif ( is_string( $value ) ) {
- if ( strpos( $value, '<' ) !== false ) {
+ if ( str_contains( $value, '<' ) ) {
$this->assertTrue(
- strpos( $key, 'html-' ) === 0 || $key === 'html',
+ str_starts_with( $key, 'html-' ) || $key === 'html',
"Template data containing HTML must be prefixed with `html-` ($key)"
);
}
} elseif ( is_bool( $value ) ) {
$this->assertTrue(
- strpos( $key, 'is-' ) === 0 || strpos( $key, 'has-' ) === 0,
+ str_starts_with( $key, 'is-' ) || str_starts_with( $key, 'has-' ),
"Template data containing booleans must be prefixed with `is-` or `has-` ($key)"
);
} elseif ( is_numeric( $value ) ) {
$this->assertTrue(
- strpos( $key, 'number-' ) === 0,
+ str_starts_with( $key, 'number-' ),
"Template data containing numbers must be prefixed with `number-` ($key)"
);
} else {
diff --git a/tests/phpunit/includes/specialpage/ChangesListSpecialPageTest.php b/tests/phpunit/includes/specialpage/ChangesListSpecialPageTest.php
index 3f8f214cac14..3062abb29ec8 100644
--- a/tests/phpunit/includes/specialpage/ChangesListSpecialPageTest.php
+++ b/tests/phpunit/includes/specialpage/ChangesListSpecialPageTest.php
@@ -153,7 +153,7 @@ class ChangesListSpecialPageTest extends AbstractChangesListSpecialPageTestCase
if ( $var instanceof IExpression ) {
$var = $var->toGeneralizedSql();
}
- return ( is_array( $var ) || strpos( (string)$var, 'rc_timestamp ' ) === false );
+ return is_array( $var ) || !str_contains( (string)$var, 'rc_timestamp ' );
}
public function testRcNsFilter() {
diff --git a/tests/phpunit/includes/specials/QueryAllSpecialPagesTest.php b/tests/phpunit/includes/specials/QueryAllSpecialPagesTest.php
index 5f1fb92b1324..423a42cc1019 100644
--- a/tests/phpunit/includes/specials/QueryAllSpecialPagesTest.php
+++ b/tests/phpunit/includes/specials/QueryAllSpecialPagesTest.php
@@ -23,7 +23,7 @@ class QueryAllSpecialPagesTest extends MediaWikiIntegrationTestCase {
*/
private $queryPages;
- /** @var string[] List query pages that can not be tested automatically */
+ /** @var string[] List query pages that cannot be tested automatically */
protected $manualTest = [
SpecialLinkSearch::class
];
@@ -60,12 +60,12 @@ class QueryAllSpecialPagesTest extends MediaWikiIntegrationTestCase {
// With MySQL, skips special pages reopening a temporary table
// See https://bugs.mysql.com/bug.php?id=10327
if (
- $this->db->getType() == 'mysql' &&
- strpos( $this->db->getSoftwareLink(), 'MySQL' ) &&
+ $this->db->getType() === 'mysql' &&
+ str_contains( $this->db->getSoftwareLink(), 'MySQL' ) &&
in_array( $page->getName(), $this->reopensTempTable )
) {
$this->markTestSkipped( "SQL query for page {$page->getName()} "
- . "can not be tested on MySQL backend (it reopens a temporary table)" );
+ . "cannot be tested on MySQL backend (it reopens a temporary table)" );
continue;
}
diff --git a/tests/phpunit/includes/xml/XmlTest.php b/tests/phpunit/includes/xml/XmlTest.php
index ebb53b4e1fe1..1f9759425456 100644
--- a/tests/phpunit/includes/xml/XmlTest.php
+++ b/tests/phpunit/includes/xml/XmlTest.php
@@ -262,7 +262,7 @@ class XmlTest extends MediaWikiIntegrationTestCase {
$this->assertEquals(
'<label for="id">name</label>',
Xml::label( 'name', 'id', [ 'generated' => true ] ),
- 'label() can not be given a generated attribute'
+ 'label() cannot be given a generated attribute'
);
$this->assertEquals(
'<label for="id" class="nice">name</label>',
diff --git a/tests/phpunit/integration/includes/ExtensionJsonTestBase.php b/tests/phpunit/integration/includes/ExtensionJsonTestBase.php
index a74a60fca43e..5f6566349b61 100644
--- a/tests/phpunit/integration/includes/ExtensionJsonTestBase.php
+++ b/tests/phpunit/integration/includes/ExtensionJsonTestBase.php
@@ -223,8 +223,8 @@ abstract class ExtensionJsonTestBase extends MediaWikiIntegrationTestCase {
public function testServicesSorted( array $services ): void {
$sortedServices = $services;
usort( $sortedServices, function ( $serviceA, $serviceB ) {
- $isExtensionServiceA = strpos( $serviceA, $this->serviceNamePrefix ) === 0;
- $isExtensionServiceB = strpos( $serviceB, $this->serviceNamePrefix ) === 0;
+ $isExtensionServiceA = str_starts_with( $serviceA, $this->serviceNamePrefix );
+ $isExtensionServiceB = str_starts_with( $serviceB, $this->serviceNamePrefix );
if ( $isExtensionServiceA !== $isExtensionServiceB ) {
return $isExtensionServiceA ? 1 : -1;
}
diff --git a/tests/phpunit/structure/AvailableRightsTest.php b/tests/phpunit/structure/AvailableRightsTest.php
index 947ad92b56ef..2f0095a684a6 100644
--- a/tests/phpunit/structure/AvailableRightsTest.php
+++ b/tests/phpunit/structure/AvailableRightsTest.php
@@ -90,7 +90,7 @@ class AvailableRightsTest extends MediaWikiIntegrationTestCase {
}
/**
- * Test, if for all rights an action- message exist,
+ * Test, if for all rights an action- message exists,
* which is used on Special:ListGroupRights as help text
* Extensions and core
*
@@ -101,7 +101,7 @@ class AvailableRightsTest extends MediaWikiIntegrationTestCase {
}
/**
- * Test, if for all rights a right- message exist,
+ * Test, if for all rights a right- message exists,
* which is used on Special:ListGroupRights as help text
* Extensions and core
*/
@@ -120,8 +120,7 @@ class AvailableRightsTest extends MediaWikiIntegrationTestCase {
$messagesToCheck = [];
foreach ( $allMessageKeys as $message ) {
- // === 0: must be at beginning of string (position 0)
- if ( strpos( $message, $prefix ) === 0 ) {
+ if ( str_starts_with( $message, $prefix ) ) {
$messagesToCheck[] = substr( $message, strlen( $prefix ) );
}
}
diff --git a/tests/phpunit/structure/BundleSizeTestBase.php b/tests/phpunit/structure/BundleSizeTestBase.php
index 572105e65c98..d704b962b740 100644
--- a/tests/phpunit/structure/BundleSizeTestBase.php
+++ b/tests/phpunit/structure/BundleSizeTestBase.php
@@ -53,10 +53,10 @@ abstract class BundleSizeTestBase extends MediaWikiIntegrationTestCase {
$projectName = $testCase['projectName'] ?? '';
$moduleName = $testCase['resourceModule'];
if ( is_string( $maxSize ) ) {
- if ( strpos( $maxSize, 'KB' ) !== false || strpos( $maxSize, 'kB' ) !== false ) {
+ if ( str_contains( $maxSize, 'KB' ) || str_contains( $maxSize, 'kB' ) ) {
$maxSize = (float)str_replace( [ 'KB', 'kB', ' KB', ' kB' ], '', $maxSize );
$maxSize = $maxSize * 1024;
- } elseif ( strpos( $maxSize, 'B' ) !== false ) {
+ } elseif ( str_contains( $maxSize, 'B' ) ) {
$maxSize = (float)str_replace( [ ' B', 'B' ], '', $maxSize );
}
}
diff --git a/tests/phpunit/structure/PHPUnitConfigTest.php b/tests/phpunit/structure/PHPUnitConfigTest.php
index 7fe133769fdc..c10b8cfc8207 100644
--- a/tests/phpunit/structure/PHPUnitConfigTest.php
+++ b/tests/phpunit/structure/PHPUnitConfigTest.php
@@ -107,7 +107,7 @@ class PHPUnitConfigTest extends PHPUnit\Framework\TestCase {
return true;
}
- if ( strpos( "$dirB/", $dirA ) === 0 ) {
+ if ( str_starts_with( "$dirB/", $dirA ) ) {
return true;
}
diff --git a/tests/phpunit/suites/ParserTestTopLevelSuite.php b/tests/phpunit/suites/ParserTestTopLevelSuite.php
index d667540318c6..18a9347a6778 100644
--- a/tests/phpunit/suites/ParserTestTopLevelSuite.php
+++ b/tests/phpunit/suites/ParserTestTopLevelSuite.php
@@ -106,7 +106,7 @@ class ParserTestTopLevelSuite extends TestSuite {
# Filter out .txt files
$files = ParserTestRunner::getParserTestFiles();
foreach ( $files as $extName => $parserTestFile ) {
- $isCore = ( strpos( $parserTestFile, $mwTestDir ) === 0 );
+ $isCore = str_starts_with( $parserTestFile, $mwTestDir );
if ( $isCore && $wantsCore ) {
self::debug( "included core parser tests: $parserTestFile" );
@@ -124,7 +124,7 @@ class ParserTestTopLevelSuite extends TestSuite {
$testList = [];
$counter = 0;
foreach ( $filesToTest as $extensionName => $fileName ) {
- $isCore = ( strpos( $fileName, $mwTestDir ) === 0 );
+ $isCore = str_starts_with( $fileName, $mwTestDir );
if ( is_int( $extensionName ) ) {
// If there's no extension name because this is coming
// from the legacy global, then assume the next level directory
diff --git a/tests/phpunit/unit/includes/exception/MWExceptionHandlerTest.php b/tests/phpunit/unit/includes/exception/MWExceptionHandlerTest.php
index 41f937b218ae..39ff45d7f2df 100644
--- a/tests/phpunit/unit/includes/exception/MWExceptionHandlerTest.php
+++ b/tests/phpunit/unit/includes/exception/MWExceptionHandlerTest.php
@@ -66,7 +66,7 @@ TEXT;
}
// Make sure our stack trace contains an array and an object passed to
- // some function in the stacktrace. Else, we can not assert the trace
+ // some function in the stacktrace. Else, we cannot assert the trace
// redaction achieved its job.
$trace = $e->getTrace();
$hasObject = false;
diff --git a/tests/phpunit/unit/includes/libs/DebugInfo/DebugInfoTraitTest.php b/tests/phpunit/unit/includes/libs/DebugInfo/DebugInfoTraitTest.php
index 6ef12a212d42..04e8b5e37bd2 100644
--- a/tests/phpunit/unit/includes/libs/DebugInfo/DebugInfoTraitTest.php
+++ b/tests/phpunit/unit/includes/libs/DebugInfo/DebugInfoTraitTest.php
@@ -10,7 +10,7 @@ class DebugInfoTraitTest extends \PHPUnit\Framework\TestCase {
public function setUp(): void {
if ( extension_loaded( 'xdebug' ) ) {
if ( version_compare( phpversion( 'xdebug' ), '3.0.0', '>=' ) ) {
- if ( strpos( ini_get( 'xdebug.mode' ), 'develop' ) !== false ) {
+ if ( str_contains( ini_get( 'xdebug.mode' ), 'develop' ) ) {
$this->markTestSkipped( 'Can\'t run this test with xdebug.mode=develop. ' .
'Use xdebug.mode=coverage to do test coverage without overloading var_dump.' );
}
diff --git a/tests/phpunit/unit/includes/page/MovePageTest.php b/tests/phpunit/unit/includes/page/MovePageTest.php
index 280208f0e366..2ffd749009ba 100644
--- a/tests/phpunit/unit/includes/page/MovePageTest.php
+++ b/tests/phpunit/unit/includes/page/MovePageTest.php
@@ -26,7 +26,7 @@ class MovePageTest extends MediaWikiUnitTestCase {
'authority' => $this->mockRegisteredUltimateAuthority(),
'good' => true,
];
- yield 'can not move' => [
+ yield 'cannot move' => [
'authority' => $this->mockAnonAuthority( function (
string $permission,
PageIdentity $page,
@@ -41,7 +41,7 @@ class MovePageTest extends MediaWikiUnitTestCase {
} ),
'good' => false,
];
- yield 'can not edit old page' => [
+ yield 'cannot edit old page' => [
'authority' => $this->mockAnonAuthority( static function (
string $permission,
PageIdentity $page,
@@ -55,7 +55,7 @@ class MovePageTest extends MediaWikiUnitTestCase {
} ),
'good' => false,
];
- yield 'can not move-target' => [
+ yield 'cannot move-target' => [
'authority' => $this->mockAnonAuthority( function (
string $permission,
PageIdentity $page,
@@ -70,7 +70,7 @@ class MovePageTest extends MediaWikiUnitTestCase {
} ),
'good' => false,
];
- yield 'can not edit new page' => [
+ yield 'cannot edit new page' => [
'authority' => $this->mockAnonAuthority( static function (
string $permission,
PageIdentity $page,
diff --git a/tests/phpunit/unit/maintenance/MaintenanceParametersTest.php b/tests/phpunit/unit/maintenance/MaintenanceParametersTest.php
index 781bc654f8e6..65871859028c 100644
--- a/tests/phpunit/unit/maintenance/MaintenanceParametersTest.php
+++ b/tests/phpunit/unit/maintenance/MaintenanceParametersTest.php
@@ -344,7 +344,7 @@ class MaintenanceParametersTest extends TestCase {
private function findInLines( array $lines, $regex, $start = 0 ) {
for ( $i = $start; $i < count( $lines ); $i++ ) {
- if ( strpos( $lines[ $i ], $regex ) !== false ) {
+ if ( str_contains( $lines[ $i ], $regex ) ) {
return $i;
}
}