From 296e57f6343bd8a3c43bc5a931ae9c81527a77dc Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Wed, 6 Feb 2013 14:38:57 -0500 Subject: [PATCH] Deprecate in_string() It's a silly wrapper for something you can do in one line of PHP anyway. Change-Id: Ib85e4aaa20e62fe5f218b38cf0759c9c799c3381 --- includes/GlobalFunctions.php | 2 ++ tests/phpunit/includes/GlobalFunctions/GlobalTest.php | 9 --------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index c57018ef98..90bc891a27 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -2622,12 +2622,14 @@ function wfPercent( $nr, $acc = 2, $round = true ) { /** * Find out whether or not a mixed variable exists in a string * + * @deprecated Just use str(i)pos * @param $needle String * @param $str String * @param $insensitive Boolean * @return Boolean */ function in_string( $needle, $str, $insensitive = false ) { + wfDeprecated( __METHOD__, '1.21' ); $func = 'strpos'; if( $insensitive ) $func = 'stripos'; diff --git a/tests/phpunit/includes/GlobalFunctions/GlobalTest.php b/tests/phpunit/includes/GlobalFunctions/GlobalTest.php index 105ce6db3c..1219d4397a 100644 --- a/tests/phpunit/includes/GlobalFunctions/GlobalTest.php +++ b/tests/phpunit/includes/GlobalFunctions/GlobalTest.php @@ -425,15 +425,6 @@ class GlobalTest extends MediaWikiTestCase { } - - function testInStringTest() { - - $this->assertTrue( in_string( 'foo', 'foobar' ), 'foo is in foobar' ); - $this->assertFalse( in_string( 'Bar', 'foobar' ), 'Case-sensitive by default' ); - $this->assertTrue( in_string( 'Foo', 'foobar', true ), 'Case-insensitive when asked' ); - - } - /** * test @see wfShorthandToInteger() * @dataProvider provideShorthand -- 2.20.1