phpstan-drupal icon indicating copy to clipboard operation
phpstan-drupal copied to clipboard

Symfony constraints and unknown properties

Open DonRichards opened this issue 3 years ago • 1 comments

Using drupal-check I'm getting

Access to an undefined property
         Symfony\Component\Validator\Constraint::$alreadyExists.

But my ... > Validation > Constraint > UniqueItem.php I have public $alreadyExists = ... and I'm calling it from ... > Validation > Constraint > UniqueItemValidation.php

Pointing to real-world code UniqueItemValidator.php#L91 to keep the description as simple as possible. I'm not fishing for someone to do my job for me, just hoping to either understand this or report a bug.

DonRichards avatar Aug 09 '22 19:08 DonRichards

I remember looking at this quick when pinged in Slack and asked @DonRichards to open the issue. I thought phpstan-symfoyn would help, but it doesn't so we'll need some kind of rule to check the matching constraint when there is validator analysis

mglaman avatar Aug 16 '22 00:08 mglaman