@@ -26,18 +26,18 @@ |
||
| 26 | 26 | |
| 27 | 27 | public static function pathRequired() : self |
| 28 | 28 | { |
| 29 | - return new self('Specifying the paths to your entities is required ' . |
|
| 29 | + return new self('Specifying the paths to your entities is required '. |
|
| 30 | 30 | 'in the AnnotationDriver to retrieve all class names.'); |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | public static function fileMappingDriversRequireConfiguredDirectoryPath(?string $path = null) : self |
| 34 | 34 | { |
| 35 | - if (! empty($path)) { |
|
| 36 | - $path = '[' . $path . ']'; |
|
| 35 | + if (!empty($path)) { |
|
| 36 | + $path = '['.$path.']'; |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | return new self(sprintf( |
| 40 | - 'File mapping drivers must have a valid directory path, ' . |
|
| 40 | + 'File mapping drivers must have a valid directory path, '. |
|
| 41 | 41 | 'however the given path %s seems to be incorrect!', |
| 42 | 42 | $path |
| 43 | 43 | )); |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | public function getAllMetadata() : array |
| 77 | 77 | { |
| 78 | - if (! $this->initialized) { |
|
| 78 | + if (!$this->initialized) { |
|
| 79 | 79 | $this->initialize(); |
| 80 | 80 | } |
| 81 | 81 | |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | |
| 154 | 154 | try { |
| 155 | 155 | if ($this->cacheDriver) { |
| 156 | - $cached = $this->cacheDriver->fetch($realClassName . $this->cacheSalt); |
|
| 156 | + $cached = $this->cacheDriver->fetch($realClassName.$this->cacheSalt); |
|
| 157 | 157 | if ($cached instanceof ClassMetadata) { |
| 158 | 158 | $this->loadedMetadata[$realClassName] = $cached; |
| 159 | 159 | |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | } else { |
| 162 | 162 | foreach ($this->loadMetadata($realClassName) as $loadedClassName) { |
| 163 | 163 | $this->cacheDriver->save( |
| 164 | - $loadedClassName . $this->cacheSalt, |
|
| 164 | + $loadedClassName.$this->cacheSalt, |
|
| 165 | 165 | $this->loadedMetadata[$loadedClassName], |
| 166 | 166 | 0 |
| 167 | 167 | ); |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | } catch (MappingException $loadingException) { |
| 174 | 174 | $fallbackMetadataResponse = $this->onNotFoundMetadata($realClassName); |
| 175 | 175 | |
| 176 | - if (! $fallbackMetadataResponse) { |
|
| 176 | + if (!$fallbackMetadataResponse) { |
|
| 177 | 177 | throw $loadingException; |
| 178 | 178 | } |
| 179 | 179 | |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | */ |
| 248 | 248 | protected function loadMetadata($name) |
| 249 | 249 | { |
| 250 | - if (! $this->initialized) { |
|
| 250 | + if (!$this->initialized) { |
|
| 251 | 251 | $this->initialize(); |
| 252 | 252 | } |
| 253 | 253 | |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | */ |
| 335 | 335 | public function isTransient(string $class) : bool |
| 336 | 336 | { |
| 337 | - if (! $this->initialized) { |
|
| 337 | + if (!$this->initialized) { |
|
| 338 | 338 | $this->initialize(); |
| 339 | 339 | } |
| 340 | 340 | |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | */ |
| 375 | 375 | private function getRealClass(string $class) : string |
| 376 | 376 | { |
| 377 | - $pos = strrpos($class, '\\' . Proxy::MARKER . '\\'); |
|
| 377 | + $pos = strrpos($class, '\\'.Proxy::MARKER.'\\'); |
|
| 378 | 378 | |
| 379 | 379 | if ($pos === false) { |
| 380 | 380 | return $class; |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | public function injectObjectManager(ObjectManager $objectManager, ClassMetadata $classMetadata) |
| 74 | 74 | { |
| 75 | 75 | if ($objectManager !== self::$objectManager) { |
| 76 | - throw new RuntimeException('Trying to use PersistentObject with different ObjectManager instances. ' . |
|
| 76 | + throw new RuntimeException('Trying to use PersistentObject with different ObjectManager instances. '. |
|
| 77 | 77 | 'Was PersistentObject::setObjectManager() called?'); |
| 78 | 78 | } |
| 79 | 79 | |
@@ -90,17 +90,17 @@ discard block |
||
| 90 | 90 | */ |
| 91 | 91 | private function set(string $field, $args) : void |
| 92 | 92 | { |
| 93 | - if ($this->cm->hasField($field) && ! $this->cm->isIdentifier($field)) { |
|
| 93 | + if ($this->cm->hasField($field) && !$this->cm->isIdentifier($field)) { |
|
| 94 | 94 | $this->$field = $args[0]; |
| 95 | 95 | } elseif ($this->cm->hasAssociation($field) && $this->cm->isSingleValuedAssociation($field)) { |
| 96 | 96 | $targetClass = $this->cm->getAssociationTargetClass($field); |
| 97 | - if (! ($args[0] instanceof $targetClass) && $args[0] !== null) { |
|
| 98 | - throw new InvalidArgumentException("Expected persistent object of type '" . $targetClass . "'"); |
|
| 97 | + if (!($args[0] instanceof $targetClass) && $args[0] !== null) { |
|
| 98 | + throw new InvalidArgumentException("Expected persistent object of type '".$targetClass."'"); |
|
| 99 | 99 | } |
| 100 | 100 | $this->$field = $args[0]; |
| 101 | 101 | $this->completeOwningSide($field, $targetClass, $args[0]); |
| 102 | 102 | } else { |
| 103 | - throw new BadMethodCallException("no field with name '" . $field . "' exists on '" . $this->cm->getName() . "'"); |
|
| 103 | + throw new BadMethodCallException("no field with name '".$field."' exists on '".$this->cm->getName()."'"); |
|
| 104 | 104 | } |
| 105 | 105 | } |
| 106 | 106 | |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | return $this->$field; |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - throw new BadMethodCallException("no field with name '" . $field . "' exists on '" . $this->cm->getName() . "'"); |
|
| 120 | + throw new BadMethodCallException("no field with name '".$field."' exists on '".$this->cm->getName()."'"); |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | /** |
@@ -130,14 +130,14 @@ discard block |
||
| 130 | 130 | ) : void { |
| 131 | 131 | // add this object on the owning side as well, for obvious infinite recursion |
| 132 | 132 | // reasons this is only done when called on the inverse side. |
| 133 | - if (! $this->cm->isAssociationInverseSide($field)) { |
|
| 133 | + if (!$this->cm->isAssociationInverseSide($field)) { |
|
| 134 | 134 | return; |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | $mappedByField = $this->cm->getAssociationMappedByTargetField($field); |
| 138 | 138 | $targetMetadata = self::$objectManager->getClassMetadata($targetClass); |
| 139 | 139 | |
| 140 | - $setter = ($targetMetadata->isCollectionValuedAssociation($mappedByField) ? 'add' : 'set') . $mappedByField; |
|
| 140 | + $setter = ($targetMetadata->isCollectionValuedAssociation($mappedByField) ? 'add' : 'set').$mappedByField; |
|
| 141 | 141 | $targetObject->$setter($this); |
| 142 | 142 | } |
| 143 | 143 | |
@@ -151,15 +151,15 @@ discard block |
||
| 151 | 151 | */ |
| 152 | 152 | private function add(string $field, $args) : void |
| 153 | 153 | { |
| 154 | - if (! $this->cm->hasAssociation($field) || ! $this->cm->isCollectionValuedAssociation($field)) { |
|
| 155 | - throw new BadMethodCallException('There is no method add' . $field . '() on ' . $this->cm->getName()); |
|
| 154 | + if (!$this->cm->hasAssociation($field) || !$this->cm->isCollectionValuedAssociation($field)) { |
|
| 155 | + throw new BadMethodCallException('There is no method add'.$field.'() on '.$this->cm->getName()); |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | $targetClass = $this->cm->getAssociationTargetClass($field); |
| 159 | - if (! ($args[0] instanceof $targetClass)) { |
|
| 160 | - throw new InvalidArgumentException("Expected persistent object of type '" . $targetClass . "'"); |
|
| 159 | + if (!($args[0] instanceof $targetClass)) { |
|
| 160 | + throw new InvalidArgumentException("Expected persistent object of type '".$targetClass."'"); |
|
| 161 | 161 | } |
| 162 | - if (! ($this->$field instanceof Collection)) { |
|
| 162 | + if (!($this->$field instanceof Collection)) { |
|
| 163 | 163 | $this->$field = new ArrayCollection($this->$field ?: []); |
| 164 | 164 | } |
| 165 | 165 | $this->$field->add($args[0]); |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | return; |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | - if (! self::$objectManager) { |
|
| 180 | + if (!self::$objectManager) { |
|
| 181 | 181 | throw new RuntimeException('No runtime object manager set. Call PersistentObject#setObjectManager().'); |
| 182 | 182 | } |
| 183 | 183 | |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | } elseif ($command === 'add') { |
| 207 | 207 | $this->add($field, $args); |
| 208 | 208 | } else { |
| 209 | - throw new BadMethodCallException('There is no method ' . $method . ' on ' . $this->cm->getName()); |
|
| 209 | + throw new BadMethodCallException('There is no method '.$method.' on '.$this->cm->getName()); |
|
| 210 | 210 | } |
| 211 | 211 | } |
| 212 | 212 | } |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | $name = $this->defaultConnection; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - if (! isset($this->connections[$name])) { |
|
| 91 | + if (!isset($this->connections[$name])) { |
|
| 92 | 92 | throw new InvalidArgumentException(sprintf('Doctrine %s Connection named "%s" does not exist.', $this->name, $name)); |
| 93 | 93 | } |
| 94 | 94 | |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | $name = $this->defaultManager; |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | - if (! isset($this->managers[$name])) { |
|
| 146 | + if (!isset($this->managers[$name])) { |
|
| 147 | 147 | throw new InvalidArgumentException(sprintf('Doctrine %s Manager named "%s" does not exist.', $this->name, $name)); |
| 148 | 148 | } |
| 149 | 149 | |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | // Check for namespace alias |
| 162 | 162 | if (strpos($class, ':') !== false) { |
| 163 | 163 | [$namespaceAlias, $simpleClassName] = explode(':', $class, 2); |
| 164 | - $class = $this->getAliasNamespace($namespaceAlias) . '\\' . $simpleClassName; |
|
| 164 | + $class = $this->getAliasNamespace($namespaceAlias).'\\'.$simpleClassName; |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | $proxyClass = new ReflectionClass($class); |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | if ($proxyClass->implementsInterface($this->proxyInterfaceName)) { |
| 170 | 170 | $parentClass = $proxyClass->getParentClass(); |
| 171 | 171 | |
| 172 | - if (! $parentClass) { |
|
| 172 | + if (!$parentClass) { |
|
| 173 | 173 | return null; |
| 174 | 174 | } |
| 175 | 175 | |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | /** @var ObjectManager $manager */ |
| 181 | 181 | $manager = $this->getService($id); |
| 182 | 182 | |
| 183 | - if (! $manager->getMetadataFactory()->isTransient($class)) { |
|
| 183 | + if (!$manager->getMetadataFactory()->isTransient($class)) { |
|
| 184 | 184 | return $manager; |
| 185 | 185 | } |
| 186 | 186 | } |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | $name = $this->defaultManager; |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | - if (! isset($this->managers[$name])) { |
|
| 232 | + if (!isset($this->managers[$name])) { |
|
| 233 | 233 | throw new InvalidArgumentException(sprintf('Doctrine %s Manager named "%s" does not exist.', $this->name, $name)); |
| 234 | 234 | } |
| 235 | 235 | |
@@ -89,7 +89,7 @@ |
||
| 89 | 89 | */ |
| 90 | 90 | private function assertValidField(string $field) : void |
| 91 | 91 | { |
| 92 | - if (! isset($this->entityChangeSet[$field])) { |
|
| 92 | + if (!isset($this->entityChangeSet[$field])) { |
|
| 93 | 93 | throw new InvalidArgumentException(sprintf( |
| 94 | 94 | 'Field "%s" is not a valid field of the entity "%s" in PreUpdateEventArgs.', |
| 95 | 95 | $field, |