From: Chad Horohoe Date: Wed, 6 Feb 2013 19:38:57 +0000 (-0500) Subject: Deprecate in_string() X-Git-Tag: 1.31.0-rc.0~20780^2 X-Git-Url: http://git.cyclocoop.org/%22.%24image2.%22?a=commitdiff_plain;h=296e57f6343bd8a3c43bc5a931ae9c81527a77dc;p=lhc%2Fweb%2Fwiklou.git Deprecate in_string() It's a silly wrapper for something you can do in one line of PHP anyway. Change-Id: Ib85e4aaa20e62fe5f218b38cf0759c9c799c3381 --- 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