Completed
Pull Request — master (#5828)
by Matteo
13:04
created
lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php 1 patch
Spacing   +33 added lines, -33 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]];
@@ -779,7 +779,7 @@  discard block
 block discarded – undo
779 779
      */
780 780
     public function getFieldValue($entity, $field)
781 781
     {
782
-        if (!$entity instanceof $this->reflFields[$field]->class) {
782
+        if ( ! $entity instanceof $this->reflFields[$field]->class) {
783 783
             return null;
784 784
         }
785 785
 
@@ -795,7 +795,7 @@  discard block
 block discarded – undo
795 795
      */
796 796
     public function __toString()
797 797
     {
798
-        return __CLASS__ . '@' . spl_object_hash($this);
798
+        return __CLASS__.'@'.spl_object_hash($this);
799 799
     }
800 800
 
801 801
     /**
@@ -1024,7 +1024,7 @@  discard block
 block discarded – undo
1024 1024
     public function validateAssociations()
1025 1025
     {
1026 1026
         foreach ($this->associationMappings as $mapping) {
1027
-            if ( ! ClassLoader::classExists($mapping['targetEntity']) ) {
1027
+            if ( ! ClassLoader::classExists($mapping['targetEntity'])) {
1028 1028
                 throw MappingException::invalidTargetEntityClass($mapping['targetEntity'], $this->name, $mapping['fieldName']);
1029 1029
             }
1030 1030
         }
@@ -1084,7 +1084,7 @@  discard block
 block discarded – undo
1084 1084
      */
1085 1085
     public function enableAssociationCache($fieldName, array $cache)
1086 1086
     {
1087
-        $this->associationMappings[$fieldName]['cache'] = $this->getAssociationCacheDefaults ($fieldName, $cache);
1087
+        $this->associationMappings[$fieldName]['cache'] = $this->getAssociationCacheDefaults($fieldName, $cache);
1088 1088
     }
1089 1089
 
1090 1090
     /**
@@ -1102,7 +1102,7 @@  discard block
 block discarded – undo
1102 1102
         }
1103 1103
 
1104 1104
         if ( ! isset($cache['region'])) {
1105
-            $cache['region'] = strtolower(str_replace('\\', '_', $this->rootEntityName)) . '__' . $fieldName;
1105
+            $cache['region'] = strtolower(str_replace('\\', '_', $this->rootEntityName)).'__'.$fieldName;
1106 1106
         }
1107 1107
 
1108 1108
         return $cache;
@@ -1465,7 +1465,7 @@  discard block
 block discarded – undo
1465 1465
         $mapping['isOwningSide'] = true; // assume owning side until we hit mappedBy
1466 1466
 
1467 1467
         // unset optional indexBy attribute if its empty
1468
-        if ( ! isset($mapping['indexBy']) || !$mapping['indexBy']) {
1468
+        if ( ! isset($mapping['indexBy']) || ! $mapping['indexBy']) {
1469 1469
             unset($mapping['indexBy']);
1470 1470
         }
1471 1471
 
@@ -1504,7 +1504,7 @@  discard block
 block discarded – undo
1504 1504
                 $this->isIdentifierComposite = true;
1505 1505
             }
1506 1506
 
1507
-            if ($this->cache && !isset($mapping['cache'])) {
1507
+            if ($this->cache && ! isset($mapping['cache'])) {
1508 1508
                 throw CacheException::nonCacheableEntityAssociation($this->name, $mapping['fieldName']);
1509 1509
             }
1510 1510
         }
@@ -1636,7 +1636,7 @@  discard block
 block discarded – undo
1636 1636
                     throw new RuntimeException("ClassMetadataInfo::setTable() has to be called before defining a one to one relationship.");
1637 1637
                 }
1638 1638
 
1639
-                $this->table['uniqueConstraints'][$mapping['fieldName'] . "_uniq"] = array(
1639
+                $this->table['uniqueConstraints'][$mapping['fieldName']."_uniq"] = array(
1640 1640
                     'columns' => $uniqueConstraintColumns
1641 1641
                 );
1642 1642
             }
@@ -1651,7 +1651,7 @@  discard block
 block discarded – undo
1651 1651
             unset($mapping['unique']);
1652 1652
         }
1653 1653
 
1654
-        if (isset($mapping['id']) && $mapping['id'] === true && !$mapping['isOwningSide']) {
1654
+        if (isset($mapping['id']) && $mapping['id'] === true && ! $mapping['isOwningSide']) {
1655 1655
             throw MappingException::illegalInverseIdentifierAssociation($this->name, $mapping['fieldName']);
1656 1656
         }
1657 1657
 
@@ -1709,7 +1709,7 @@  discard block
 block discarded – undo
1709 1709
             }
1710 1710
 
1711 1711
             $selfReferencingEntityWithoutJoinColumns = $mapping['sourceEntity'] == $mapping['targetEntity']
1712
-                && (! (isset($mapping['joinTable']['joinColumns']) || isset($mapping['joinTable']['inverseJoinColumns'])));
1712
+                && ( ! (isset($mapping['joinTable']['joinColumns']) || isset($mapping['joinTable']['inverseJoinColumns'])));
1713 1713
 
1714 1714
             if ( ! isset($mapping['joinTable']['joinColumns'])) {
1715 1715
                 $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(
@@ -3360,7 +3360,7 @@  discard block
 block discarded – undo
3360 3360
     {
3361 3361
         $sequencePrefix = $this->getSequencePrefix($platform);
3362 3362
         $columnName     = $this->getSingleIdentifierColumnName();
3363
-        $sequenceName   = $sequencePrefix . '_' . $columnName . '_seq';
3363
+        $sequenceName   = $sequencePrefix.'_'.$columnName.'_seq';
3364 3364
 
3365 3365
         return $sequenceName;
3366 3366
     }
@@ -3380,10 +3380,10 @@  discard block
 block discarded – undo
3380 3380
 
3381 3381
         // Prepend the schema name to the table name if there is one
3382 3382
         if ($schemaName = $this->getSchemaName()) {
3383
-            $sequencePrefix = $schemaName . '.' . $tableName;
3383
+            $sequencePrefix = $schemaName.'.'.$tableName;
3384 3384
 
3385 3385
             if ( ! $platform->supportsSchemas() && $platform->canEmulateSchemas()) {
3386
-                $sequencePrefix = $schemaName . '__' . $tableName;
3386
+                $sequencePrefix = $schemaName.'__'.$tableName;
3387 3387
             }
3388 3388
         }
3389 3389
 
Please login to merge, or discard this patch.