Completed
Pull Request — master (#5962)
by Pavel
11:40
created
lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php 1 patch
Spacing   +38 added lines, -38 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
     /**
@@ -1034,7 +1034,7 @@  discard block
 block discarded – undo
1034 1034
     public function validateAssociations()
1035 1035
     {
1036 1036
         foreach ($this->associationMappings as $mapping) {
1037
-            if ( ! ClassLoader::classExists($mapping['targetEntity']) ) {
1037
+            if ( ! ClassLoader::classExists($mapping['targetEntity'])) {
1038 1038
                 throw MappingException::invalidTargetEntityClass($mapping['targetEntity'], $this->name, $mapping['fieldName']);
1039 1039
             }
1040 1040
         }
@@ -1094,7 +1094,7 @@  discard block
 block discarded – undo
1094 1094
      */
1095 1095
     public function enableAssociationCache($fieldName, array $cache)
1096 1096
     {
1097
-        $this->associationMappings[$fieldName]['cache'] = $this->getAssociationCacheDefaults ($fieldName, $cache);
1097
+        $this->associationMappings[$fieldName]['cache'] = $this->getAssociationCacheDefaults($fieldName, $cache);
1098 1098
     }
1099 1099
 
1100 1100
     /**
@@ -1112,7 +1112,7 @@  discard block
 block discarded – undo
1112 1112
         }
1113 1113
 
1114 1114
         if ( ! isset($cache['region'])) {
1115
-            $cache['region'] = strtolower(str_replace('\\', '_', $this->rootEntityName)) . '__' . $fieldName;
1115
+            $cache['region'] = strtolower(str_replace('\\', '_', $this->rootEntityName)).'__'.$fieldName;
1116 1116
         }
1117 1117
 
1118 1118
         return $cache;
@@ -1513,7 +1513,7 @@  discard block
 block discarded – undo
1513 1513
                 $this->isIdentifierComposite = true;
1514 1514
             }
1515 1515
 
1516
-            if ($this->cache && !isset($mapping['cache'])) {
1516
+            if ($this->cache && ! isset($mapping['cache'])) {
1517 1517
                 throw CacheException::nonCacheableEntityAssociation($this->name, $mapping['fieldName']);
1518 1518
             }
1519 1519
         }
@@ -1644,7 +1644,7 @@  discard block
 block discarded – undo
1644 1644
                     throw new RuntimeException("ClassMetadataInfo::setTable() has to be called before defining a one to one relationship.");
1645 1645
                 }
1646 1646
 
1647
-                $this->table['uniqueConstraints'][$mapping['fieldName'] . "_uniq"] = array(
1647
+                $this->table['uniqueConstraints'][$mapping['fieldName']."_uniq"] = array(
1648 1648
                     'columns' => $uniqueConstraintColumns
1649 1649
                 );
1650 1650
             }
@@ -1659,7 +1659,7 @@  discard block
 block discarded – undo
1659 1659
             unset($mapping['unique']);
1660 1660
         }
1661 1661
 
1662
-        if (isset($mapping['id']) && $mapping['id'] === true && !$mapping['isOwningSide']) {
1662
+        if (isset($mapping['id']) && $mapping['id'] === true && ! $mapping['isOwningSide']) {
1663 1663
             throw MappingException::illegalInverseIdentifierAssociation($this->name, $mapping['fieldName']);
1664 1664
         }
1665 1665
 
@@ -1713,7 +1713,7 @@  discard block
 block discarded – undo
1713 1713
             }
1714 1714
 
1715 1715
             $selfReferencingEntityWithoutJoinColumns = $mapping['sourceEntity'] == $mapping['targetEntity']
1716
-                && (! (isset($mapping['joinTable']['joinColumns']) || isset($mapping['joinTable']['inverseJoinColumns'])));
1716
+                && ( ! (isset($mapping['joinTable']['joinColumns']) || isset($mapping['joinTable']['inverseJoinColumns'])));
1717 1717
 
1718 1718
             if ( ! isset($mapping['joinTable']['joinColumns'])) {
1719 1719
                 $mapping['joinTable']['joinColumns'] = array(
@@ -1902,7 +1902,7 @@  discard block
 block discarded – undo
1902 1902
 
1903 1903
             // Association defined as Id field
1904 1904
             $joinColumns      = $this->associationMappings[$idProperty]['joinColumns'];
1905
-            $assocColumnNames = array_map(function ($joinColumn) { return $joinColumn['name']; }, $joinColumns);
1905
+            $assocColumnNames = array_map(function($joinColumn) { return $joinColumn['name']; }, $joinColumns);
1906 1906
 
1907 1907
             $columnNames = array_merge($columnNames, $assocColumnNames);
1908 1908
         }
@@ -2083,7 +2083,7 @@  discard block
 block discarded – undo
2083 2083
     public function getTemporaryIdTableName()
2084 2084
     {
2085 2085
         // replace dots with underscores because PostgreSQL creates temporary tables in a special schema
2086
-        return str_replace('.', '_', $this->getTableName() . '_id_tmp');
2086
+        return str_replace('.', '_', $this->getTableName().'_id_tmp');
2087 2087
     }
2088 2088
 
2089 2089
     /**
@@ -2412,7 +2412,7 @@  discard block
 block discarded – undo
2412 2412
      */
2413 2413
     public function addNamedQuery(array $queryMapping)
2414 2414
     {
2415
-        if (!isset($queryMapping['name'])) {
2415
+        if ( ! isset($queryMapping['name'])) {
2416 2416
             throw MappingException::nameIsMandatoryForQueryMapping($this->name);
2417 2417
         }
2418 2418
 
@@ -2420,7 +2420,7 @@  discard block
 block discarded – undo
2420 2420
             throw MappingException::duplicateQueryMapping($this->name, $queryMapping['name']);
2421 2421
         }
2422 2422
 
2423
-        if (!isset($queryMapping['query'])) {
2423
+        if ( ! isset($queryMapping['query'])) {
2424 2424
             throw MappingException::emptyQueryMapping($this->name, $queryMapping['name']);
2425 2425
         }
2426 2426
 
@@ -2447,7 +2447,7 @@  discard block
 block discarded – undo
2447 2447
      */
2448 2448
     public function addNamedNativeQuery(array $queryMapping)
2449 2449
     {
2450
-        if (!isset($queryMapping['name'])) {
2450
+        if ( ! isset($queryMapping['name'])) {
2451 2451
             throw MappingException::nameIsMandatoryForQueryMapping($this->name);
2452 2452
         }
2453 2453
 
@@ -2455,11 +2455,11 @@  discard block
 block discarded – undo
2455 2455
             throw MappingException::duplicateQueryMapping($this->name, $queryMapping['name']);
2456 2456
         }
2457 2457
 
2458
-        if (!isset($queryMapping['query'])) {
2458
+        if ( ! isset($queryMapping['query'])) {
2459 2459
             throw MappingException::emptyQueryMapping($this->name, $queryMapping['name']);
2460 2460
         }
2461 2461
 
2462
-        if (!isset($queryMapping['resultClass']) && !isset($queryMapping['resultSetMapping'])) {
2462
+        if ( ! isset($queryMapping['resultClass']) && ! isset($queryMapping['resultSetMapping'])) {
2463 2463
             throw MappingException::missingQueryMapping($this->name, $queryMapping['name']);
2464 2464
         }
2465 2465
 
@@ -2491,7 +2491,7 @@  discard block
 block discarded – undo
2491 2491
      */
2492 2492
     public function addSqlResultSetMapping(array $resultMapping)
2493 2493
     {
2494
-        if (!isset($resultMapping['name'])) {
2494
+        if ( ! isset($resultMapping['name'])) {
2495 2495
             throw MappingException::nameIsMandatoryForSqlResultSetMapping($this->name);
2496 2496
         }
2497 2497
 
@@ -2501,7 +2501,7 @@  discard block
 block discarded – undo
2501 2501
 
2502 2502
         if (isset($resultMapping['entities'])) {
2503 2503
             foreach ($resultMapping['entities'] as $key => $entityResult) {
2504
-                if (!isset($entityResult['entityClass'])) {
2504
+                if ( ! isset($entityResult['entityClass'])) {
2505 2505
                     throw MappingException::missingResultSetMappingEntity($this->name, $resultMapping['name']);
2506 2506
                 }
2507 2507
 
@@ -2520,11 +2520,11 @@  discard block
 block discarded – undo
2520 2520
 
2521 2521
                 if (isset($entityResult['fields'])) {
2522 2522
                     foreach ($entityResult['fields'] as $k => $field) {
2523
-                        if (!isset($field['name'])) {
2523
+                        if ( ! isset($field['name'])) {
2524 2524
                             throw MappingException::missingResultSetMappingFieldName($this->name, $resultMapping['name']);
2525 2525
                         }
2526 2526
 
2527
-                        if (!isset($field['column'])) {
2527
+                        if ( ! isset($field['column'])) {
2528 2528
                             $fieldName = $field['name'];
2529 2529
                             if (strpos($fieldName, '.')) {
2530 2530
                                 list(, $fieldName) = explode('.', $fieldName);
@@ -3015,7 +3015,7 @@  discard block
 block discarded – undo
3015 3015
         }
3016 3016
 
3017 3017
         if ($definition['sequenceName'][0] == '`') {
3018
-            $definition['sequenceName']   = trim($definition['sequenceName'], '`');
3018
+            $definition['sequenceName'] = trim($definition['sequenceName'], '`');
3019 3019
             $definition['quoted'] = true;
3020 3020
         }
3021 3021
 
@@ -3107,7 +3107,7 @@  discard block
 block discarded – undo
3107 3107
     public function getAssociationTargetClass($assocName)
3108 3108
     {
3109 3109
         if ( ! isset($this->associationMappings[$assocName])) {
3110
-            throw new InvalidArgumentException("Association name expected, '" . $assocName ."' is not an association.");
3110
+            throw new InvalidArgumentException("Association name expected, '".$assocName."' is not an association.");
3111 3111
         }
3112 3112
 
3113 3113
         return $this->associationMappings[$assocName]['targetEntity'];
@@ -3146,7 +3146,7 @@  discard block
 block discarded – undo
3146 3146
             // Association defined as Id field
3147 3147
             $joinColumns            = $this->associationMappings[$idProperty]['joinColumns'];
3148 3148
             $assocQuotedColumnNames = array_map(
3149
-                function ($joinColumn) use ($platform) {
3149
+                function($joinColumn) use ($platform) {
3150 3150
                     return isset($joinColumn['quoted'])
3151 3151
                         ? $platform->quoteIdentifier($joinColumn['name'])
3152 3152
                         : $joinColumn['name'];
@@ -3257,7 +3257,7 @@  discard block
 block discarded – undo
3257 3257
         }
3258 3258
 
3259 3259
         if ($className !== null && strpos($className, '\\') === false && strlen($this->namespace) > 0) {
3260
-            return $this->namespace . '\\' . $className;
3260
+            return $this->namespace.'\\'.$className;
3261 3261
         }
3262 3262
 
3263 3263
         return $className;
@@ -3311,15 +3311,15 @@  discard block
 block discarded – undo
3311 3311
                 ? $fieldMapping['originalClass']
3312 3312
                 : $embeddable->name;
3313 3313
             $fieldMapping['declaredField'] = isset($fieldMapping['declaredField'])
3314
-                ? $property . '.' . $fieldMapping['declaredField']
3314
+                ? $property.'.'.$fieldMapping['declaredField']
3315 3315
                 : $property;
3316 3316
             $fieldMapping['originalField'] = isset($fieldMapping['originalField'])
3317 3317
                 ? $fieldMapping['originalField']
3318 3318
                 : $fieldMapping['fieldName'];
3319
-            $fieldMapping['fieldName'] = $property . "." . $fieldMapping['fieldName'];
3319
+            $fieldMapping['fieldName'] = $property.".".$fieldMapping['fieldName'];
3320 3320
 
3321
-            if (! empty($this->embeddedClasses[$property]['columnPrefix'])) {
3322
-                $fieldMapping['columnName'] = $this->embeddedClasses[$property]['columnPrefix'] . $fieldMapping['columnName'];
3321
+            if ( ! empty($this->embeddedClasses[$property]['columnPrefix'])) {
3322
+                $fieldMapping['columnName'] = $this->embeddedClasses[$property]['columnPrefix'].$fieldMapping['columnName'];
3323 3323
             } elseif ($this->embeddedClasses[$property]['columnPrefix'] !== false) {
3324 3324
                 $fieldMapping['columnName'] = $this->namingStrategy
3325 3325
                     ->embeddedFieldToColumnName(
@@ -3334,23 +3334,23 @@  discard block
 block discarded – undo
3334 3334
         }
3335 3335
 
3336 3336
         foreach ($embeddable->associationMappings as $assocMapping) {
3337
-            if (!($assocMapping['type'] & ClassMetadata::MANY_TO_ONE)) {
3337
+            if ( ! ($assocMapping['type'] & ClassMetadata::MANY_TO_ONE)) {
3338 3338
                 continue;
3339 3339
             }
3340 3340
             $assocMapping['originalClass'] = isset($assocMapping['originalClass'])
3341 3341
                 ? $assocMapping['originalClass']
3342 3342
                 : $embeddable->name;
3343 3343
             $assocMapping['declaredField'] = isset($assocMapping['declaredField'])
3344
-                ? $property . '.' . $assocMapping['declaredField']
3344
+                ? $property.'.'.$assocMapping['declaredField']
3345 3345
                 : $property;
3346 3346
             $assocMapping['originalField'] = isset($assocMapping['originalField'])
3347 3347
                 ? $assocMapping['originalField']
3348 3348
                 : $assocMapping['fieldName'];
3349
-            $assocMapping['fieldName']     = $property . "." . $assocMapping['fieldName'];
3349
+            $assocMapping['fieldName']     = $property.".".$assocMapping['fieldName'];
3350 3350
 
3351 3351
             foreach ($assocMapping['joinColumns'] as &$column) {
3352
-                if (!empty($this->embeddedClasses[$property]['columnPrefix'])) {
3353
-                    $column['name'] = $this->embeddedClasses[$property]['columnPrefix'] . $column['name'];
3352
+                if ( ! empty($this->embeddedClasses[$property]['columnPrefix'])) {
3353
+                    $column['name'] = $this->embeddedClasses[$property]['columnPrefix'].$column['name'];
3354 3354
                 } elseif ($this->embeddedClasses[$property]['columnPrefix'] !== false) {
3355 3355
                     $column['name'] = $this->namingStrategy
3356 3356
                         ->embeddedFieldToColumnName(
@@ -3392,7 +3392,7 @@  discard block
 block discarded – undo
3392 3392
     {
3393 3393
         $sequencePrefix = $this->getSequencePrefix($platform);
3394 3394
         $columnName     = $this->getSingleIdentifierColumnName();
3395
-        $sequenceName   = $sequencePrefix . '_' . $columnName . '_seq';
3395
+        $sequenceName   = $sequencePrefix.'_'.$columnName.'_seq';
3396 3396
 
3397 3397
         return $sequenceName;
3398 3398
     }
@@ -3412,10 +3412,10 @@  discard block
 block discarded – undo
3412 3412
 
3413 3413
         // Prepend the schema name to the table name if there is one
3414 3414
         if ($schemaName = $this->getSchemaName()) {
3415
-            $sequencePrefix = $schemaName . '.' . $tableName;
3415
+            $sequencePrefix = $schemaName.'.'.$tableName;
3416 3416
 
3417 3417
             if ( ! $platform->supportsSchemas() && $platform->canEmulateSchemas()) {
3418
-                $sequencePrefix = $schemaName . '__' . $tableName;
3418
+                $sequencePrefix = $schemaName.'__'.$tableName;
3419 3419
             }
3420 3420
         }
3421 3421
 
@@ -3427,8 +3427,8 @@  discard block
 block discarded – undo
3427 3427
      */
3428 3428
     private function assertMappingOrderBy(array $mapping)
3429 3429
     {
3430
-        if (isset($mapping['orderBy']) && !is_array($mapping['orderBy'])) {
3431
-            throw new InvalidArgumentException("'orderBy' is expected to be an array, not " . gettype($mapping['orderBy']));
3430
+        if (isset($mapping['orderBy']) && ! is_array($mapping['orderBy'])) {
3431
+            throw new InvalidArgumentException("'orderBy' is expected to be an array, not ".gettype($mapping['orderBy']));
3432 3432
         }
3433 3433
     }
3434 3434
 }
Please login to merge, or discard this patch.