vendor/symfony/validator/Mapping/Loader/AutoMappingTrait.php line 24

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the Symfony package.
  4.  *
  5.  * (c) Fabien Potencier <fabien@symfony.com>
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10. namespace Symfony\Component\Validator\Mapping\Loader;
  11. use Symfony\Component\Validator\Mapping\AutoMappingStrategy;
  12. use Symfony\Component\Validator\Mapping\ClassMetadata;
  13. /**
  14.  * Utility methods to create auto mapping loaders.
  15.  *
  16.  * @author Kévin Dunglas <dunglas@gmail.com>
  17.  */
  18. trait AutoMappingTrait
  19. {
  20.     private function isAutoMappingEnabledForClass(ClassMetadata $metadatastring $classValidatorRegexp null): bool
  21.     {
  22.         // Check if AutoMapping constraint is set first
  23.         if (AutoMappingStrategy::NONE !== $strategy $metadata->getAutoMappingStrategy()) {
  24.             return AutoMappingStrategy::ENABLED === $strategy;
  25.         }
  26.         // Fallback on the config
  27.         return null !== $classValidatorRegexp && preg_match($classValidatorRegexp$metadata->getClassName());
  28.     }
  29. }