@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | $conn = static::$sharedConn; |
| 347 | 347 | |
| 348 | 348 | // In case test is skipped, tearDown is called, but no setup may have run |
| 349 | - if (! $conn) { |
|
| 349 | + if ( ! $conn) { |
|
| 350 | 350 | return; |
| 351 | 351 | } |
| 352 | 352 | |
@@ -420,7 +420,7 @@ discard block |
||
| 420 | 420 | } |
| 421 | 421 | |
| 422 | 422 | if (isset($this->usedModelSets['directorytree'])) { |
| 423 | - $conn->executeUpdate('DELETE FROM ' . $platform->quoteIdentifier('file')); |
|
| 423 | + $conn->executeUpdate('DELETE FROM '.$platform->quoteIdentifier('file')); |
|
| 424 | 424 | // MySQL doesn't know deferred deletions therefore only executing the second query gives errors. |
| 425 | 425 | $conn->executeUpdate('DELETE FROM Directory WHERE parentDirectory_id IS NOT NULL'); |
| 426 | 426 | $conn->executeUpdate('DELETE FROM Directory'); |
@@ -513,12 +513,12 @@ discard block |
||
| 513 | 513 | ) |
| 514 | 514 | ); |
| 515 | 515 | |
| 516 | - $conn->executeUpdate('DELETE FROM ' . $platform->quoteIdentifier('quote-users-groups')); |
|
| 517 | - $conn->executeUpdate('DELETE FROM ' . $platform->quoteIdentifier('quote-group')); |
|
| 518 | - $conn->executeUpdate('DELETE FROM ' . $platform->quoteIdentifier('quote-phone')); |
|
| 519 | - $conn->executeUpdate('DELETE FROM ' . $platform->quoteIdentifier('quote-user')); |
|
| 520 | - $conn->executeUpdate('DELETE FROM ' . $platform->quoteIdentifier('quote-address')); |
|
| 521 | - $conn->executeUpdate('DELETE FROM ' . $platform->quoteIdentifier('quote-city')); |
|
| 516 | + $conn->executeUpdate('DELETE FROM '.$platform->quoteIdentifier('quote-users-groups')); |
|
| 517 | + $conn->executeUpdate('DELETE FROM '.$platform->quoteIdentifier('quote-group')); |
|
| 518 | + $conn->executeUpdate('DELETE FROM '.$platform->quoteIdentifier('quote-phone')); |
|
| 519 | + $conn->executeUpdate('DELETE FROM '.$platform->quoteIdentifier('quote-user')); |
|
| 520 | + $conn->executeUpdate('DELETE FROM '.$platform->quoteIdentifier('quote-address')); |
|
| 521 | + $conn->executeUpdate('DELETE FROM '.$platform->quoteIdentifier('quote-city')); |
|
| 522 | 522 | } |
| 523 | 523 | |
| 524 | 524 | if (isset($this->usedModelSets['vct_onetoone'])) { |
@@ -630,7 +630,7 @@ discard block |
||
| 630 | 630 | $classes = []; |
| 631 | 631 | |
| 632 | 632 | foreach ($classNames as $className) { |
| 633 | - if (! isset(static::$entityTablesCreated[$className])) { |
|
| 633 | + if ( ! isset(static::$entityTablesCreated[$className])) { |
|
| 634 | 634 | static::$entityTablesCreated[$className] = true; |
| 635 | 635 | $classes[] = $this->em->getClassMetadata($className); |
| 636 | 636 | } |
@@ -649,25 +649,25 @@ discard block |
||
| 649 | 649 | { |
| 650 | 650 | $this->setUpDBALTypes(); |
| 651 | 651 | |
| 652 | - if (! isset(static::$sharedConn)) { |
|
| 652 | + if ( ! isset(static::$sharedConn)) { |
|
| 653 | 653 | static::$sharedConn = TestUtil::getConnection(); |
| 654 | 654 | } |
| 655 | 655 | |
| 656 | 656 | if (isset($GLOBALS['DOCTRINE_MARK_SQL_LOGS'])) { |
| 657 | 657 | if (in_array(static::$sharedConn->getDatabasePlatform()->getName(), ['mysql', 'postgresql'], true)) { |
| 658 | - static::$sharedConn->executeQuery('SELECT 1 /*' . static::class . '*/'); |
|
| 658 | + static::$sharedConn->executeQuery('SELECT 1 /*'.static::class.'*/'); |
|
| 659 | 659 | } elseif (static::$sharedConn->getDatabasePlatform()->getName() === 'oracle') { |
| 660 | - static::$sharedConn->executeQuery('SELECT 1 /*' . static::class . '*/ FROM dual'); |
|
| 660 | + static::$sharedConn->executeQuery('SELECT 1 /*'.static::class.'*/ FROM dual'); |
|
| 661 | 661 | } |
| 662 | 662 | } |
| 663 | 663 | |
| 664 | - if (! $this->em) { |
|
| 664 | + if ( ! $this->em) { |
|
| 665 | 665 | $this->em = $this->getEntityManager(); |
| 666 | 666 | $this->schemaTool = new SchemaTool($this->em); |
| 667 | 667 | } |
| 668 | 668 | |
| 669 | 669 | foreach ($this->usedModelSets as $setName => $bool) { |
| 670 | - if (! isset(static::$tablesCreated[$setName])) { |
|
| 670 | + if ( ! isset(static::$tablesCreated[$setName])) { |
|
| 671 | 671 | $this->setUpEntitySchema(static::$modelSets[$setName]); |
| 672 | 672 | |
| 673 | 673 | static::$tablesCreated[$setName] = true; |
@@ -742,8 +742,8 @@ discard block |
||
| 742 | 742 | |
| 743 | 743 | $config->setMetadataDriverImpl( |
| 744 | 744 | $mappingDriver ?? $config->newDefaultAnnotationDriver([ |
| 745 | - realpath(__DIR__ . '/Models/Cache'), |
|
| 746 | - realpath(__DIR__ . '/Models/GeoNames'), |
|
| 745 | + realpath(__DIR__.'/Models/Cache'), |
|
| 746 | + realpath(__DIR__.'/Models/GeoNames'), |
|
| 747 | 747 | ]) |
| 748 | 748 | ); |
| 749 | 749 | |
@@ -791,13 +791,13 @@ discard block |
||
| 791 | 791 | |
| 792 | 792 | foreach ($last25queries as $i => $query) { |
| 793 | 793 | $params = array_map( |
| 794 | - static function ($p) { |
|
| 794 | + static function($p) { |
|
| 795 | 795 | return is_object($p) ? get_class($p) : var_export($p, true); |
| 796 | 796 | }, |
| 797 | 797 | $query['params'] ?: [] |
| 798 | 798 | ); |
| 799 | 799 | |
| 800 | - $queries .= $i . ". SQL: '" . $query['sql'] . "' Params: " . implode(', ', $params) . PHP_EOL; |
|
| 800 | + $queries .= $i.". SQL: '".$query['sql']."' Params: ".implode(', ', $params).PHP_EOL; |
|
| 801 | 801 | } |
| 802 | 802 | |
| 803 | 803 | $trace = $e->getTrace(); |
@@ -810,11 +810,11 @@ discard block |
||
| 810 | 810 | break; |
| 811 | 811 | } |
| 812 | 812 | |
| 813 | - $traceMsg .= $part['file'] . ':' . $part['line'] . PHP_EOL; |
|
| 813 | + $traceMsg .= $part['file'].':'.$part['line'].PHP_EOL; |
|
| 814 | 814 | } |
| 815 | 815 | } |
| 816 | 816 | |
| 817 | - $message = '[' . get_class($e) . '] ' . $e->getMessage() . PHP_EOL . PHP_EOL . 'With queries:' . PHP_EOL . $queries . PHP_EOL . 'Trace:' . PHP_EOL . $traceMsg; |
|
| 817 | + $message = '['.get_class($e).'] '.$e->getMessage().PHP_EOL.PHP_EOL.'With queries:'.PHP_EOL.$queries.PHP_EOL.'Trace:'.PHP_EOL.$traceMsg; |
|
| 818 | 818 | |
| 819 | 819 | throw new Exception($message, (int) $e->getCode(), $e); |
| 820 | 820 | } |
@@ -33,13 +33,13 @@ |
||
| 33 | 33 | protected function configure() |
| 34 | 34 | { |
| 35 | 35 | $this->setName('orm:run-dql') |
| 36 | - ->setDescription('Executes arbitrary DQL directly from the command line') |
|
| 37 | - ->addArgument('dql', InputArgument::REQUIRED, 'The DQL to execute.') |
|
| 38 | - ->addOption('hydrate', null, InputOption::VALUE_REQUIRED, 'Hydration mode of result set. Should be either: object, array, scalar or single-scalar.', 'object') |
|
| 39 | - ->addOption('first-result', null, InputOption::VALUE_REQUIRED, 'The first result in the result set.') |
|
| 40 | - ->addOption('max-result', null, InputOption::VALUE_REQUIRED, 'The maximum number of results in the result set.') |
|
| 41 | - ->addOption('show-sql', null, InputOption::VALUE_NONE, 'Dump generated SQL instead of executing query') |
|
| 42 | - ->setHelp('Executes arbitrary DQL directly from the command line.'); |
|
| 36 | + ->setDescription('Executes arbitrary DQL directly from the command line') |
|
| 37 | + ->addArgument('dql', InputArgument::REQUIRED, 'The DQL to execute.') |
|
| 38 | + ->addOption('hydrate', null, InputOption::VALUE_REQUIRED, 'Hydration mode of result set. Should be either: object, array, scalar or single-scalar.', 'object') |
|
| 39 | + ->addOption('first-result', null, InputOption::VALUE_REQUIRED, 'The first result in the result set.') |
|
| 40 | + ->addOption('max-result', null, InputOption::VALUE_REQUIRED, 'The maximum number of results in the result set.') |
|
| 41 | + ->addOption('show-sql', null, InputOption::VALUE_NONE, 'Dump generated SQL instead of executing query') |
|
| 42 | + ->setHelp('Executes arbitrary DQL directly from the command line.'); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /** |
@@ -58,9 +58,9 @@ discard block |
||
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | $hydrationModeName = $input->getOption('hydrate'); |
| 61 | - $hydrationMode = 'Doctrine\ORM\Query::HYDRATE_' . strtoupper(str_replace('-', '_', $hydrationModeName)); |
|
| 61 | + $hydrationMode = 'Doctrine\ORM\Query::HYDRATE_'.strtoupper(str_replace('-', '_', $hydrationModeName)); |
|
| 62 | 62 | |
| 63 | - if (! defined($hydrationMode)) { |
|
| 63 | + if ( ! defined($hydrationMode)) { |
|
| 64 | 64 | throw new RuntimeException(sprintf( |
| 65 | 65 | "Hydration mode '%s' does not exist. It should be either: object. array, scalar or single-scalar.", |
| 66 | 66 | $hydrationModeName |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | $firstResult = $input->getOption('first-result'); |
| 72 | 72 | |
| 73 | 73 | if ($firstResult !== null) { |
| 74 | - if (! is_numeric($firstResult)) { |
|
| 74 | + if ( ! is_numeric($firstResult)) { |
|
| 75 | 75 | throw new LogicException("Option 'first-result' must contain an integer value"); |
| 76 | 76 | } |
| 77 | 77 | |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | $maxResult = $input->getOption('max-result'); |
| 82 | 82 | |
| 83 | 83 | if ($maxResult !== null) { |
| 84 | - if (! is_numeric($maxResult)) { |
|
| 84 | + if ( ! is_numeric($maxResult)) { |
|
| 85 | 85 | throw new LogicException("Option 'max-result' must contain an integer value"); |
| 86 | 86 | } |
| 87 | 87 | |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | |
| 96 | 96 | $resultSet = $query->execute([], constant($hydrationMode)); |
| 97 | 97 | |
| 98 | - $dumper = new CliDumper(static function (string $payload) use ($output) : void { |
|
| 98 | + $dumper = new CliDumper(static function(string $payload) use ($output) : void { |
|
| 99 | 99 | $output->write($payload); |
| 100 | 100 | }); |
| 101 | 101 | $dumper->dump((new VarCloner())->cloneVar($resultSet)); |
@@ -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 |
@@ -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); |