GlobalFunctions: Remove usage of `wfArrayFilter` & `wfArrayFilterByKey`
authorDerick Alangi <alangiderick@gmail.com>
Sat, 27 Apr 2019 06:40:47 +0000 (07:40 +0100)
committerDerick Alangi <alangiderick@gmail.com>
Sat, 27 Apr 2019 06:48:07 +0000 (07:48 +0100)
These functions were hard deprecated in 1.32 and usage no longer exist
and seems to have been completely removed from all repos. See below;

Usage
=====

https://codesearch.wmflabs.org/search/?q=%5B%5E%3E%5D(wfArrayFilterByKey%5C(%7CwfArrayFilter%5C()&i=nope&files=&repos=

Bug: T42485
Change-Id: I28092eeb8dec058c5dba2fb63f3602249c137b31

includes/GlobalFunctions.php
tests/phpunit/includes/GlobalFunctions/wfArrayFilterTest.php [deleted file]

index 2497b0f..118a617 100644 (file)
@@ -140,32 +140,6 @@ function wfArrayDiff2_cmp( $a, $b ) {
        }
 }
 
-/**
- * @deprecated since 1.32, use array_filter() with ARRAY_FILTER_USE_BOTH directly
- *
- * @param array $arr
- * @param callable $callback Will be called with the array value and key (in that order) and
- *   should return a bool which will determine whether the array element is kept.
- * @return array
- */
-function wfArrayFilter( array $arr, callable $callback ) {
-       wfDeprecated( __FUNCTION__, '1.32' );
-       return array_filter( $arr, $callback, ARRAY_FILTER_USE_BOTH );
-}
-
-/**
- * @deprecated since 1.32, use array_filter() with ARRAY_FILTER_USE_KEY directly
- *
- * @param array $arr
- * @param callable $callback Will be called with the array key and should return a bool which
- *   will determine whether the array element is kept.
- * @return array
- */
-function wfArrayFilterByKey( array $arr, callable $callback ) {
-       wfDeprecated( __FUNCTION__, '1.32' );
-       return array_filter( $arr, $callback, ARRAY_FILTER_USE_KEY );
-}
-
 /**
  * Appends to second array if $value differs from that in $default
  *
diff --git a/tests/phpunit/includes/GlobalFunctions/wfArrayFilterTest.php b/tests/phpunit/includes/GlobalFunctions/wfArrayFilterTest.php
deleted file mode 100644 (file)
index bc930be..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-<?php
-
-/**
- * @group GlobalFunctions
- * @covers ::wfArrayFilter
- * @covers ::wfArrayFilterByKey
- */
-class WfArrayFilterTest extends MediaWikiTestCase {
-       public function testWfArrayFilter() {
-               $this->hideDeprecated( 'wfArrayFilter' );
-               $arr = [ 'a' => 1, 'b' => 2, 'c' => 3 ];
-               $filtered = wfArrayFilter( $arr, function ( $val, $key ) {
-                       return $key !== 'b';
-               } );
-               $this->assertSame( [ 'a' => 1, 'c' => 3 ], $filtered );
-
-               $arr = [ 'a' => 1, 'b' => 2, 'c' => 3 ];
-               $filtered = wfArrayFilter( $arr, function ( $val, $key ) {
-                       return $val !== 2;
-               } );
-               $this->assertSame( [ 'a' => 1, 'c' => 3 ], $filtered );
-
-               $arr = [ 'a', 'b', 'c' ];
-               $filtered = wfArrayFilter( $arr, function ( $val, $key ) {
-                       return $key !== 0;
-               } );
-               $this->assertSame( [ 1 => 'b',  2 => 'c' ], $filtered );
-       }
-
-       public function testWfArrayFilterByKey() {
-               $this->hideDeprecated( 'wfArrayFilterByKey' );
-               $arr = [ 'a' => 1, 'b' => 2, 'c' => 3 ];
-               $filtered = wfArrayFilterByKey( $arr, function ( $key ) {
-                       return $key !== 'b';
-               } );
-               $this->assertSame( [ 'a' => 1, 'c' => 3 ], $filtered );
-
-               $arr = [ 'a', 'b', 'c' ];
-               $filtered = wfArrayFilterByKey( $arr, function ( $key ) {
-                       return $key !== 0;
-               } );
-               $this->assertSame( [ 1 => 'b',  2 => 'c' ], $filtered );
-       }
-}