@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | { |
| 81 | 81 | if ($entityManager !== self::$entityManager) { |
| 82 | 82 | throw new RuntimeException( |
| 83 | - 'Trying to use PersistentObject with different EntityManager instances. ' . |
|
| 83 | + 'Trying to use PersistentObject with different EntityManager instances. '. |
|
| 84 | 84 | 'Was PersistentObject::setEntityManager() called?' |
| 85 | 85 | ); |
| 86 | 86 | } |
@@ -105,8 +105,8 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | $property = $this->cm->getProperty($field); |
| 107 | 107 | |
| 108 | - if (! $property) { |
|
| 109 | - throw new BadMethodCallException("no field with name '" . $field . "' exists on '" . $this->cm->getClassName() . "'"); |
|
| 108 | + if ( ! $property) { |
|
| 109 | + throw new BadMethodCallException("no field with name '".$field."' exists on '".$this->cm->getClassName()."'"); |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | switch (true) { |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | $targetClassName = $property->getTargetEntity(); |
| 119 | 119 | |
| 120 | 120 | if ($args[0] !== null && ! ($args[0] instanceof $targetClassName)) { |
| 121 | - throw new InvalidArgumentException("Expected persistent object of type '" . $targetClassName . "'"); |
|
| 121 | + throw new InvalidArgumentException("Expected persistent object of type '".$targetClassName."'"); |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | $this->{$field} = $args[0]; |
@@ -144,8 +144,8 @@ discard block |
||
| 144 | 144 | |
| 145 | 145 | $property = $this->cm->getProperty($field); |
| 146 | 146 | |
| 147 | - if (! $property) { |
|
| 148 | - throw new BadMethodCallException("no field with name '" . $field . "' exists on '" . $this->cm->getClassName() . "'"); |
|
| 147 | + if ( ! $property) { |
|
| 148 | + throw new BadMethodCallException("no field with name '".$field."' exists on '".$this->cm->getClassName()."'"); |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | return $this->{$field}; |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | $mappedByField = $property->getMappedBy(); |
| 168 | 168 | $targetMetadata = self::$entityManager->getClassMetadata($property->getTargetEntity()); |
| 169 | 169 | $targetProperty = $targetMetadata->getProperty($mappedByField); |
| 170 | - $setterMethodName = ($targetProperty instanceof ToManyAssociationMetadata ? 'add' : 'set') . $mappedByField; |
|
| 170 | + $setterMethodName = ($targetProperty instanceof ToManyAssociationMetadata ? 'add' : 'set').$mappedByField; |
|
| 171 | 171 | |
| 172 | 172 | $targetObject->{$setterMethodName}($this); |
| 173 | 173 | } |
@@ -189,21 +189,21 @@ discard block |
||
| 189 | 189 | |
| 190 | 190 | $property = $this->cm->getProperty($field); |
| 191 | 191 | |
| 192 | - if (! $property) { |
|
| 193 | - throw new BadMethodCallException("no field with name '" . $field . "' exists on '" . $this->cm->getClassName() . "'"); |
|
| 192 | + if ( ! $property) { |
|
| 193 | + throw new BadMethodCallException("no field with name '".$field."' exists on '".$this->cm->getClassName()."'"); |
|
| 194 | 194 | } |
| 195 | 195 | |
| 196 | - if (! ($property instanceof ToManyAssociationMetadata)) { |
|
| 197 | - throw new BadMethodCallException('There is no method add' . $field . '() on ' . $this->cm->getClassName()); |
|
| 196 | + if ( ! ($property instanceof ToManyAssociationMetadata)) { |
|
| 197 | + throw new BadMethodCallException('There is no method add'.$field.'() on '.$this->cm->getClassName()); |
|
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | $targetClassName = $property->getTargetEntity(); |
| 201 | 201 | |
| 202 | - if (! ($args[0] instanceof $targetClassName)) { |
|
| 203 | - throw new InvalidArgumentException("Expected persistent object of type '" . $targetClassName . "'"); |
|
| 202 | + if ( ! ($args[0] instanceof $targetClassName)) { |
|
| 203 | + throw new InvalidArgumentException("Expected persistent object of type '".$targetClassName."'"); |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | - if (! ($this->{$field} instanceof Collection)) { |
|
| 206 | + if ( ! ($this->{$field} instanceof Collection)) { |
|
| 207 | 207 | $this->{$field} = new ArrayCollection($this->{$field} ?: []); |
| 208 | 208 | } |
| 209 | 209 | |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | return; |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | - if (! self::$entityManager) { |
|
| 228 | + if ( ! self::$entityManager) { |
|
| 229 | 229 | throw new RuntimeException('No runtime entity manager set. Call PersistentObject#setEntityManager().'); |
| 230 | 230 | } |
| 231 | 231 | |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | return $this->add($field, $args); |
| 259 | 259 | |
| 260 | 260 | default: |
| 261 | - throw new BadMethodCallException('There is no method ' . $method . ' on ' . $this->cm->getClassName()); |
|
| 261 | + throw new BadMethodCallException('There is no method '.$method.' on '.$this->cm->getClassName()); |
|
| 262 | 262 | } |
| 263 | 263 | } |
| 264 | 264 | } |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | $expectedLockVersion = $expectedLockVersion instanceof DateTime ? $expectedLockVersion->getTimestamp() : $expectedLockVersion; |
| 60 | 60 | $actualLockVersion = $actualLockVersion instanceof DateTime ? $actualLockVersion->getTimestamp() : $actualLockVersion; |
| 61 | 61 | |
| 62 | - return new self('The optimistic lock failed, version ' . $expectedLockVersion . ' was expected, but is actually ' . $actualLockVersion, $entity); |
|
| 62 | + return new self('The optimistic lock failed, version '.$expectedLockVersion.' was expected, but is actually '.$actualLockVersion, $entity); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | /** |
@@ -69,6 +69,6 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | public static function notVersioned($entityName) |
| 71 | 71 | { |
| 72 | - return new self('Cannot obtain optimistic lock on unversioned entity ' . $entityName, null); |
|
| 72 | + return new self('Cannot obtain optimistic lock on unversioned entity '.$entityName, null); |
|
| 73 | 73 | } |
| 74 | 74 | } |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | */ |
| 162 | 162 | public function newDefaultAnnotationDriver(array $paths = []) : AnnotationDriver |
| 163 | 163 | { |
| 164 | - AnnotationRegistry::registerFile(__DIR__ . '/Annotation/DoctrineAnnotations.php'); |
|
| 164 | + AnnotationRegistry::registerFile(__DIR__.'/Annotation/DoctrineAnnotations.php'); |
|
| 165 | 165 | |
| 166 | 166 | $reader = new CachedReader(new AnnotationReader(), new ArrayCache()); |
| 167 | 167 | |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | { |
| 236 | 236 | $queryCacheImpl = $this->getQueryCacheImpl(); |
| 237 | 237 | |
| 238 | - if (! $queryCacheImpl) { |
|
| 238 | + if ( ! $queryCacheImpl) { |
|
| 239 | 239 | throw QueryCacheNotConfigured::create(); |
| 240 | 240 | } |
| 241 | 241 | |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | |
| 246 | 246 | $metadataCacheImpl = $this->getMetadataCacheImpl(); |
| 247 | 247 | |
| 248 | - if (! $metadataCacheImpl) { |
|
| 248 | + if ( ! $metadataCacheImpl) { |
|
| 249 | 249 | throw MetadataCacheNotConfigured::create(); |
| 250 | 250 | } |
| 251 | 251 | |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | { |
| 454 | 454 | $reflectionClass = new ReflectionClass($repositoryClassName); |
| 455 | 455 | |
| 456 | - if (! $reflectionClass->implementsInterface(ObjectRepository::class)) { |
|
| 456 | + if ( ! $reflectionClass->implementsInterface(ObjectRepository::class)) { |
|
| 457 | 457 | throw InvalidEntityRepository::fromClassName($repositoryClassName); |
| 458 | 458 | } |
| 459 | 459 | |
@@ -182,14 +182,14 @@ discard block |
||
| 182 | 182 | : new DefaultRegion($regionName, $cacheAdapter, $lifetime); |
| 183 | 183 | |
| 184 | 184 | if ($cache->getUsage() === CacheUsage::READ_WRITE) { |
| 185 | - if (! $this->fileLockRegionDirectory) { |
|
| 185 | + if ( ! $this->fileLockRegionDirectory) { |
|
| 186 | 186 | throw new LogicException( |
| 187 | - 'If you want to use a "READ_WRITE" cache an implementation of "Doctrine\ORM\Cache\ConcurrentRegion" is required, ' . |
|
| 187 | + 'If you want to use a "READ_WRITE" cache an implementation of "Doctrine\ORM\Cache\ConcurrentRegion" is required, '. |
|
| 188 | 188 | 'The default implementation provided by doctrine is "Doctrine\ORM\Cache\Region\FileLockRegion" if you want to use it please provide a valid directory, DefaultCacheFactory#setFileLockRegionDirectory(). ' |
| 189 | 189 | ); |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | - $directory = $this->fileLockRegionDirectory . DIRECTORY_SEPARATOR . $regionName; |
|
| 192 | + $directory = $this->fileLockRegionDirectory.DIRECTORY_SEPARATOR.$regionName; |
|
| 193 | 193 | $region = new FileLockRegion($region, $directory, $this->regionsConfig->getLockLifetime($regionName)); |
| 194 | 194 | } |
| 195 | 195 | |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | { |
| 206 | 206 | $cacheAdapter = clone $this->cache; |
| 207 | 207 | |
| 208 | - if (! $cacheAdapter instanceof CacheProvider) { |
|
| 208 | + if ( ! $cacheAdapter instanceof CacheProvider) { |
|
| 209 | 209 | return $cacheAdapter; |
| 210 | 210 | } |
| 211 | 211 | |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | $namespace .= ':'; |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | - $cacheAdapter->setNamespace($namespace . $name); |
|
| 218 | + $cacheAdapter->setNamespace($namespace.$name); |
|
| 219 | 219 | |
| 220 | 220 | return $cacheAdapter; |
| 221 | 221 | } |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | */ |
| 102 | 102 | protected function getCacheEntryKey(CacheKey $key) |
| 103 | 103 | { |
| 104 | - return $this->name . self::REGION_KEY_SEPARATOR . $key->hash; |
|
| 104 | + return $this->name.self::REGION_KEY_SEPARATOR.$key->hash; |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | /** |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | */ |
| 126 | 126 | public function evictAll() |
| 127 | 127 | { |
| 128 | - if (! $this->cache instanceof ClearableCache) { |
|
| 128 | + if ( ! $this->cache instanceof ClearableCache) { |
|
| 129 | 129 | throw new BadMethodCallException(sprintf( |
| 130 | 130 | 'Clearing all cache entries is not supported by the supplied cache adapter of type %s', |
| 131 | 131 | get_class($this->cache) |
@@ -52,11 +52,11 @@ discard block |
||
| 52 | 52 | */ |
| 53 | 53 | public function __construct(Region $region, $directory, $lockLifetime) |
| 54 | 54 | { |
| 55 | - if (! is_dir($directory) && ! @mkdir($directory, 0775, true)) { |
|
| 55 | + if ( ! is_dir($directory) && ! @mkdir($directory, 0775, true)) { |
|
| 56 | 56 | throw new InvalidArgumentException(sprintf('The directory "%s" does not exist and could not be created.', $directory)); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - if (! is_writable($directory)) { |
|
| 59 | + if ( ! is_writable($directory)) { |
|
| 60 | 60 | throw new InvalidArgumentException(sprintf('The directory "%s" is not writable.', $directory)); |
| 61 | 61 | } |
| 62 | 62 | |
@@ -72,14 +72,14 @@ discard block |
||
| 72 | 72 | { |
| 73 | 73 | $filename = $this->getLockFileName($key); |
| 74 | 74 | |
| 75 | - if (! is_file($filename)) { |
|
| 75 | + if ( ! is_file($filename)) { |
|
| 76 | 76 | return false; |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | $time = $this->getLockTime($filename); |
| 80 | 80 | $content = $this->getLockContent($filename); |
| 81 | 81 | |
| 82 | - if (! $content || ! $time) { |
|
| 82 | + if ( ! $content || ! $time) { |
|
| 83 | 83 | @unlink($filename); |
| 84 | 84 | |
| 85 | 85 | return false; |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | */ |
| 105 | 105 | private function getLockFileName(CacheKey $key) |
| 106 | 106 | { |
| 107 | - return $this->directory . DIRECTORY_SEPARATOR . $key->hash . '.' . self::LOCK_EXTENSION; |
|
| 107 | + return $this->directory.DIRECTORY_SEPARATOR.$key->hash.'.'.self::LOCK_EXTENSION; |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | /** |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | $lock = Lock::createLockRead(); |
| 226 | 226 | $filename = $this->getLockFileName($key); |
| 227 | 227 | |
| 228 | - if (! @file_put_contents($filename, $lock->value, LOCK_EX)) { |
|
| 228 | + if ( ! @file_put_contents($filename, $lock->value, LOCK_EX)) { |
|
| 229 | 229 | return null; |
| 230 | 230 | } |
| 231 | 231 | chmod($filename, 0664); |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | return false; |
| 243 | 243 | } |
| 244 | 244 | |
| 245 | - if (! @unlink($this->getLockFileName($key))) { |
|
| 245 | + if ( ! @unlink($this->getLockFileName($key))) { |
|
| 246 | 246 | return false; |
| 247 | 247 | } |
| 248 | 248 | |
@@ -62,17 +62,17 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | public function get(QueryCacheKey $key, ResultSetMapping $rsm, array $hints = []) |
| 64 | 64 | { |
| 65 | - if (! ($key->cacheMode & Cache::MODE_GET)) { |
|
| 65 | + if ( ! ($key->cacheMode & Cache::MODE_GET)) { |
|
| 66 | 66 | return null; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | $cacheEntry = $this->region->get($key); |
| 70 | 70 | |
| 71 | - if (! $cacheEntry instanceof QueryCacheEntry) { |
|
| 71 | + if ( ! $cacheEntry instanceof QueryCacheEntry) { |
|
| 72 | 72 | return null; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - if (! $this->validator->isValid($key, $cacheEntry)) { |
|
| 75 | + if ( ! $this->validator->isValid($key, $cacheEntry)) { |
|
| 76 | 76 | $this->region->evict($key); |
| 77 | 77 | |
| 78 | 78 | return null; |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | |
| 89 | 89 | $cm = $this->em->getClassMetadata($entityName); |
| 90 | 90 | |
| 91 | - $generateKeys = static function (array $entry) use ($cm) : EntityCacheKey { |
|
| 91 | + $generateKeys = static function(array $entry) use ($cm) : EntityCacheKey { |
|
| 92 | 92 | return new EntityCacheKey($cm->getRootClassName(), $entry['identifier']); |
| 93 | 93 | }; |
| 94 | 94 | |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | $this->cacheLogger->entityCacheHit($regionName, $cacheKeys->identifiers[$index]); |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - if (! $hasRelation) { |
|
| 114 | + if ( ! $hasRelation) { |
|
| 115 | 115 | $result[$index] = $unitOfWork->createEntity( |
| 116 | 116 | $entityEntry->class, |
| 117 | 117 | $entityEntry->resolveAssociationEntries($this->em), |
@@ -156,11 +156,11 @@ discard block |
||
| 156 | 156 | continue; |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | - if (! isset($assoc['list']) || empty($assoc['list'])) { |
|
| 159 | + if ( ! isset($assoc['list']) || empty($assoc['list'])) { |
|
| 160 | 160 | continue; |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | - $generateKeys = static function ($id) use ($assocMetadata) : EntityCacheKey { |
|
| 163 | + $generateKeys = static function($id) use ($assocMetadata) : EntityCacheKey { |
|
| 164 | 164 | return new EntityCacheKey($assocMetadata->getRootClassName(), $id); |
| 165 | 165 | }; |
| 166 | 166 | |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | throw FeatureNotImplemented::multipleRootEntities(); |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | - if (! $rsm->isSelect) { |
|
| 242 | + if ( ! $rsm->isSelect) { |
|
| 243 | 243 | throw FeatureNotImplemented::nonSelectStatements(); |
| 244 | 244 | } |
| 245 | 245 | |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | throw FeatureNotImplemented::partialEntities(); |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | - if (! ($key->cacheMode & Cache::MODE_PUT)) { |
|
| 250 | + if ( ! ($key->cacheMode & Cache::MODE_PUT)) { |
|
| 251 | 251 | return false; |
| 252 | 252 | } |
| 253 | 253 | |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | $unitOfWork = $this->em->getUnitOfWork(); |
| 258 | 258 | $persister = $unitOfWork->getEntityPersister($entityName); |
| 259 | 259 | |
| 260 | - if (! ($persister instanceof CachedPersister)) { |
|
| 260 | + if ( ! ($persister instanceof CachedPersister)) { |
|
| 261 | 261 | throw NonCacheableEntity::fromEntity($entityName); |
| 262 | 262 | } |
| 263 | 263 | |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | |
| 270 | 270 | if (($key->cacheMode & Cache::MODE_REFRESH) || ! $region->contains($entityKey)) { |
| 271 | 271 | // Cancel put result if entity put fail |
| 272 | - if (! $persister->storeEntityCache($entity, $entityKey)) { |
|
| 272 | + if ( ! $persister->storeEntityCache($entity, $entityKey)) { |
|
| 273 | 273 | return false; |
| 274 | 274 | } |
| 275 | 275 | } |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | // store single nested association |
| 306 | - if (! is_array($assocValue)) { |
|
| 306 | + if ( ! is_array($assocValue)) { |
|
| 307 | 307 | // Cancel put result if association put fail |
| 308 | 308 | if ($this->storeAssociationCache($key, $association, $assocValue) === null) { |
| 309 | 309 | return false; |
@@ -342,9 +342,9 @@ discard block |
||
| 342 | 342 | $assocIdentifier = $unitOfWork->getEntityIdentifier($assocValue); |
| 343 | 343 | $entityKey = new EntityCacheKey($assocMetadata->getRootClassName(), $assocIdentifier); |
| 344 | 344 | |
| 345 | - if ((! $assocValue instanceof GhostObjectInterface && ($key->cacheMode & Cache::MODE_REFRESH)) || ! $assocRegion->contains($entityKey)) { |
|
| 345 | + if (( ! $assocValue instanceof GhostObjectInterface && ($key->cacheMode & Cache::MODE_REFRESH)) || ! $assocRegion->contains($entityKey)) { |
|
| 346 | 346 | // Entity put fail |
| 347 | - if (! $assocPersister->storeEntityCache($assocValue, $entityKey)) { |
|
| 347 | + if ( ! $assocPersister->storeEntityCache($assocValue, $entityKey)) { |
|
| 348 | 348 | return null; |
| 349 | 349 | } |
| 350 | 350 | } |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | |
| 365 | 365 | if (($key->cacheMode & Cache::MODE_REFRESH) || ! $assocRegion->contains($entityKey)) { |
| 366 | 366 | // Entity put fail |
| 367 | - if (! $assocPersister->storeEntityCache($assocItem, $entityKey)) { |
|
| 367 | + if ( ! $assocPersister->storeEntityCache($assocItem, $entityKey)) { |
|
| 368 | 368 | return null; |
| 369 | 369 | } |
| 370 | 370 | } |
@@ -57,8 +57,8 @@ |
||
| 57 | 57 | */ |
| 58 | 58 | public function resolveAssociationEntries(EntityManagerInterface $em) |
| 59 | 59 | { |
| 60 | - return array_map(static function ($value) use ($em) { |
|
| 61 | - if (! ($value instanceof AssociationCacheEntry)) { |
|
| 60 | + return array_map(static function($value) use ($em) { |
|
| 61 | + if ( ! ($value instanceof AssociationCacheEntry)) { |
|
| 62 | 62 | return $value; |
| 63 | 63 | } |
| 64 | 64 | |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | */ |
| 42 | 42 | public function setMaxRunningTime($maxRunningTime) |
| 43 | 43 | { |
| 44 | - if (! (is_int($maxRunningTime) && $maxRunningTime >= 0)) { |
|
| 44 | + if ( ! (is_int($maxRunningTime) && $maxRunningTime >= 0)) { |
|
| 45 | 45 | throw new InvalidArgumentException(); |
| 46 | 46 | } |
| 47 | 47 | |