minor #12531 [2.5] Remove possible call_user_func() (nicolas-grekas)

This PR was merged into the 2.5 branch.

Discussion
----------

[2.5] Remove possible call_user_func()

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Remove possible call_user_func() introduced in 2.5

Commits
-------

94a04cb [2.5] Remove possible call_user_func()
This commit is contained in:
Fabien Potencier 2014-12-11 19:59:58 +01:00
commit b9512b6993
3 changed files with 8 additions and 7 deletions

View File

@ -87,11 +87,12 @@ class BinaryNode extends Node
if (isset(self::$functions[$operator])) { if (isset(self::$functions[$operator])) {
$right = $this->nodes['right']->evaluate($functions, $values); $right = $this->nodes['right']->evaluate($functions, $values);
if ('not in' == $operator) { if ('not in' === $operator) {
return !call_user_func('in_array', $left, $right); return !in_array($left, $right);
} }
$f = self::$functions[$operator];
return call_user_func(self::$functions[$operator], $left, $right); return $f($left, $right);
} }
switch ($operator) { switch ($operator) {

View File

@ -992,7 +992,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
$p = $this->getProcess('php -r "usleep(500000);"'); $p = $this->getProcess('php -r "usleep(500000);"');
$p->disableOutput(); $p->disableOutput();
$this->setExpectedException($exception, $exceptionMessage); $this->setExpectedException($exception, $exceptionMessage);
call_user_func(array($p, $startMethod), function () {}); $p->{$startMethod}(function () {});
} }
public function provideStartMethods() public function provideStartMethods()
@ -1013,7 +1013,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
$p->disableOutput(); $p->disableOutput();
$p->start(); $p->start();
$this->setExpectedException('Symfony\Component\Process\Exception\LogicException', 'Output has been disabled.'); $this->setExpectedException('Symfony\Component\Process\Exception\LogicException', 'Output has been disabled.');
call_user_func(array($p, $fetchMethod)); $p->{$fetchMethod}();
} }
public function provideOutputFetchingMethods() public function provideOutputFetchingMethods()

View File

@ -505,11 +505,11 @@ class PropertyAccessor implements PropertyAccessorInterface
} }
foreach ($itemToRemove as $item) { foreach ($itemToRemove as $item) {
call_user_func(array($object, $removeMethod), $item); $object->{$removeMethod}($item);
} }
foreach ($itemsToAdd as $item) { foreach ($itemsToAdd as $item) {
call_user_func(array($object, $addMethod), $item); $object->{$addMethod}($item);
} }
} }