Skip to content

Commit

Permalink
Fix CS
Browse files Browse the repository at this point in the history
  • Loading branch information
dunglas committed Jun 26, 2018
1 parent fd16d7d commit 3d02781
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/Symfony/Bridge/Doctrine/Validator/DoctrineLoader.php
Expand Up @@ -15,7 +15,6 @@
use Doctrine\ORM\Mapping\ClassMetadataFactory;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Mapping\MappingException as OrmMappingException;

use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Validator\Constraints\Length;
use Symfony\Component\Validator\Mapping\ClassMetadata;
Expand Down Expand Up @@ -70,7 +69,7 @@ public function loadClassMetadata(ClassMetadata $metadata): bool
foreach ($doctrineMetadata->fieldMappings as $mapping) {
// TODO: Currently, I don't add a constraint if one of the same type already exists, but it's maybe safer to add both (min/max)?
if (null !== $mapping['length'] && !$this->propertyHasConstraint($metadata, Length::class, $mapping['fieldName'])) {
$metadata->addPropertyConstraint($mapping['fieldName'], new Length(['max' => $mapping['length']]));
$metadata->addPropertyConstraint($mapping['fieldName'], new Length(array('max' => $mapping['length'])));
}

// TODO: handle autogenerated identifiers that definitely can be null
Expand Down
Expand Up @@ -70,7 +70,7 @@ public function loadClassMetadata(ClassMetadata $metadata)
}

if (!$this->propertyHasConstraint($metadata, Type::class, $property)) {
if (1 === \count($builtinTypes)) {
if (1 === \count($builtinTypes)) {
$metadata->addPropertyConstraint($property, new Type(array('type' => $builtinTypes[0])));
} elseif ($scalar) {
$metadata->addPropertyConstraint($property, new Type(array('type' => 'scalar')));
Expand Down

0 comments on commit 3d02781

Please sign in to comment.