NelmioApiDocBundle/ModelDescriber
Nicolas bd952b170e
Add a check for Constraint class existing before using it
*Context*: NelmioApiDocBundle does not require clients to have the symfony/validator package. However it requires it in its dev dependencies.

*Problem*: If client of library does not have symfony/validator and uses PHP8, NelmioApiDocBundle will assume that symfony/validator is installed, in `SymfonyConstraintAnnotationReader.php`

*Solution*: We should not assume that client has symfony/validator. So before reading attributes of this class, we now try to see if class exists. 
- Tests still run.
- Tested in a project without symfony/validator and requiring this version, it now works.

The error before this fix was : 
Exception: `ClassNotFound`
Message for me: `Attempted to load class "Constraint" from namespace "Symfony\Component\Validator".
Did you forget a "use" statement for e.g. "JsonSchema\Constraints\Constraint" or "Doctrine\DBAL\Schema\Constraint"?`
2021-06-11 07:23:54 +02:00
..
Annotations Add a check for Constraint class existing before using it 2021-06-11 07:23:54 +02:00
ApplyOpenApiDiscriminatorTrait.php Don't Use ref in Discriminator mapping 2021-02-08 15:39:14 -06:00
BazingaHateoasModelDescriber.php OpenApi 3 Support (#1623) 2020-05-28 13:19:11 +02:00
FallbackObjectModelDescriber.php OpenApi 3 Support (#1623) 2020-05-28 13:19:11 +02:00
FormModelDescriber.php Merge branch '3.x' 2020-12-10 22:28:55 +01:00
JMSModelDescriber.php Fix the tests broken by zircote/swagger-php 2020-09-27 22:20:04 +02:00
ModelDescriberInterface.php OpenApi 3 Support (#1623) 2020-05-28 13:19:11 +02:00
ObjectModelDescriber.php Fix CS 2021-02-01 09:50:15 -06:00