@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | { |
87 | 87 | $cache = self::createCacheInstance($isDevMode, $cache); |
88 | 88 | |
89 | - if (! $cache instanceof CacheProvider) { |
|
89 | + if ( ! $cache instanceof CacheProvider) { |
|
90 | 90 | return $cache; |
91 | 91 | } |
92 | 92 | |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $namespace .= ':'; |
97 | 97 | } |
98 | 98 | |
99 | - $cache->setNamespace($namespace . 'dc2_' . md5($proxyDir) . '_'); // to avoid collisions |
|
99 | + $cache->setNamespace($namespace.'dc2_'.md5($proxyDir).'_'); // to avoid collisions |
|
100 | 100 | |
101 | 101 | return $cache; |
102 | 102 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | |
36 | 36 | public function tearDown() : void |
37 | 37 | { |
38 | - if (! $this->originalIncludePath) { |
|
38 | + if ( ! $this->originalIncludePath) { |
|
39 | 39 | return; |
40 | 40 | } |
41 | 41 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $config = Setup::createConfiguration(false, __DIR__); |
75 | 75 | $cache = $config->getMetadataCacheImpl(); |
76 | 76 | |
77 | - self::assertSame('dc2_' . md5(__DIR__) . '_', $cache->getNamespace()); |
|
77 | + self::assertSame('dc2_'.md5(__DIR__).'_', $cache->getNamespace()); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | $config = Setup::createConfiguration(false, __DIR__, new ArrayCache()); |
86 | 86 | $cache = $config->getMetadataCacheImpl(); |
87 | 87 | |
88 | - self::assertSame('dc2_' . md5(__DIR__) . '_', $cache->getNamespace()); |
|
88 | + self::assertSame('dc2_'.md5(__DIR__).'_', $cache->getNamespace()); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | /** |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | $cache = $config->getMetadataCacheImpl(); |
101 | 101 | |
102 | 102 | self::assertSame($originalCache, $cache); |
103 | - self::assertSame('foo:dc2_' . md5(__DIR__) . '_', $cache->getNamespace()); |
|
103 | + self::assertSame('foo:dc2_'.md5(__DIR__).'_', $cache->getNamespace()); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
@@ -57,8 +57,8 @@ |
||
57 | 57 | $this->parsedQueryWithDeclaredParameterType = $entityManager->createQuery($dql); |
58 | 58 | |
59 | 59 | foreach (range(1, 10) as $index) { |
60 | - $this->parsedQueryWithInferredParameterType->setParameter('parameter' . $index, new DateTime()); |
|
61 | - $this->parsedQueryWithDeclaredParameterType->setParameter('parameter' . $index, new DateTime(), DateTimeType::DATETIME); |
|
60 | + $this->parsedQueryWithInferredParameterType->setParameter('parameter'.$index, new DateTime()); |
|
61 | + $this->parsedQueryWithDeclaredParameterType->setParameter('parameter'.$index, new DateTime(), DateTimeType::DATETIME); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | // Force parsing upfront - we don't benchmark that bit in this scenario |
@@ -34,7 +34,7 @@ |
||
34 | 34 | */ |
35 | 35 | public function getDatabasePlatform() |
36 | 36 | { |
37 | - if (! $this->platformMock) { |
|
37 | + if ( ! $this->platformMock) { |
|
38 | 38 | $this->platformMock = new DatabasePlatformMock(); |
39 | 39 | } |
40 | 40 |
@@ -116,7 +116,7 @@ |
||
116 | 116 | public function quote($input, $type = null) |
117 | 117 | { |
118 | 118 | if (is_string($input)) { |
119 | - return "'" . $input . "'"; |
|
119 | + return "'".$input."'"; |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | return $input; |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | while ($worker->work()) { |
38 | 38 | if ($worker->returnCode() !== GEARMAN_SUCCESS) { |
39 | - echo 'return_code: ' . $worker->returnCode() . "\n"; |
|
39 | + echo 'return_code: '.$worker->returnCode()."\n"; |
|
40 | 40 | break; |
41 | 41 | } |
42 | 42 | } |
@@ -61,14 +61,14 @@ discard block |
||
61 | 61 | |
62 | 62 | public function findWithLock($job) |
63 | 63 | { |
64 | - return $this->process($job, static function ($fixture, $em) { |
|
64 | + return $this->process($job, static function($fixture, $em) { |
|
65 | 65 | $entity = $em->find($fixture['entityName'], $fixture['entityId'], $fixture['lockMode']); |
66 | 66 | }); |
67 | 67 | } |
68 | 68 | |
69 | 69 | public function dqlWithLock($job) |
70 | 70 | { |
71 | - return $this->process($job, static function ($fixture, $em) { |
|
71 | + return $this->process($job, static function($fixture, $em) { |
|
72 | 72 | /** @var Doctrine\ORM\Query $query */ |
73 | 73 | $query = $em->createQuery($fixture['dql']); |
74 | 74 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | |
81 | 81 | public function lock($job) |
82 | 82 | { |
83 | - return $this->process($job, static function ($fixture, $em) { |
|
83 | + return $this->process($job, static function($fixture, $em) { |
|
84 | 84 | $entity = $em->find($fixture['entityName'], $fixture['entityId']); |
85 | 85 | |
86 | 86 | $em->lock($entity, $fixture['lockMode']); |
@@ -89,18 +89,18 @@ discard block |
||
89 | 89 | |
90 | 90 | protected function processWorkload($job) |
91 | 91 | { |
92 | - echo 'Received job: ' . $job->handle() . ' for function ' . $job->functionName() . "\n"; |
|
92 | + echo 'Received job: '.$job->handle().' for function '.$job->functionName()."\n"; |
|
93 | 93 | |
94 | 94 | $workload = $job->workload(); |
95 | 95 | $workload = unserialize($workload); |
96 | 96 | |
97 | - if (! isset($workload['conn']) || ! is_array($workload['conn'])) { |
|
97 | + if ( ! isset($workload['conn']) || ! is_array($workload['conn'])) { |
|
98 | 98 | throw new InvalidArgumentException('Missing Database parameters'); |
99 | 99 | } |
100 | 100 | |
101 | 101 | $this->em = $this->createEntityManager($workload['conn']); |
102 | 102 | |
103 | - if (! isset($workload['fixture'])) { |
|
103 | + if ( ! isset($workload['fixture'])) { |
|
104 | 104 | throw new InvalidArgumentException('Missing Fixture parameters'); |
105 | 105 | } |
106 | 106 | |
@@ -110,11 +110,11 @@ discard block |
||
110 | 110 | protected function createEntityManager($conn) |
111 | 111 | { |
112 | 112 | $config = new Configuration(); |
113 | - $config->setProxyDir(__DIR__ . '/../../../Proxies'); |
|
113 | + $config->setProxyDir(__DIR__.'/../../../Proxies'); |
|
114 | 114 | $config->setProxyNamespace('MyProject\Proxies'); |
115 | 115 | $config->setAutoGenerateProxyClasses(true); |
116 | 116 | |
117 | - $annotDriver = $config->newDefaultAnnotationDriver([__DIR__ . '/../../../Models/']); |
|
117 | + $annotDriver = $config->newDefaultAnnotationDriver([__DIR__.'/../../../Models/']); |
|
118 | 118 | $config->setMetadataDriverImpl($annotDriver); |
119 | 119 | |
120 | 120 | $cache = new ArrayCache(); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | { |
80 | 80 | if ($entityManager !== self::$entityManager) { |
81 | 81 | throw new RuntimeException( |
82 | - 'Trying to use PersistentObject with different EntityManager instances. ' . |
|
82 | + 'Trying to use PersistentObject with different EntityManager instances. '. |
|
83 | 83 | 'Was PersistentObject::setEntityManager() called?' |
84 | 84 | ); |
85 | 85 | } |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | |
105 | 105 | $property = $this->cm->getProperty($field); |
106 | 106 | |
107 | - if (! $property) { |
|
108 | - throw new BadMethodCallException("no field with name '" . $field . "' exists on '" . $this->cm->getClassName() . "'"); |
|
107 | + if ( ! $property) { |
|
108 | + throw new BadMethodCallException("no field with name '".$field."' exists on '".$this->cm->getClassName()."'"); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | switch (true) { |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | $targetClassName = $property->getTargetEntity(); |
118 | 118 | |
119 | 119 | if ($args[0] !== null && ! ($args[0] instanceof $targetClassName)) { |
120 | - throw new InvalidArgumentException("Expected persistent object of type '" . $targetClassName . "'"); |
|
120 | + throw new InvalidArgumentException("Expected persistent object of type '".$targetClassName."'"); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | $this->{$field} = $args[0]; |
@@ -143,8 +143,8 @@ discard block |
||
143 | 143 | |
144 | 144 | $property = $this->cm->getProperty($field); |
145 | 145 | |
146 | - if (! $property) { |
|
147 | - throw new BadMethodCallException("no field with name '" . $field . "' exists on '" . $this->cm->getClassName() . "'"); |
|
146 | + if ( ! $property) { |
|
147 | + throw new BadMethodCallException("no field with name '".$field."' exists on '".$this->cm->getClassName()."'"); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | return $this->{$field}; |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | $mappedByField = $property->getMappedBy(); |
167 | 167 | $targetMetadata = self::$entityManager->getClassMetadata($property->getTargetEntity()); |
168 | 168 | $targetProperty = $targetMetadata->getProperty($mappedByField); |
169 | - $setterMethodName = ($targetProperty instanceof ToManyAssociationMetadata ? 'add' : 'set') . $mappedByField; |
|
169 | + $setterMethodName = ($targetProperty instanceof ToManyAssociationMetadata ? 'add' : 'set').$mappedByField; |
|
170 | 170 | |
171 | 171 | $targetObject->{$setterMethodName}($this); |
172 | 172 | } |
@@ -188,21 +188,21 @@ discard block |
||
188 | 188 | |
189 | 189 | $property = $this->cm->getProperty($field); |
190 | 190 | |
191 | - if (! $property) { |
|
192 | - throw new BadMethodCallException("no field with name '" . $field . "' exists on '" . $this->cm->getClassName() . "'"); |
|
191 | + if ( ! $property) { |
|
192 | + throw new BadMethodCallException("no field with name '".$field."' exists on '".$this->cm->getClassName()."'"); |
|
193 | 193 | } |
194 | 194 | |
195 | - if (! ($property instanceof ToManyAssociationMetadata)) { |
|
196 | - throw new BadMethodCallException('There is no method add' . $field . '() on ' . $this->cm->getClassName()); |
|
195 | + if ( ! ($property instanceof ToManyAssociationMetadata)) { |
|
196 | + throw new BadMethodCallException('There is no method add'.$field.'() on '.$this->cm->getClassName()); |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | $targetClassName = $property->getTargetEntity(); |
200 | 200 | |
201 | - if (! ($args[0] instanceof $targetClassName)) { |
|
202 | - throw new InvalidArgumentException("Expected persistent object of type '" . $targetClassName . "'"); |
|
201 | + if ( ! ($args[0] instanceof $targetClassName)) { |
|
202 | + throw new InvalidArgumentException("Expected persistent object of type '".$targetClassName."'"); |
|
203 | 203 | } |
204 | 204 | |
205 | - if (! ($this->{$field} instanceof Collection)) { |
|
205 | + if ( ! ($this->{$field} instanceof Collection)) { |
|
206 | 206 | $this->{$field} = new ArrayCollection($this->{$field} ?: []); |
207 | 207 | } |
208 | 208 | |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | return; |
225 | 225 | } |
226 | 226 | |
227 | - if (! self::$entityManager) { |
|
227 | + if ( ! self::$entityManager) { |
|
228 | 228 | throw new RuntimeException('No runtime entity manager set. Call PersistentObject#setEntityManager().'); |
229 | 229 | } |
230 | 230 | |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | case 'add': |
255 | 255 | return $this->add($field, $args); |
256 | 256 | default: |
257 | - throw new BadMethodCallException('There is no method ' . $method . ' on ' . $this->cm->getClassName()); |
|
257 | + throw new BadMethodCallException('There is no method '.$method.' on '.$this->cm->getClassName()); |
|
258 | 258 | } |
259 | 259 | } |
260 | 260 | } |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | // association (table). Without initializing the collection. |
332 | 332 | $removed = parent::remove($key); |
333 | 333 | |
334 | - if (! $removed) { |
|
334 | + if ( ! $removed) { |
|
335 | 335 | return $removed; |
336 | 336 | } |
337 | 337 | |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | */ |
353 | 353 | public function removeElement($element) |
354 | 354 | { |
355 | - if (! $this->initialized && |
|
355 | + if ( ! $this->initialized && |
|
356 | 356 | $this->association !== null && |
357 | 357 | $this->association->getFetchMode() === FetchMode::EXTRA_LAZY) { |
358 | 358 | if ($this->collection->contains($element)) { |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | |
367 | 367 | $removed = parent::removeElement($element); |
368 | 368 | |
369 | - if (! $removed) { |
|
369 | + if ( ! $removed) { |
|
370 | 370 | return $removed; |
371 | 371 | } |
372 | 372 | |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | */ |
388 | 388 | public function containsKey($key) |
389 | 389 | { |
390 | - if (! $this->initialized && |
|
390 | + if ( ! $this->initialized && |
|
391 | 391 | $this->association !== null && |
392 | 392 | $this->association->getFetchMode() === FetchMode::EXTRA_LAZY && |
393 | 393 | $this->association->getIndexedBy()) { |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | */ |
405 | 405 | public function contains($element) |
406 | 406 | { |
407 | - if (! $this->initialized && |
|
407 | + if ( ! $this->initialized && |
|
408 | 408 | $this->association !== null && |
409 | 409 | $this->association->getFetchMode() === FetchMode::EXTRA_LAZY) { |
410 | 410 | $persister = $this->em->getUnitOfWork()->getCollectionPersister($this->association); |
@@ -420,11 +420,11 @@ discard block |
||
420 | 420 | */ |
421 | 421 | public function get($key) |
422 | 422 | { |
423 | - if (! $this->initialized && |
|
423 | + if ( ! $this->initialized && |
|
424 | 424 | $this->association !== null && |
425 | 425 | $this->association->getFetchMode() === FetchMode::EXTRA_LAZY && |
426 | 426 | $this->association->getIndexedBy()) { |
427 | - if (! $this->typeClass->isIdentifierComposite() && $this->typeClass->isIdentifier($this->association->getIndexedBy())) { |
|
427 | + if ( ! $this->typeClass->isIdentifierComposite() && $this->typeClass->isIdentifier($this->association->getIndexedBy())) { |
|
428 | 428 | return $this->em->find($this->typeClass->getClassName(), $key); |
429 | 429 | } |
430 | 430 | |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | */ |
440 | 440 | public function count() |
441 | 441 | { |
442 | - if (! $this->initialized && |
|
442 | + if ( ! $this->initialized && |
|
443 | 443 | $this->association !== null && |
444 | 444 | $this->association->getFetchMode() === FetchMode::EXTRA_LAZY) { |
445 | 445 | $persister = $this->em->getUnitOfWork()->getCollectionPersister($this->association); |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | */ |
504 | 504 | public function offsetSet($offset, $value) |
505 | 505 | { |
506 | - if (! isset($offset)) { |
|
506 | + if ( ! isset($offset)) { |
|
507 | 507 | $this->add($value); |
508 | 508 | |
509 | 509 | return; |
@@ -598,7 +598,7 @@ discard block |
||
598 | 598 | */ |
599 | 599 | public function slice($offset, $length = null) |
600 | 600 | { |
601 | - if (! $this->initialized && |
|
601 | + if ( ! $this->initialized && |
|
602 | 602 | ! $this->isDirty && |
603 | 603 | $this->association !== null && |
604 | 604 | $this->association->getFetchMode() === FetchMode::EXTRA_LAZY) { |
@@ -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); |