BC break in Nette\Http\Response::setCode in PHP 7.2
- slepic
- Member | 7
in nette/http 2.4.3 the signature looks like this:
public function setCode($code)
in nette/http 2.4.4 the signature looks like this:
public function setCode($code, $reason = null)
but this is only in the class, not the interface.
Now if someone extended the Nette\Http\Response when using
nette/http<2.4.4 and overrides the setCode method (using the 1-param
signature), it's fine in PHP 7.1 and older, but when they move to PHP >=
7.2, it becomes a fatal error.
I didn't find this documented in official PHP changelist. But it makes sense,
one cannot extend a parent and reduce the number of arguments of an inherited
method. It was just wrong in older PHP that this wasn't reported as error.
I suggest you add this info to the 2.4 migration guide.