Completed
Pull Request — master (#6412)
by Jarek
13:32 queued 03:48
created
lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
     public function getSingleIdReflectionProperty()
697 697
     {
698 698
         if ($this->isIdentifierComposite) {
699
-            throw new BadMethodCallException("Class " . $this->name . " has a composite identifier.");
699
+            throw new BadMethodCallException("Class ".$this->name." has a composite identifier.");
700 700
         }
701 701
 
702 702
         return $this->reflFields[$this->identifier[0]];
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
      */
792 792
     public function __toString()
793 793
     {
794
-        return __CLASS__ . '@' . spl_object_hash($this);
794
+        return __CLASS__.'@'.spl_object_hash($this);
795 795
     }
796 796
 
797 797
     /**
@@ -1025,7 +1025,7 @@  discard block
 block discarded – undo
1025 1025
     public function validateAssociations()
1026 1026
     {
1027 1027
         foreach ($this->associationMappings as $mapping) {
1028
-            if ( ! ClassLoader::classExists($mapping['targetEntity']) ) {
1028
+            if ( ! ClassLoader::classExists($mapping['targetEntity'])) {
1029 1029
                 throw MappingException::invalidTargetEntityClass($mapping['targetEntity'], $this->name, $mapping['fieldName']);
1030 1030
             }
1031 1031
         }
@@ -1103,7 +1103,7 @@  discard block
 block discarded – undo
1103 1103
         }
1104 1104
 
1105 1105
         if ( ! isset($cache['region'])) {
1106
-            $cache['region'] = strtolower(str_replace('\\', '_', $this->rootEntityName)) . '__' . $fieldName;
1106
+            $cache['region'] = strtolower(str_replace('\\', '_', $this->rootEntityName)).'__'.$fieldName;
1107 1107
         }
1108 1108
 
1109 1109
         return $cache;
@@ -1383,7 +1383,7 @@  discard block
 block discarded – undo
1383 1383
     protected function _validateAndCompleteFieldMapping(array &$mapping)
1384 1384
     {
1385 1385
         // Check mandatory fields
1386
-        if ( ! isset($mapping['fieldName']) || !$mapping['fieldName']) {
1386
+        if ( ! isset($mapping['fieldName']) || ! $mapping['fieldName']) {
1387 1387
             throw MappingException::missingFieldName($this->name);
1388 1388
         }
1389 1389
 
@@ -1496,14 +1496,14 @@  discard block
 block discarded – undo
1496 1496
                 $this->isIdentifierComposite = true;
1497 1497
             }
1498 1498
 
1499
-            if ($this->cache && !isset($mapping['cache'])) {
1499
+            if ($this->cache && ! isset($mapping['cache'])) {
1500 1500
                 throw CacheException::nonCacheableEntityAssociation($this->name, $mapping['fieldName']);
1501 1501
             }
1502 1502
         }
1503 1503
 
1504 1504
         // Mandatory attributes for both sides
1505 1505
         // Mandatory: fieldName, targetEntity
1506
-        if ( ! isset($mapping['fieldName']) || !$mapping['fieldName']) {
1506
+        if ( ! isset($mapping['fieldName']) || ! $mapping['fieldName']) {
1507 1507
             throw MappingException::missingFieldName($this->name);
1508 1508
         }
1509 1509
 
@@ -1627,7 +1627,7 @@  discard block
 block discarded – undo
1627 1627
                     throw new RuntimeException("ClassMetadataInfo::setTable() has to be called before defining a one to one relationship.");
1628 1628
                 }
1629 1629
 
1630
-                $this->table['uniqueConstraints'][$mapping['fieldName'] . "_uniq"] = [
1630
+                $this->table['uniqueConstraints'][$mapping['fieldName']."_uniq"] = [
1631 1631
                     'columns' => $uniqueConstraintColumns
1632 1632
                 ];
1633 1633
             }
@@ -1642,7 +1642,7 @@  discard block
 block discarded – undo
1642 1642
             unset($mapping['unique']);
1643 1643
         }
1644 1644
 
1645
-        if (isset($mapping['id']) && $mapping['id'] === true && !$mapping['isOwningSide']) {
1645
+        if (isset($mapping['id']) && $mapping['id'] === true && ! $mapping['isOwningSide']) {
1646 1646
             throw MappingException::illegalInverseIdentifierAssociation($this->name, $mapping['fieldName']);
1647 1647
         }
1648 1648
 
@@ -1696,7 +1696,7 @@  discard block
 block discarded – undo
1696 1696
             }
1697 1697
 
1698 1698
             $selfReferencingEntityWithoutJoinColumns = $mapping['sourceEntity'] == $mapping['targetEntity']
1699
-                && (! (isset($mapping['joinTable']['joinColumns']) || isset($mapping['joinTable']['inverseJoinColumns'])));
1699
+                && ( ! (isset($mapping['joinTable']['joinColumns']) || isset($mapping['joinTable']['inverseJoinColumns'])));
1700 1700
 
1701 1701
             if ( ! isset($mapping['joinTable']['joinColumns'])) {
1702 1702
                 $mapping['joinTable']['joinColumns'] = [
@@ -1804,7 +1804,7 @@  discard block
 block discarded – undo
1804 1804
             throw MappingException::singleIdNotAllowedOnCompositePrimaryKey($this->name);
1805 1805
         }
1806 1806
         
1807
-        if (!isset($this->identifier[0])) {
1807
+        if ( ! isset($this->identifier[0])) {
1808 1808
             throw new \Exception('No ID defined: '.$this->name);
1809 1809
         }
1810 1810
 
@@ -1889,7 +1889,7 @@  discard block
 block discarded – undo
1889 1889
 
1890 1890
             // Association defined as Id field
1891 1891
             $joinColumns      = $this->associationMappings[$idProperty]['joinColumns'];
1892
-            $assocColumnNames = array_map(function ($joinColumn) { return $joinColumn['name']; }, $joinColumns);
1892
+            $assocColumnNames = array_map(function($joinColumn) { return $joinColumn['name']; }, $joinColumns);
1893 1893
 
1894 1894
             $columnNames = array_merge($columnNames, $assocColumnNames);
1895 1895
         }
@@ -2070,7 +2070,7 @@  discard block
 block discarded – undo
2070 2070
     public function getTemporaryIdTableName()
2071 2071
     {
2072 2072
         // replace dots with underscores because PostgreSQL creates temporary tables in a special schema
2073
-        return str_replace('.', '_', $this->getTableName() . '_id_tmp');
2073
+        return str_replace('.', '_', $this->getTableName().'_id_tmp');
2074 2074
     }
2075 2075
 
2076 2076
     /**
@@ -2399,7 +2399,7 @@  discard block
 block discarded – undo
2399 2399
      */
2400 2400
     public function addNamedQuery(array $queryMapping)
2401 2401
     {
2402
-        if (!isset($queryMapping['name'])) {
2402
+        if ( ! isset($queryMapping['name'])) {
2403 2403
             throw MappingException::nameIsMandatoryForQueryMapping($this->name);
2404 2404
         }
2405 2405
 
@@ -2407,7 +2407,7 @@  discard block
 block discarded – undo
2407 2407
             throw MappingException::duplicateQueryMapping($this->name, $queryMapping['name']);
2408 2408
         }
2409 2409
 
2410
-        if (!isset($queryMapping['query'])) {
2410
+        if ( ! isset($queryMapping['query'])) {
2411 2411
             throw MappingException::emptyQueryMapping($this->name, $queryMapping['name']);
2412 2412
         }
2413 2413
 
@@ -2434,7 +2434,7 @@  discard block
 block discarded – undo
2434 2434
      */
2435 2435
     public function addNamedNativeQuery(array $queryMapping)
2436 2436
     {
2437
-        if (!isset($queryMapping['name'])) {
2437
+        if ( ! isset($queryMapping['name'])) {
2438 2438
             throw MappingException::nameIsMandatoryForQueryMapping($this->name);
2439 2439
         }
2440 2440
 
@@ -2442,11 +2442,11 @@  discard block
 block discarded – undo
2442 2442
             throw MappingException::duplicateQueryMapping($this->name, $queryMapping['name']);
2443 2443
         }
2444 2444
 
2445
-        if (!isset($queryMapping['query'])) {
2445
+        if ( ! isset($queryMapping['query'])) {
2446 2446
             throw MappingException::emptyQueryMapping($this->name, $queryMapping['name']);
2447 2447
         }
2448 2448
 
2449
-        if (!isset($queryMapping['resultClass']) && !isset($queryMapping['resultSetMapping'])) {
2449
+        if ( ! isset($queryMapping['resultClass']) && ! isset($queryMapping['resultSetMapping'])) {
2450 2450
             throw MappingException::missingQueryMapping($this->name, $queryMapping['name']);
2451 2451
         }
2452 2452
 
@@ -2478,7 +2478,7 @@  discard block
 block discarded – undo
2478 2478
      */
2479 2479
     public function addSqlResultSetMapping(array $resultMapping)
2480 2480
     {
2481
-        if (!isset($resultMapping['name'])) {
2481
+        if ( ! isset($resultMapping['name'])) {
2482 2482
             throw MappingException::nameIsMandatoryForSqlResultSetMapping($this->name);
2483 2483
         }
2484 2484
 
@@ -2488,7 +2488,7 @@  discard block
 block discarded – undo
2488 2488
 
2489 2489
         if (isset($resultMapping['entities'])) {
2490 2490
             foreach ($resultMapping['entities'] as $key => $entityResult) {
2491
-                if (!isset($entityResult['entityClass'])) {
2491
+                if ( ! isset($entityResult['entityClass'])) {
2492 2492
                     throw MappingException::missingResultSetMappingEntity($this->name, $resultMapping['name']);
2493 2493
                 }
2494 2494
 
@@ -2507,11 +2507,11 @@  discard block
 block discarded – undo
2507 2507
 
2508 2508
                 if (isset($entityResult['fields'])) {
2509 2509
                     foreach ($entityResult['fields'] as $k => $field) {
2510
-                        if (!isset($field['name'])) {
2510
+                        if ( ! isset($field['name'])) {
2511 2511
                             throw MappingException::missingResultSetMappingFieldName($this->name, $resultMapping['name']);
2512 2512
                         }
2513 2513
 
2514
-                        if (!isset($field['column'])) {
2514
+                        if ( ! isset($field['column'])) {
2515 2515
                             $fieldName = $field['name'];
2516 2516
                             if (strpos($fieldName, '.')) {
2517 2517
                                 list(, $fieldName) = explode('.', $fieldName);
@@ -3002,7 +3002,7 @@  discard block
 block discarded – undo
3002 3002
         }
3003 3003
 
3004 3004
         if ($definition['sequenceName'][0] == '`') {
3005
-            $definition['sequenceName']   = trim($definition['sequenceName'], '`');
3005
+            $definition['sequenceName'] = trim($definition['sequenceName'], '`');
3006 3006
             $definition['quoted'] = true;
3007 3007
         }
3008 3008
 
@@ -3094,7 +3094,7 @@  discard block
 block discarded – undo
3094 3094
     public function getAssociationTargetClass($assocName)
3095 3095
     {
3096 3096
         if ( ! isset($this->associationMappings[$assocName])) {
3097
-            throw new InvalidArgumentException("Association name expected, '" . $assocName ."' is not an association.");
3097
+            throw new InvalidArgumentException("Association name expected, '".$assocName."' is not an association.");
3098 3098
         }
3099 3099
 
3100 3100
         return $this->associationMappings[$assocName]['targetEntity'];
@@ -3133,7 +3133,7 @@  discard block
 block discarded – undo
3133 3133
             // Association defined as Id field
3134 3134
             $joinColumns            = $this->associationMappings[$idProperty]['joinColumns'];
3135 3135
             $assocQuotedColumnNames = array_map(
3136
-                function ($joinColumn) use ($platform) {
3136
+                function($joinColumn) use ($platform) {
3137 3137
                     return isset($joinColumn['quoted'])
3138 3138
                         ? $platform->quoteIdentifier($joinColumn['name'])
3139 3139
                         : $joinColumn['name'];
@@ -3244,7 +3244,7 @@  discard block
 block discarded – undo
3244 3244
         }
3245 3245
 
3246 3246
         if ($className !== null && strpos($className, '\\') === false && $this->namespace) {
3247
-            return $this->namespace . '\\' . $className;
3247
+            return $this->namespace.'\\'.$className;
3248 3248
         }
3249 3249
 
3250 3250
         return $className;
@@ -3298,15 +3298,15 @@  discard block
 block discarded – undo
3298 3298
                 ? $fieldMapping['originalClass']
3299 3299
                 : $embeddable->name;
3300 3300
             $fieldMapping['declaredField'] = isset($fieldMapping['declaredField'])
3301
-                ? $property . '.' . $fieldMapping['declaredField']
3301
+                ? $property.'.'.$fieldMapping['declaredField']
3302 3302
                 : $property;
3303 3303
             $fieldMapping['originalField'] = isset($fieldMapping['originalField'])
3304 3304
                 ? $fieldMapping['originalField']
3305 3305
                 : $fieldMapping['fieldName'];
3306
-            $fieldMapping['fieldName'] = $property . "." . $fieldMapping['fieldName'];
3306
+            $fieldMapping['fieldName'] = $property.".".$fieldMapping['fieldName'];
3307 3307
 
3308
-            if (! empty($this->embeddedClasses[$property]['columnPrefix'])) {
3309
-                $fieldMapping['columnName'] = $this->embeddedClasses[$property]['columnPrefix'] . $fieldMapping['columnName'];
3308
+            if ( ! empty($this->embeddedClasses[$property]['columnPrefix'])) {
3309
+                $fieldMapping['columnName'] = $this->embeddedClasses[$property]['columnPrefix'].$fieldMapping['columnName'];
3310 3310
             } elseif ($this->embeddedClasses[$property]['columnPrefix'] !== false) {
3311 3311
                 $fieldMapping['columnName'] = $this->namingStrategy
3312 3312
                     ->embeddedFieldToColumnName(
@@ -3347,7 +3347,7 @@  discard block
 block discarded – undo
3347 3347
     {
3348 3348
         $sequencePrefix = $this->getSequencePrefix($platform);
3349 3349
         $columnName     = $this->getSingleIdentifierColumnName();
3350
-        $sequenceName   = $sequencePrefix . '_' . $columnName . '_seq';
3350
+        $sequenceName   = $sequencePrefix.'_'.$columnName.'_seq';
3351 3351
 
3352 3352
         return $sequenceName;
3353 3353
     }
@@ -3367,10 +3367,10 @@  discard block
 block discarded – undo
3367 3367
 
3368 3368
         // Prepend the schema name to the table name if there is one
3369 3369
         if ($schemaName = $this->getSchemaName()) {
3370
-            $sequencePrefix = $schemaName . '.' . $tableName;
3370
+            $sequencePrefix = $schemaName.'.'.$tableName;
3371 3371
 
3372 3372
             if ( ! $platform->supportsSchemas() && $platform->canEmulateSchemas()) {
3373
-                $sequencePrefix = $schemaName . '__' . $tableName;
3373
+                $sequencePrefix = $schemaName.'__'.$tableName;
3374 3374
             }
3375 3375
         }
3376 3376
 
@@ -3382,8 +3382,8 @@  discard block
 block discarded – undo
3382 3382
      */
3383 3383
     private function assertMappingOrderBy(array $mapping)
3384 3384
     {
3385
-        if (isset($mapping['orderBy']) && !is_array($mapping['orderBy'])) {
3386
-            throw new InvalidArgumentException("'orderBy' is expected to be an array, not " . gettype($mapping['orderBy']));
3385
+        if (isset($mapping['orderBy']) && ! is_array($mapping['orderBy'])) {
3386
+            throw new InvalidArgumentException("'orderBy' is expected to be an array, not ".gettype($mapping['orderBy']));
3387 3387
         }
3388 3388
     }
3389 3389
 }
Please login to merge, or discard this patch.