Skip to content

Commit

Permalink
[BCB] Parameter $callableParameters of MutatingScope::enterAnonymou…
Browse files Browse the repository at this point in the history
…sFunction() and enterArrowFunction() made required
  • Loading branch information
ondrejmirtes committed Sep 14, 2024
1 parent 5962aa1 commit a2854d1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,7 @@ If you want to change `$overwrite` or `$rootExpr` (previous parameters also used
### Changed `TypeSpecifier::specifyTypesInCondition()`

This method now longer accepts `Expr $rootExpr`. If you want to change it, call `setRootExpr()` on [`SpecifiedTypes`](https://apiref.phpstan.org/2.0.x/PHPStan.Analyser.SpecifiedTypes.html) (object returned by `TypeSpecifier::specifyTypesInCondition()`). `setRootExpr()` method returns a new object (SpecifiedTypes is immutable).

### Minor backward compatibility breaks

* Parameter `$callableParameters` of [`MutatingScope::enterAnonymousFunction()`](https://apiref.phpstan.org/2.0.x/PHPStan.Analyser.MutatingScope.html#_enterAnonymousFunction) and [`enterArrowFunction()`](https://apiref.phpstan.org/2.0.x/PHPStan.Analyser.MutatingScope.html#_enterArrowFunction) made required
6 changes: 3 additions & 3 deletions src/Analyser/MutatingScope.php
Original file line number Diff line number Diff line change
Expand Up @@ -3376,7 +3376,7 @@ public function isInClosureBind(): bool
*/
public function enterAnonymousFunction(
Expr\Closure $closure,
?array $callableParameters = null,
?array $callableParameters,
): self
{
$anonymousFunctionReflection = $this->getType($closure);
Expand Down Expand Up @@ -3411,7 +3411,7 @@ public function enterAnonymousFunction(
*/
private function enterAnonymousFunctionWithoutReflection(
Expr\Closure $closure,
?array $callableParameters = null,
?array $callableParameters,
): self
{
$expressionTypes = [];
Expand Down Expand Up @@ -3553,7 +3553,7 @@ private function invalidateStaticExpressions(array $expressionTypes): array
* @api
* @param ParameterReflection[]|null $callableParameters
*/
public function enterArrowFunction(Expr\ArrowFunction $arrowFunction, ?array $callableParameters = null): self
public function enterArrowFunction(Expr\ArrowFunction $arrowFunction, ?array $callableParameters): self
{
$anonymousFunctionReflection = $this->getType($arrowFunction);
if (!$anonymousFunctionReflection instanceof ClosureType) {
Expand Down

0 comments on commit a2854d1

Please sign in to comment.