EzDevInfo.com

Underscore.php

PHP port of Underscore.js Underscore.php underscore.php is a php port of the popular underscore.js library

Underscore.php throwing Non-static method __::invoke() should not be called statically

I've just upgraded to PHP 5.5.3 and I noticed that Underscore.php is throwing an odd error:

Non-static method __::invoke() should not be called statically

The code in question that's causing this error look like this:

$params = \__::invoke( $params, function( $value ) {
   ...
} );

Plowing through the Underscore.php source, I don't understand why this error is being thrown since the call to invoke should be handled by the __callStatic handler:

public static function __callStatic($name, $arguments) {
  $mixins =& self::getInstance()->_mixins;
  return call_user_func_array($mixins[$name], $arguments);
}

I don't want to mess with the error reporting settings in PHP because this would mean making a PHP settings change through the entire stack.

My current workaround is:

$__ = new \__();

$params = $__->invoke( $params, function( $value ) {
  ...
} );

Which is clumsy to say the least. Is there a better way?


Source: (StackOverflow)