Additions to the PHP language made these redundant.
* wfArrayLookup() is similar to PHP 5.1's array_intersect_key()
yet has serious limitations. For example, integer string values
are implicitly cast to integers.
* wfArrayMerge() can be replaced by PHP 5.3's array_replace().
* wfTime() just returns microtime( true ).
Change-Id: I2c6844fc48a265d2d885083b5bed8df846e0aaf4
- * Returns an array where the values in the first array are replaced by the
- * values in the second array with the corresponding keys
+ * Returns an array where the values in array $b are replaced by the
+ * values in array $a with the corresponding keys
+ * @deprecated since 1.22; use array_intersect_key()
* @param $a Array
* @param $b Array
* @return array
*/
function wfArrayLookup( $a, $b ) {
* @param $a Array
* @param $b Array
* @return array
*/
function wfArrayLookup( $a, $b ) {
+ wfDeprecated( __FUNCTION__, '1.22' );
return array_flip( array_intersect( array_flip( $a ), array_keys( $b ) ) );
}
return array_flip( array_intersect( array_flip( $a ), array_keys( $b ) ) );
}
* Backwards array plus for people who haven't bothered to read the PHP manual
* XXX: will not darn your socks for you.
*
* Backwards array plus for people who haven't bothered to read the PHP manual
* XXX: will not darn your socks for you.
*
+ * @deprecated since 1.22; use array_replace()
* @param $array1 Array
* @param [$array2, [...]] Arrays
* @return Array
*/
function wfArrayMerge( $array1/* ... */ ) {
* @param $array1 Array
* @param [$array2, [...]] Arrays
* @return Array
*/
function wfArrayMerge( $array1/* ... */ ) {
+ wfDeprecated( __FUNCTION__, '1.22' );
$args = func_get_args();
$args = array_reverse( $args, true );
$out = array();
$args = func_get_args();
$args = array_reverse( $args, true );
$out = array();
/**
* Get the current unix timestamp with microseconds. Useful for profiling
/**
* Get the current unix timestamp with microseconds. Useful for profiling
+ * @deprecated since 1.22; call microtime() directly
* @return Float
*/
function wfTime() {
* @return Float
*/
function wfTime() {
+ wfDeprecated( __FUNCTION__, '1.22' );
return microtime( true );
}
return microtime( true );
}
UserMailer::quotedPrintable( "\xc4\x88u legebla?", "UTF-8" ) );
}
UserMailer::quotedPrintable( "\xc4\x88u legebla?", "UTF-8" ) );
}
- function testTime() {
- $start = wfTime();
- $this->assertInternalType( 'float', $start );
- $end = wfTime();
- $this->assertTrue( $end > $start, "Time is running backwards!" );
- }
-
public static function provideArrayToCGI() {
return array(
array( array(), '' ), // empty
public static function provideArrayToCGI() {
return array(
array( array(), '' ), // empty