Skip to content

Conversation

guilliamxavier
Copy link
Contributor

@guilliamxavier guilliamxavier commented Mar 31, 2021

Q A
Branch? main
Bug fix? yes
New feature? no
Deprecations? no
Tickets Fix #4162
License MIT
Doc PR

PhpStorm was complaining on line 33:

Unused local variable 'choices'. The value of the variable is overwritten immediately.

Also if you think about it, in the case of e.g. @Assert\Choice(callback={"App\Entity\Foo", "getBats"}) (or @Assert\Choice(callback="App\Entity\Foo::getBats")), i.e.

  • $constraint->callback === ['App\Entity\Foo', 'getBats'] (or $constraint->callback === 'App\Entity\Foo::getBats') (note: typo, intended getBars)
  • $constraint->choices === null
  • $constraint->multiple === false

we would end up with an incorrect "enum": ["App\\Entity\\Foo", "getBats"] (or "enum": "App\\Entity\\Foo::getBats")

@alanpoulain alanpoulain merged commit 6b02f15 into api-platform:main Mar 31, 2021
@alanpoulain
Copy link
Member

Nice spotting, thanks.

@guilliamxavier guilliamxavier deleted the patch-1 branch March 31, 2021 15:19
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.

2 participants