Skip to content

Error on unknown parameter name in parameter conditional type#1966

Merged
ondrejmirtes merged 1 commit intophpstan:1.9.xfrom
rvanvelzen:bug-8284
Nov 4, 2022
Merged

Error on unknown parameter name in parameter conditional type#1966
ondrejmirtes merged 1 commit intophpstan:1.9.xfrom
rvanvelzen:bug-8284

Conversation

@rvanvelzen
Copy link
Copy Markdown
Contributor

@rvanvelzen rvanvelzen commented Nov 4, 2022

{
$this->analyse([__DIR__ . '/data/bug-8284.php'], [
[
'Conditional return type references unknown parameter $callable.',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is no @return tag on the replaceCallback() method so is this error message a bit misleading?
it looks like it's really a conditional parameter type?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The feature is actually "conditonal types", not "conditional return types" - it was implemented as a first thing after we released "conditional return types".

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But for the sake of backward compatibility, let's leave it like this.

@ondrejmirtes ondrejmirtes merged commit 26bf11c into phpstan:1.9.x Nov 4, 2022
@ondrejmirtes
Copy link
Copy Markdown
Member

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unknown parameter name goes unnoticed in conditional type

3 participants