Completed
Pull Request — master (#6208)
by Pierre
10:51
created
lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php 1 patch
Spacing   +34 added lines, -34 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'][$this->table['name'] . '_' . $mapping['fieldName'] . "_uniq"] = [
1630
+                $this->table['uniqueConstraints'][$this->table['name'].'_'.$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'] = [
@@ -1885,7 +1885,7 @@  discard block
 block discarded – undo
1885 1885
 
1886 1886
             // Association defined as Id field
1887 1887
             $joinColumns      = $this->associationMappings[$idProperty]['joinColumns'];
1888
-            $assocColumnNames = array_map(function ($joinColumn) { return $joinColumn['name']; }, $joinColumns);
1888
+            $assocColumnNames = array_map(function($joinColumn) { return $joinColumn['name']; }, $joinColumns);
1889 1889
 
1890 1890
             $columnNames = array_merge($columnNames, $assocColumnNames);
1891 1891
         }
@@ -2066,7 +2066,7 @@  discard block
 block discarded – undo
2066 2066
     public function getTemporaryIdTableName()
2067 2067
     {
2068 2068
         // replace dots with underscores because PostgreSQL creates temporary tables in a special schema
2069
-        return str_replace('.', '_', $this->getTableName() . '_id_tmp');
2069
+        return str_replace('.', '_', $this->getTableName().'_id_tmp');
2070 2070
     }
2071 2071
 
2072 2072
     /**
@@ -2395,7 +2395,7 @@  discard block
 block discarded – undo
2395 2395
      */
2396 2396
     public function addNamedQuery(array $queryMapping)
2397 2397
     {
2398
-        if (!isset($queryMapping['name'])) {
2398
+        if ( ! isset($queryMapping['name'])) {
2399 2399
             throw MappingException::nameIsMandatoryForQueryMapping($this->name);
2400 2400
         }
2401 2401
 
@@ -2403,7 +2403,7 @@  discard block
 block discarded – undo
2403 2403
             throw MappingException::duplicateQueryMapping($this->name, $queryMapping['name']);
2404 2404
         }
2405 2405
 
2406
-        if (!isset($queryMapping['query'])) {
2406
+        if ( ! isset($queryMapping['query'])) {
2407 2407
             throw MappingException::emptyQueryMapping($this->name, $queryMapping['name']);
2408 2408
         }
2409 2409
 
@@ -2430,7 +2430,7 @@  discard block
 block discarded – undo
2430 2430
      */
2431 2431
     public function addNamedNativeQuery(array $queryMapping)
2432 2432
     {
2433
-        if (!isset($queryMapping['name'])) {
2433
+        if ( ! isset($queryMapping['name'])) {
2434 2434
             throw MappingException::nameIsMandatoryForQueryMapping($this->name);
2435 2435
         }
2436 2436
 
@@ -2438,11 +2438,11 @@  discard block
 block discarded – undo
2438 2438
             throw MappingException::duplicateQueryMapping($this->name, $queryMapping['name']);
2439 2439
         }
2440 2440
 
2441
-        if (!isset($queryMapping['query'])) {
2441
+        if ( ! isset($queryMapping['query'])) {
2442 2442
             throw MappingException::emptyQueryMapping($this->name, $queryMapping['name']);
2443 2443
         }
2444 2444
 
2445
-        if (!isset($queryMapping['resultClass']) && !isset($queryMapping['resultSetMapping'])) {
2445
+        if ( ! isset($queryMapping['resultClass']) && ! isset($queryMapping['resultSetMapping'])) {
2446 2446
             throw MappingException::missingQueryMapping($this->name, $queryMapping['name']);
2447 2447
         }
2448 2448
 
@@ -2474,7 +2474,7 @@  discard block
 block discarded – undo
2474 2474
      */
2475 2475
     public function addSqlResultSetMapping(array $resultMapping)
2476 2476
     {
2477
-        if (!isset($resultMapping['name'])) {
2477
+        if ( ! isset($resultMapping['name'])) {
2478 2478
             throw MappingException::nameIsMandatoryForSqlResultSetMapping($this->name);
2479 2479
         }
2480 2480
 
@@ -2484,7 +2484,7 @@  discard block
 block discarded – undo
2484 2484
 
2485 2485
         if (isset($resultMapping['entities'])) {
2486 2486
             foreach ($resultMapping['entities'] as $key => $entityResult) {
2487
-                if (!isset($entityResult['entityClass'])) {
2487
+                if ( ! isset($entityResult['entityClass'])) {
2488 2488
                     throw MappingException::missingResultSetMappingEntity($this->name, $resultMapping['name']);
2489 2489
                 }
2490 2490
 
@@ -2503,11 +2503,11 @@  discard block
 block discarded – undo
2503 2503
 
2504 2504
                 if (isset($entityResult['fields'])) {
2505 2505
                     foreach ($entityResult['fields'] as $k => $field) {
2506
-                        if (!isset($field['name'])) {
2506
+                        if ( ! isset($field['name'])) {
2507 2507
                             throw MappingException::missingResultSetMappingFieldName($this->name, $resultMapping['name']);
2508 2508
                         }
2509 2509
 
2510
-                        if (!isset($field['column'])) {
2510
+                        if ( ! isset($field['column'])) {
2511 2511
                             $fieldName = $field['name'];
2512 2512
                             if (strpos($fieldName, '.')) {
2513 2513
                                 list(, $fieldName) = explode('.', $fieldName);
@@ -2998,7 +2998,7 @@  discard block
 block discarded – undo
2998 2998
         }
2999 2999
 
3000 3000
         if ($definition['sequenceName'][0] == '`') {
3001
-            $definition['sequenceName']   = trim($definition['sequenceName'], '`');
3001
+            $definition['sequenceName'] = trim($definition['sequenceName'], '`');
3002 3002
             $definition['quoted'] = true;
3003 3003
         }
3004 3004
 
@@ -3090,7 +3090,7 @@  discard block
 block discarded – undo
3090 3090
     public function getAssociationTargetClass($assocName)
3091 3091
     {
3092 3092
         if ( ! isset($this->associationMappings[$assocName])) {
3093
-            throw new InvalidArgumentException("Association name expected, '" . $assocName ."' is not an association.");
3093
+            throw new InvalidArgumentException("Association name expected, '".$assocName."' is not an association.");
3094 3094
         }
3095 3095
 
3096 3096
         return $this->associationMappings[$assocName]['targetEntity'];
@@ -3129,7 +3129,7 @@  discard block
 block discarded – undo
3129 3129
             // Association defined as Id field
3130 3130
             $joinColumns            = $this->associationMappings[$idProperty]['joinColumns'];
3131 3131
             $assocQuotedColumnNames = array_map(
3132
-                function ($joinColumn) use ($platform) {
3132
+                function($joinColumn) use ($platform) {
3133 3133
                     return isset($joinColumn['quoted'])
3134 3134
                         ? $platform->quoteIdentifier($joinColumn['name'])
3135 3135
                         : $joinColumn['name'];
@@ -3240,7 +3240,7 @@  discard block
 block discarded – undo
3240 3240
         }
3241 3241
 
3242 3242
         if ($className !== null && strpos($className, '\\') === false && $this->namespace) {
3243
-            return $this->namespace . '\\' . $className;
3243
+            return $this->namespace.'\\'.$className;
3244 3244
         }
3245 3245
 
3246 3246
         return $className;
@@ -3294,15 +3294,15 @@  discard block
 block discarded – undo
3294 3294
                 ? $fieldMapping['originalClass']
3295 3295
                 : $embeddable->name;
3296 3296
             $fieldMapping['declaredField'] = isset($fieldMapping['declaredField'])
3297
-                ? $property . '.' . $fieldMapping['declaredField']
3297
+                ? $property.'.'.$fieldMapping['declaredField']
3298 3298
                 : $property;
3299 3299
             $fieldMapping['originalField'] = isset($fieldMapping['originalField'])
3300 3300
                 ? $fieldMapping['originalField']
3301 3301
                 : $fieldMapping['fieldName'];
3302
-            $fieldMapping['fieldName'] = $property . "." . $fieldMapping['fieldName'];
3302
+            $fieldMapping['fieldName'] = $property.".".$fieldMapping['fieldName'];
3303 3303
 
3304
-            if (! empty($this->embeddedClasses[$property]['columnPrefix'])) {
3305
-                $fieldMapping['columnName'] = $this->embeddedClasses[$property]['columnPrefix'] . $fieldMapping['columnName'];
3304
+            if ( ! empty($this->embeddedClasses[$property]['columnPrefix'])) {
3305
+                $fieldMapping['columnName'] = $this->embeddedClasses[$property]['columnPrefix'].$fieldMapping['columnName'];
3306 3306
             } elseif ($this->embeddedClasses[$property]['columnPrefix'] !== false) {
3307 3307
                 $fieldMapping['columnName'] = $this->namingStrategy
3308 3308
                     ->embeddedFieldToColumnName(
@@ -3343,7 +3343,7 @@  discard block
 block discarded – undo
3343 3343
     {
3344 3344
         $sequencePrefix = $this->getSequencePrefix($platform);
3345 3345
         $columnName     = $this->getSingleIdentifierColumnName();
3346
-        $sequenceName   = $sequencePrefix . '_' . $columnName . '_seq';
3346
+        $sequenceName   = $sequencePrefix.'_'.$columnName.'_seq';
3347 3347
 
3348 3348
         return $sequenceName;
3349 3349
     }
@@ -3363,10 +3363,10 @@  discard block
 block discarded – undo
3363 3363
 
3364 3364
         // Prepend the schema name to the table name if there is one
3365 3365
         if ($schemaName = $this->getSchemaName()) {
3366
-            $sequencePrefix = $schemaName . '.' . $tableName;
3366
+            $sequencePrefix = $schemaName.'.'.$tableName;
3367 3367
 
3368 3368
             if ( ! $platform->supportsSchemas() && $platform->canEmulateSchemas()) {
3369
-                $sequencePrefix = $schemaName . '__' . $tableName;
3369
+                $sequencePrefix = $schemaName.'__'.$tableName;
3370 3370
             }
3371 3371
         }
3372 3372
 
@@ -3378,8 +3378,8 @@  discard block
 block discarded – undo
3378 3378
      */
3379 3379
     private function assertMappingOrderBy(array $mapping)
3380 3380
     {
3381
-        if (isset($mapping['orderBy']) && !is_array($mapping['orderBy'])) {
3382
-            throw new InvalidArgumentException("'orderBy' is expected to be an array, not " . gettype($mapping['orderBy']));
3381
+        if (isset($mapping['orderBy']) && ! is_array($mapping['orderBy'])) {
3382
+            throw new InvalidArgumentException("'orderBy' is expected to be an array, not ".gettype($mapping['orderBy']));
3383 3383
         }
3384 3384
     }
3385 3385
 }
Please login to merge, or discard this patch.