Deprecate in_string()
authorChad Horohoe <chadh@wikimedia.org>
Wed, 6 Feb 2013 19:38:57 +0000 (14:38 -0500)
committerChad Horohoe <chadh@wikimedia.org>
Wed, 6 Feb 2013 19:38:57 +0000 (14:38 -0500)
It's a silly wrapper for something you can do in one line
of PHP anyway.

Change-Id: Ib85e4aaa20e62fe5f218b38cf0759c9c799c3381

includes/GlobalFunctions.php
tests/phpunit/includes/GlobalFunctions/GlobalTest.php

index c57018e..90bc891 100644 (file)
@@ -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';
 
index 105ce6d..1219d43 100644 (file)
@@ -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