bug #27902 Fix the detection of the Process new argument (stof)

This PR was merged into the 3.4 branch.

Discussion
----------

Fix the detection of the Process new argument

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

This fixes the detection of the new method signature when triggering the deprecation warning. The new `$env` parameter is the second argument, not the first one.

Commits
-------

57e95f3f9a Fix the detection of the Process new argument
This commit is contained in:
Nicolas Grekas 2018-07-09 14:30:57 +02:00
commit 0fcc874e6f
1 changed files with 1 additions and 1 deletions

View File

@ -272,7 +272,7 @@ class Process implements \IteratorAggregate
} else {
if (__CLASS__ !== static::class) {
$r = new \ReflectionMethod($this, __FUNCTION__);
if (__CLASS__ !== $r->getDeclaringClass()->getName() && (2 > $r->getNumberOfParameters() || 'env' !== $r->getParameters()[0]->name)) {
if (__CLASS__ !== $r->getDeclaringClass()->getName() && (2 > $r->getNumberOfParameters() || 'env' !== $r->getParameters()[1]->name)) {
@trigger_error(sprintf('The %s::start() method expects a second "$env" argument since Symfony 3.3. It will be made mandatory in 4.0.', static::class), E_USER_DEPRECATED);
}
}