@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Doctrine\ORM\Mapping; |
6 | 6 | |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $this->configuration = $configuration; |
69 | 69 | $this->connection = $connection; |
70 | 70 | $this->eventManager = $eventManager; |
71 | - $this->driver = $this->configuration->getMetadataDriverImpl(); |
|
71 | + $this->driver = $this->configuration->getMetadataDriverImpl(); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | /** |
@@ -133,12 +133,12 @@ discard block |
||
133 | 133 | $classMetadata->setCache(clone $parent->getCache()); |
134 | 134 | } |
135 | 135 | |
136 | - if (! empty($parent->entityListeners) && empty($classMetadata->entityListeners)) { |
|
136 | + if ( ! empty($parent->entityListeners) && empty($classMetadata->entityListeners)) { |
|
137 | 137 | $classMetadata->entityListeners = $parent->entityListeners; |
138 | 138 | } |
139 | 139 | } |
140 | 140 | |
141 | - if (! $classMetadata->discriminatorMap && $classMetadata->inheritanceType !== InheritanceType::NONE && $classMetadata->isRootEntity()) { |
|
141 | + if ( ! $classMetadata->discriminatorMap && $classMetadata->inheritanceType !== InheritanceType::NONE && $classMetadata->isRootEntity()) { |
|
142 | 142 | $this->addDefaultDiscriminatorMap($classMetadata); |
143 | 143 | } |
144 | 144 | |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | |
153 | 153 | protected function completeRuntimeMetadata(ClassMetadata $class, ?ClassMetadata $parent = null) : void |
154 | 154 | { |
155 | - if (! $parent || ! $parent->isMappedSuperclass) { |
|
155 | + if ( ! $parent || ! $parent->isMappedSuperclass) { |
|
156 | 156 | return; |
157 | 157 | } |
158 | 158 | |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | continue; |
171 | 171 | } |
172 | 172 | |
173 | - if (! ($property instanceof ToOneAssociationMetadata)) { |
|
173 | + if ( ! ($property instanceof ToOneAssociationMetadata)) { |
|
174 | 174 | continue; |
175 | 175 | } |
176 | 176 | |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | */ |
190 | 190 | protected function validateRuntimeMetadata(ClassMetadata $class, ?ClassMetadata $parent = null) : void |
191 | 191 | { |
192 | - if (! $class->getReflectionClass()) { |
|
192 | + if ( ! $class->getReflectionClass()) { |
|
193 | 193 | // only validate if there is a reflection class instance |
194 | 194 | return; |
195 | 195 | } |
@@ -199,13 +199,13 @@ discard block |
||
199 | 199 | $class->validateLifecycleCallbacks($this->getReflectionService()); |
200 | 200 | |
201 | 201 | // verify inheritance |
202 | - if (! $class->isMappedSuperclass && $class->inheritanceType !== InheritanceType::NONE) { |
|
203 | - if (! $parent) { |
|
204 | - if (! $class->discriminatorMap) { |
|
202 | + if ( ! $class->isMappedSuperclass && $class->inheritanceType !== InheritanceType::NONE) { |
|
203 | + if ( ! $parent) { |
|
204 | + if ( ! $class->discriminatorMap) { |
|
205 | 205 | throw MappingException::missingDiscriminatorMap($class->getClassName()); |
206 | 206 | } |
207 | 207 | |
208 | - if (! $class->discriminatorColumn) { |
|
208 | + if ( ! $class->discriminatorColumn) { |
|
209 | 209 | throw MappingException::missingDiscriminatorColumn($class->getClassName()); |
210 | 210 | } |
211 | 211 | } |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | private function completeIdentifierGeneratorMappings(ClassMetadata $class) : void |
327 | 327 | { |
328 | 328 | foreach ($class->getDeclaredPropertiesIterator() as $property) { |
329 | - if (! $property instanceof FieldMetadata /*&& ! $property instanceof AssocationMetadata*/) { |
|
329 | + if ( ! $property instanceof FieldMetadata /*&& ! $property instanceof AssocationMetadata*/) { |
|
330 | 330 | continue; |
331 | 331 | } |
332 | 332 | |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | |
337 | 337 | private function completeFieldIdentifierGeneratorMapping(FieldMetadata $field) |
338 | 338 | { |
339 | - if (! $field->hasValueGenerator()) { |
|
339 | + if ( ! $field->hasValueGenerator()) { |
|
340 | 340 | return; |
341 | 341 | } |
342 | 342 | |
@@ -388,10 +388,10 @@ discard block |
||
388 | 388 | |
389 | 389 | case GeneratorType::CUSTOM: |
390 | 390 | $definition = $generator->getDefinition(); |
391 | - if (! isset($definition['class'])) { |
|
391 | + if ( ! isset($definition['class'])) { |
|
392 | 392 | throw new ORMException(sprintf('Cannot instantiate custom generator, no class has been defined')); |
393 | 393 | } |
394 | - if (! class_exists($definition['class'])) { |
|
394 | + if ( ! class_exists($definition['class'])) { |
|
395 | 395 | throw new ORMException(sprintf('Cannot instantiate custom generator : %s', var_export($definition, true))); //$definition['class'])); |
396 | 396 | } |
397 | 397 | |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | break; |
404 | 404 | |
405 | 405 | default: |
406 | - throw new ORMException('Unknown generator type: ' . $generator->getType()); |
|
406 | + throw new ORMException('Unknown generator type: '.$generator->getType()); |
|
407 | 407 | } |
408 | 408 | } |
409 | 409 | |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | |
426 | 426 | private function getTargetPlatform() : Platforms\AbstractPlatform |
427 | 427 | { |
428 | - if (! $this->targetPlatform) { |
|
428 | + if ( ! $this->targetPlatform) { |
|
429 | 429 | $this->targetPlatform = $this->connection->getDatabasePlatform(); |
430 | 430 | } |
431 | 431 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Doctrine\ORM\Mapping; |
6 | 6 | |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | private function __construct(array $metadata) |
19 | 19 | { |
20 | 20 | $metadataByClassName = array_combine( |
21 | - array_map(function (ClassMetadata $metadata) { return $metadata->getClassName(); }, $metadata), |
|
21 | + array_map(function(ClassMetadata $metadata) { return $metadata->getClassName(); }, $metadata), |
|
22 | 22 | $metadata |
23 | 23 | ); |
24 | 24 | $this->metadata = $metadataByClassName; |
@@ -27,8 +27,8 @@ discard block |
||
27 | 27 | public function get($name) |
28 | 28 | { |
29 | 29 | $name = StaticClassNameConverter::getRealClass($name); |
30 | - if(!isset($this->metadata[$name])){ |
|
31 | - throw new \Exception('No metadata found for ' . $name); |
|
30 | + if ( ! isset($this->metadata[$name])) { |
|
31 | + throw new \Exception('No metadata found for '.$name); |
|
32 | 32 | } |
33 | 33 | return $this->metadata[$name]; |
34 | 34 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Doctrine\ORM\Mapping; |
6 | 6 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | |
159 | 159 | try { |
160 | 160 | if ($this->cacheDriver) { |
161 | - $cached = $this->cacheDriver->fetch($realClassName . $this->cacheSalt); |
|
161 | + $cached = $this->cacheDriver->fetch($realClassName.$this->cacheSalt); |
|
162 | 162 | |
163 | 163 | if ($cached instanceof ClassMetadata) { |
164 | 164 | $this->loadedMetadata[$realClassName] = $cached; |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | foreach ($this->loadMetadata($realClassName, $metadataBuildingContext) as $loadedClass) { |
169 | 169 | $loadedClassName = $loadedClass->getClassName(); |
170 | 170 | |
171 | - $this->cacheDriver->save($loadedClassName . $this->cacheSalt, $loadedClass, null); |
|
171 | + $this->cacheDriver->save($loadedClassName.$this->cacheSalt, $loadedClass, null); |
|
172 | 172 | } |
173 | 173 | } |
174 | 174 | } else { |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | } catch (CommonMappingException $loadingException) { |
178 | 178 | $fallbackMetadataResponse = $this->onNotFoundMetadata($realClassName, $metadataBuildingContext); |
179 | 179 | |
180 | - if (! $fallbackMetadataResponse) { |
|
180 | + if ( ! $fallbackMetadataResponse) { |
|
181 | 181 | throw $loadingException; |
182 | 182 | } |
183 | 183 | |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | $parentClasses = []; |
264 | 264 | |
265 | 265 | foreach (array_reverse($this->getReflectionService()->getParentClasses($name)) as $parentClass) { |
266 | - if (! $this->getDriver()->isTransient($parentClass)) { |
|
266 | + if ( ! $this->getDriver()->isTransient($parentClass)) { |
|
267 | 267 | $parentClasses[] = $parentClass; |
268 | 268 | } |
269 | 269 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Doctrine\ORM; |
6 | 6 | |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | $this->conn = $conn; |
141 | 141 | $this->config = $config; |
142 | 142 | $this->eventManager = $eventManager; |
143 | - $this->mappings = $metadataCollection; |
|
143 | + $this->mappings = $metadataCollection; |
|
144 | 144 | |
145 | 145 | $this->repositoryFactory = $config->getRepositoryFactory(); |
146 | 146 | $this->unitOfWork = new UnitOfWork($this); |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | { |
258 | 258 | $query = new Query($this); |
259 | 259 | |
260 | - if (! empty($dql)) { |
|
260 | + if ( ! empty($dql)) { |
|
261 | 261 | $query->setDQL($dql); |
262 | 262 | } |
263 | 263 | |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | $class = $this->mappings->get($entityName); |
348 | 348 | $className = $class->getClassName(); |
349 | 349 | |
350 | - if (! is_array($id)) { |
|
350 | + if ( ! is_array($id)) { |
|
351 | 351 | if ($class->isIdentifierComposite()) { |
352 | 352 | throw ORMInvalidArgumentException::invalidCompositeIdentifier(); |
353 | 353 | } |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | |
358 | 358 | foreach ($id as $i => $value) { |
359 | 359 | if (is_object($value)) { |
360 | - try{ |
|
360 | + try { |
|
361 | 361 | $this->mappings->get(StaticClassNameConverter::getClass($value)); |
362 | 362 | $id[$i] = $this->unitOfWork->getSingleIdentifierValue($value); |
363 | 363 | } catch (\Exception $e) { |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | $sortedId = []; |
374 | 374 | |
375 | 375 | foreach ($class->identifier as $identifier) { |
376 | - if (! isset($id[$identifier])) { |
|
376 | + if ( ! isset($id[$identifier])) { |
|
377 | 377 | throw ORMException::missingIdentifierField($className, $identifier); |
378 | 378 | } |
379 | 379 | |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | // Check identity map first |
391 | 391 | $entity = $unitOfWork->tryGetById($sortedId, $class->getRootClassName()); |
392 | 392 | if ($entity !== false) { |
393 | - if (! ($entity instanceof $className)) { |
|
393 | + if ( ! ($entity instanceof $className)) { |
|
394 | 394 | return null; |
395 | 395 | } |
396 | 396 | |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | |
415 | 415 | switch (true) { |
416 | 416 | case $lockMode === LockMode::OPTIMISTIC: |
417 | - if (! $class->isVersioned()) { |
|
417 | + if ( ! $class->isVersioned()) { |
|
418 | 418 | throw OptimisticLockException::notVersioned($className); |
419 | 419 | } |
420 | 420 | |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | |
427 | 427 | case $lockMode === LockMode::PESSIMISTIC_READ: |
428 | 428 | case $lockMode === LockMode::PESSIMISTIC_WRITE: |
429 | - if (! $this->getConnection()->isTransactionActive()) { |
|
429 | + if ( ! $this->getConnection()->isTransactionActive()) { |
|
430 | 430 | throw TransactionRequiredException::transactionRequired(); |
431 | 431 | } |
432 | 432 | |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | $class = $this->mappings->get($entityName); |
446 | 446 | $className = $class->getClassName(); |
447 | 447 | |
448 | - if (! is_array($id)) { |
|
448 | + if ( ! is_array($id)) { |
|
449 | 449 | if ($class->isIdentifierComposite()) { |
450 | 450 | throw ORMInvalidArgumentException::invalidCompositeIdentifier(); |
451 | 451 | } |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | $scalarId[$i] = $value; |
460 | 460 | |
461 | 461 | if (is_object($value)) { |
462 | - try{ |
|
462 | + try { |
|
463 | 463 | $this->mappings->get(StaticClassNameConverter::getClass($value)); |
464 | 464 | $scalarId[$i] = $this->unitOfWork->getSingleIdentifierValue($value); |
465 | 465 | } catch (\Exception $e) { |
@@ -475,7 +475,7 @@ discard block |
||
475 | 475 | $sortedId = []; |
476 | 476 | |
477 | 477 | foreach ($class->identifier as $identifier) { |
478 | - if (! isset($scalarId[$identifier])) { |
|
478 | + if ( ! isset($scalarId[$identifier])) { |
|
479 | 479 | throw ORMException::missingIdentifierField($className, $identifier); |
480 | 480 | } |
481 | 481 | |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | $class = $this->mappings->get($entityName); |
517 | 517 | $className = $class->getClassName(); |
518 | 518 | |
519 | - if (! is_array($id)) { |
|
519 | + if ( ! is_array($id)) { |
|
520 | 520 | if ($class->isIdentifierComposite()) { |
521 | 521 | throw ORMInvalidArgumentException::invalidCompositeIdentifier(); |
522 | 522 | } |
@@ -526,7 +526,7 @@ discard block |
||
526 | 526 | |
527 | 527 | foreach ($id as $i => $value) { |
528 | 528 | if (is_object($value)) { |
529 | - try{ |
|
529 | + try { |
|
530 | 530 | $this->mappings->get(StaticClassNameConverter::getClass($value)); |
531 | 531 | $id[$i] = $this->unitOfWork->getSingleIdentifierValue($value); |
532 | 532 | } catch (\Exception $e) { |
@@ -542,7 +542,7 @@ discard block |
||
542 | 542 | $sortedId = []; |
543 | 543 | |
544 | 544 | foreach ($class->identifier as $identifier) { |
545 | - if (! isset($id[$identifier])) { |
|
545 | + if ( ! isset($id[$identifier])) { |
|
546 | 546 | throw ORMException::missingIdentifierField($className, $identifier); |
547 | 547 | } |
548 | 548 | |
@@ -615,7 +615,7 @@ discard block |
||
615 | 615 | */ |
616 | 616 | public function persist($entity) |
617 | 617 | { |
618 | - if (! is_object($entity)) { |
|
618 | + if ( ! is_object($entity)) { |
|
619 | 619 | throw ORMInvalidArgumentException::invalidObject('EntityManager#persist()', $entity); |
620 | 620 | } |
621 | 621 | |
@@ -637,7 +637,7 @@ discard block |
||
637 | 637 | */ |
638 | 638 | public function remove($entity) |
639 | 639 | { |
640 | - if (! is_object($entity)) { |
|
640 | + if ( ! is_object($entity)) { |
|
641 | 641 | throw ORMInvalidArgumentException::invalidObject('EntityManager#remove()', $entity); |
642 | 642 | } |
643 | 643 | |
@@ -657,7 +657,7 @@ discard block |
||
657 | 657 | */ |
658 | 658 | public function refresh($entity) |
659 | 659 | { |
660 | - if (! is_object($entity)) { |
|
660 | + if ( ! is_object($entity)) { |
|
661 | 661 | throw ORMInvalidArgumentException::invalidObject('EntityManager#refresh()', $entity); |
662 | 662 | } |
663 | 663 | |
@@ -812,7 +812,7 @@ discard block |
||
812 | 812 | */ |
813 | 813 | public static function create($connection, Configuration $config, EventManager $eventManager) |
814 | 814 | { |
815 | - if (! $config->getMetadataDriverImpl()) { |
|
815 | + if ( ! $config->getMetadataDriverImpl()) { |
|
816 | 816 | throw ORMException::missingMappingDriverImpl(); |
817 | 817 | } |
818 | 818 | |
@@ -855,12 +855,12 @@ discard block |
||
855 | 855 | return DriverManager::getConnection($connection, $config, $eventManager ?: new EventManager()); |
856 | 856 | } |
857 | 857 | |
858 | - if (! $connection instanceof Connection) { |
|
858 | + if ( ! $connection instanceof Connection) { |
|
859 | 859 | throw new \InvalidArgumentException( |
860 | 860 | sprintf( |
861 | 861 | 'Invalid $connection argument of type %s given%s.', |
862 | 862 | is_object($connection) ? get_class($connection) : gettype($connection), |
863 | - is_object($connection) ? '' : ': "' . $connection . '"' |
|
863 | + is_object($connection) ? '' : ': "'.$connection.'"' |
|
864 | 864 | ) |
865 | 865 | ); |
866 | 866 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Doctrine\Tests; |
6 | 6 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | { |
67 | 67 | $reader = new Annotations\CachedReader(new Annotations\AnnotationReader(), new ArrayCache()); |
68 | 68 | |
69 | - Annotations\AnnotationRegistry::registerFile(__DIR__ . '/../../../lib/Doctrine/ORM/Annotation/DoctrineAnnotations.php'); |
|
69 | + Annotations\AnnotationRegistry::registerFile(__DIR__.'/../../../lib/Doctrine/ORM/Annotation/DoctrineAnnotations.php'); |
|
70 | 70 | |
71 | 71 | return new AnnotationDriver($reader, (array) $paths); |
72 | 72 | } |
@@ -105,10 +105,10 @@ discard block |
||
105 | 105 | $config->setAutoGenerateProxyClasses(ProxyFactory::AUTOGENERATE_EVAL); |
106 | 106 | $config->setMetadataDriverImpl( |
107 | 107 | $config->newDefaultAnnotationDriver([ |
108 | - realpath(__DIR__ . '/Models/Cache'), |
|
109 | - realpath(__DIR__ . '/Models/GeoNames'), |
|
110 | - realpath(__DIR__ . '/Models/CMS'), |
|
111 | - realpath(__DIR__ . '/Models/IdentityIsAssociation'), |
|
108 | + realpath(__DIR__.'/Models/Cache'), |
|
109 | + realpath(__DIR__.'/Models/GeoNames'), |
|
110 | + realpath(__DIR__.'/Models/CMS'), |
|
111 | + realpath(__DIR__.'/Models/IdentityIsAssociation'), |
|
112 | 112 | ]) |
113 | 113 | ); |
114 | 114 | |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | $eventManager = new EventManager(); |
142 | 142 | } |
143 | 143 | |
144 | - if (! ($metadatas instanceof MetadataCollection)){ |
|
144 | + if ( ! ($metadatas instanceof MetadataCollection)) { |
|
145 | 145 | $metadataFactory = new ClassMetadataFactory($config, $conn, $eventManager); |
146 | 146 | $metadatas = MetadataCollection::fromClassMetadatas(...$metadataFactory->getAllMetadata()); |
147 | 147 | } |