Completed
Pull Request — master (#6397)
by Vytautas
09:41
created
tests/Doctrine/Tests/ORM/Tools/Export/AbstractClassMetadataExporterTest.php 1 patch
Doc Comments   +9 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,6 +48,9 @@  discard block
 block discarded – undo
48 48
         return EntityManagerMock::create($conn, $config, $eventManager);
49 49
     }
50 50
 
51
+    /**
52
+     * @param string $path
53
+     */
51 54
     protected function _createMetadataDriver($type, $path)
52 55
     {
53 56
         $mappingDriver = [
@@ -67,6 +70,9 @@  discard block
 block discarded – undo
67 70
         return $driver;
68 71
     }
69 72
 
73
+    /**
74
+     * @param EntityManagerMock $em
75
+     */
70 76
     protected function _createClassMetadataFactory($em, $type)
71 77
     {
72 78
         $factory = ($type === 'annotation')
@@ -277,7 +283,6 @@  discard block
 block discarded – undo
277 283
 
278 284
     /**
279 285
      * @depends testOneToManyAssociationsAreExported
280
-     * @param ClassMetadataInfo $metadata
281 286
      */
282 287
     public function testManyToManyAssociationsAreExported($class)
283 288
     {
@@ -376,6 +381,9 @@  discard block
 block discarded – undo
376 381
 #        $this->_deleteDirectory(__DIR__ . '/export/'.$this->_getType());
377 382
     }
378 383
 
384
+    /**
385
+     * @param string $path
386
+     */
379 387
     protected function _deleteDirectory($path)
380 388
     {
381 389
         if (is_file($path)) {
Please login to merge, or discard this patch.
lib/Doctrine/ORM/Query/Exec/MultiTableUpdateExecutor.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
         // 1. Create an INSERT INTO temptable ... SELECT identifiers WHERE $AST->getWhereClause()
89 89
         $sqlWalker->setSQLTableAlias($primaryClass->getTableName(), 't0', $updateClause->aliasIdentificationVariable);
90 90
 
91
-        $this->_insertSql = 'INSERT INTO ' . $tempTable . ' (' . $idColumnList . ')'
92
-                . ' SELECT t0.' . implode(', t0.', $idColumnNames);
91
+        $this->_insertSql = 'INSERT INTO '.$tempTable.' ('.$idColumnList.')'
92
+                . ' SELECT t0.'.implode(', t0.', $idColumnNames);
93 93
 
94 94
         $rangeDecl = new AST\RangeVariableDeclaration($primaryClass->name, $updateClause->aliasIdentificationVariable);
95 95
         $fromClause = new AST\FromClause([new AST\IdentificationVariableDeclaration($rangeDecl, null, [])]);
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
         $this->_insertSql .= $sqlWalker->walkFromClause($fromClause);
98 98
 
99 99
         // 2. Create ID subselect statement used in UPDATE ... WHERE ... IN (subselect)
100
-        $idSubselect = 'SELECT ' . $idColumnList . ' FROM ' . $tempTable;
100
+        $idSubselect = 'SELECT '.$idColumnList.' FROM '.$tempTable;
101 101
 
102 102
         // 3. Create and store UPDATE statements
103 103
         $classNames = array_merge($primaryClass->parentClasses, [$primaryClass->name], $primaryClass->subClasses);
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
         foreach (array_reverse($classNames) as $className) {
107 107
             $affected = false;
108 108
             $class = $em->getClassMetadata($className);
109
-            $updateSql = 'UPDATE ' . $quoteStrategy->getTableName($class, $platform) . ' SET ';
109
+            $updateSql = 'UPDATE '.$quoteStrategy->getTableName($class, $platform).' SET ';
110 110
 
111 111
             foreach ($updateItems as $updateItem) {
112 112
                 $field = $updateItem->pathExpression->field;
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
             }
134 134
 
135 135
             if ($affected) {
136
-                $this->_sqlStatements[$i] = $updateSql . ' WHERE (' . $idColumnList . ') IN (' . $idSubselect . ')';
136
+                $this->_sqlStatements[$i] = $updateSql.' WHERE ('.$idColumnList.') IN ('.$idSubselect.')';
137 137
             }
138 138
         }
139 139
 
@@ -152,8 +152,8 @@  discard block
 block discarded – undo
152 152
             ];
153 153
         }
154 154
 
155
-        $this->_createTempTableSql = $platform->getCreateTemporaryTableSnippetSQL() . ' ' . $tempTable . ' ('
156
-                . $platform->getColumnDeclarationListSQL($columnDefinitions) . ')';
155
+        $this->_createTempTableSql = $platform->getCreateTemporaryTableSnippetSQL().' '.$tempTable.' ('
156
+                . $platform->getColumnDeclarationListSQL($columnDefinitions).')';
157 157
 
158 158
         $this->_dropTempTableSql = $platform->getDropTemporaryTableSQL($tempTable);
159 159
     }
Please login to merge, or discard this patch.
lib/Doctrine/ORM/Query/Exec/MultiTableDeleteExecutor.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
         // 1. Create an INSERT INTO temptable ... SELECT identifiers WHERE $AST->getWhereClause()
78 78
         $sqlWalker->setSQLTableAlias($primaryClass->getTableName(), 't0', $primaryDqlAlias);
79 79
 
80
-        $this->_insertSql = 'INSERT INTO ' . $tempTable . ' (' . $idColumnList . ')'
81
-                . ' SELECT t0.' . implode(', t0.', $idColumnNames);
80
+        $this->_insertSql = 'INSERT INTO '.$tempTable.' ('.$idColumnList.')'
81
+                . ' SELECT t0.'.implode(', t0.', $idColumnNames);
82 82
 
83 83
         $rangeDecl = new AST\RangeVariableDeclaration($primaryClass->name, $primaryDqlAlias);
84 84
         $fromClause = new AST\FromClause([new AST\IdentificationVariableDeclaration($rangeDecl, null, [])]);
@@ -90,14 +90,14 @@  discard block
 block discarded – undo
90 90
         }
91 91
 
92 92
         // 2. Create ID subselect statement used in DELETE ... WHERE ... IN (subselect)
93
-        $idSubselect = 'SELECT ' . $idColumnList . ' FROM ' . $tempTable;
93
+        $idSubselect = 'SELECT '.$idColumnList.' FROM '.$tempTable;
94 94
 
95 95
         // 3. Create and store DELETE statements
96 96
         $classNames = array_merge($primaryClass->parentClasses, [$primaryClass->name], $primaryClass->subClasses);
97 97
         foreach (array_reverse($classNames) as $className) {
98 98
             $tableName = $quoteStrategy->getTableName($em->getClassMetadata($className), $platform);
99
-            $this->_sqlStatements[] = 'DELETE FROM ' . $tableName
100
-                    . ' WHERE (' . $idColumnList . ') IN (' . $idSubselect . ')';
99
+            $this->_sqlStatements[] = 'DELETE FROM '.$tableName
100
+                    . ' WHERE ('.$idColumnList.') IN ('.$idSubselect.')';
101 101
         }
102 102
 
103 103
         // 4. Store DDL for temporary identifier table.
@@ -108,8 +108,8 @@  discard block
 block discarded – undo
108 108
                 'type'    => Type::getType(PersisterHelper::getTypeOfColumn($idColumnName, $rootClass, $em)),
109 109
             ];
110 110
         }
111
-        $this->_createTempTableSql = $platform->getCreateTemporaryTableSnippetSQL() . ' ' . $tempTable . ' ('
112
-                . $platform->getColumnDeclarationListSQL($columnDefinitions) . ')';
111
+        $this->_createTempTableSql = $platform->getCreateTemporaryTableSnippetSQL().' '.$tempTable.' ('
112
+                . $platform->getColumnDeclarationListSQL($columnDefinitions).')';
113 113
         $this->_dropTempTableSql = $platform->getDropTemporaryTableSQL($tempTable);
114 114
     }
115 115
 
Please login to merge, or discard this patch.
lib/Doctrine/ORM/Query/Expr/Literal.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
     /**
34 34
      * @var string
35 35
      */
36
-    protected $preSeparator  = '';
36
+    protected $preSeparator = '';
37 37
 
38 38
     /**
39 39
      * @var string
Please login to merge, or discard this patch.
lib/Doctrine/ORM/Tools/Pagination/WhereInWalker.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@
 block discarded – undo
102 102
                 [$pathExpression]
103 103
             );
104 104
             $expression = new InExpression($arithmeticExpression);
105
-            $expression->literals[] = new InputParameter(":" . self::PAGINATOR_ID_ALIAS);
105
+            $expression->literals[] = new InputParameter(":".self::PAGINATOR_ID_ALIAS);
106 106
 
107 107
         } else {
108 108
             $expression = new NullComparisonExpression($pathExpression);
Please login to merge, or discard this patch.
lib/Doctrine/ORM/Tools/SchemaTool.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
                             $inheritedKeyColumns[] = $columnName;
224 224
                         }
225 225
                     }
226
-                    if (!empty($inheritedKeyColumns)) {
226
+                    if ( ! empty($inheritedKeyColumns)) {
227 227
                         // Add a FK constraint on the ID column
228 228
                         $table->addForeignKeyConstraint(
229 229
                             $this->quoteStrategy->getTableName(
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
             }
331 331
         }
332 332
 
333
-        if ( ! $this->platform->supportsSchemas() && ! $this->platform->canEmulateSchemas() ) {
333
+        if ( ! $this->platform->supportsSchemas() && ! $this->platform->canEmulateSchemas()) {
334 334
             $schema->visit(new RemoveNamespacedAssets());
335 335
         }
336 336
 
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
 
405 405
         // For now, this is a hack required for single table inheritence, since this method is called
406 406
         // twice by single table inheritence relations
407
-        if (!$table->hasIndex('primary')) {
407
+        if ( ! $table->hasIndex('primary')) {
408 408
             //$table->setPrimaryKey($pkColumns);
409 409
         }
410 410
     }
@@ -641,7 +641,7 @@  discard block
 block discarded – undo
641 641
             if ( ! $definingClass) {
642 642
                 throw new \Doctrine\ORM\ORMException(
643 643
                     "Column name `".$joinColumn['referencedColumnName']."` referenced for relation from ".
644
-                    $mapping['sourceEntity'] . " towards ". $mapping['targetEntity'] . " does not exist."
644
+                    $mapping['sourceEntity']." towards ".$mapping['targetEntity']." does not exist."
645 645
                 );
646 646
             }
647 647
 
@@ -673,7 +673,7 @@  discard block
 block discarded – undo
673 673
                 $columnOptions = ['notnull' => false, 'columnDefinition' => $columnDef];
674 674
 
675 675
                 if (isset($joinColumn['nullable'])) {
676
-                    $columnOptions['notnull'] = !$joinColumn['nullable'];
676
+                    $columnOptions['notnull'] = ! $joinColumn['nullable'];
677 677
                 }
678 678
 
679 679
                 if (isset($fieldMapping['options'])) {
@@ -720,7 +720,7 @@  discard block
 block discarded – undo
720 720
                 }
721 721
             }
722 722
             $blacklistedFks[$compositeName] = true;
723
-        } elseif (!isset($blacklistedFks[$compositeName])) {
723
+        } elseif ( ! isset($blacklistedFks[$compositeName])) {
724 724
             $addedFks[$compositeName] = ['foreignTableName' => $foreignTableName, 'foreignColumns' => $foreignColumns];
725 725
             $theJoinTable->addUnnamedForeignKeyConstraint(
726 726
                 $foreignTableName,
@@ -827,7 +827,7 @@  discard block
 block discarded – undo
827 827
                 if ($table->hasPrimaryKey()) {
828 828
                     $columns = $table->getPrimaryKey()->getColumns();
829 829
                     if (count($columns) == 1) {
830
-                        $checkSequence = $table->getName() . "_" . $columns[0] . "_seq";
830
+                        $checkSequence = $table->getName()."_".$columns[0]."_seq";
831 831
                         if ($fullSchema->hasSequence($checkSequence)) {
832 832
                             $visitor->acceptSequence($fullSchema->getSequence($checkSequence));
833 833
                         }
Please login to merge, or discard this patch.
lib/Doctrine/ORM/Tools/ConvertDoctrine1Schema.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
         $schema = [];
76 76
         foreach ($this->from as $path) {
77 77
             if (is_dir($path)) {
78
-                $files = glob($path . '/*.yml');
78
+                $files = glob($path.'/*.yml');
79 79
                 foreach ($files as $file) {
80 80
                     $schema = array_merge($schema, (array) Yaml::parse(file_get_contents($file)));
81 81
                 }
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
             $metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_SEQUENCE);
239 239
 
240 240
             $definition = [
241
-                'sequenceName' => is_array($column['sequence']) ? $column['sequence']['name']:$column['sequence']
241
+                'sequenceName' => is_array($column['sequence']) ? $column['sequence']['name'] : $column['sequence']
242 242
             ];
243 243
 
244 244
             if (isset($column['sequence']['size'])) {
Please login to merge, or discard this patch.
lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -721,13 +721,13 @@
 block discarded – undo
721 721
         return $joinColumn;
722 722
     }
723 723
 
724
-     /**
725
-     * Parses the given field as array.
726
-     *
727
-     * @param SimpleXMLElement $fieldMapping
728
-     *
729
-     * @return array
730
-     */
724
+        /**
725
+         * Parses the given field as array.
726
+         *
727
+         * @param SimpleXMLElement $fieldMapping
728
+         *
729
+         * @return array
730
+         */
731 731
     private function columnToArray(SimpleXMLElement $fieldMapping)
732 732
     {
733 733
         $mapping = [
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 
164 164
         if (isset($xmlRoot['inheritance-type'])) {
165 165
             $inheritanceType = (string) $xmlRoot['inheritance-type'];
166
-            $metadata->setInheritanceType(constant('Doctrine\ORM\Mapping\ClassMetadata::INHERITANCE_TYPE_' . $inheritanceType));
166
+            $metadata->setInheritanceType(constant('Doctrine\ORM\Mapping\ClassMetadata::INHERITANCE_TYPE_'.$inheritanceType));
167 167
 
168 168
             if ($metadata->inheritanceType != \Doctrine\ORM\Mapping\ClassMetadata::INHERITANCE_TYPE_NONE) {
169 169
                 // Evaluate <discriminator-column...>
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
                 }
366 366
 
367 367
                 if (isset($oneToOneElement['fetch'])) {
368
-                    $mapping['fetch'] = constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_' . (string) $oneToOneElement['fetch']);
368
+                    $mapping['fetch'] = constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_'.(string) $oneToOneElement['fetch']);
369 369
                 }
370 370
 
371 371
                 if (isset($oneToOneElement['mapped-by'])) {
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
                 ];
415 415
 
416 416
                 if (isset($oneToManyElement['fetch'])) {
417
-                    $mapping['fetch'] = constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_' . (string) $oneToManyElement['fetch']);
417
+                    $mapping['fetch'] = constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_'.(string) $oneToManyElement['fetch']);
418 418
                 }
419 419
 
420 420
                 if (isset($oneToManyElement->cascade)) {
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
                 }
462 462
 
463 463
                 if (isset($manyToOneElement['fetch'])) {
464
-                    $mapping['fetch'] = constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_' . (string) $manyToOneElement['fetch']);
464
+                    $mapping['fetch'] = constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_'.(string) $manyToOneElement['fetch']);
465 465
                 }
466 466
 
467 467
                 if (isset($manyToOneElement['inversed-by'])) {
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
                 ];
504 504
 
505 505
                 if (isset($manyToManyElement['fetch'])) {
506
-                    $mapping['fetch'] = constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_' . (string) $manyToManyElement['fetch']);
506
+                    $mapping['fetch'] = constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_'.(string) $manyToManyElement['fetch']);
507 507
                 }
508 508
 
509 509
                 if (isset($manyToManyElement['orphan-removal'])) {
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
         // Evaluate <lifecycle-callbacks...>
629 629
         if (isset($xmlRoot->{'lifecycle-callbacks'})) {
630 630
             foreach ($xmlRoot->{'lifecycle-callbacks'}->{'lifecycle-callback'} as $lifecycleCallback) {
631
-                $metadata->addLifecycleCallback((string) $lifecycleCallback['method'], constant('Doctrine\ORM\Events::' . (string) $lifecycleCallback['type']));
631
+                $metadata->addLifecycleCallback((string) $lifecycleCallback['method'], constant('Doctrine\ORM\Events::'.(string) $lifecycleCallback['type']));
632 632
             }
633 633
         }
634 634
 
@@ -789,12 +789,12 @@  discard block
 block discarded – undo
789 789
         $region = isset($cacheMapping['region']) ? (string) $cacheMapping['region'] : null;
790 790
         $usage  = isset($cacheMapping['usage']) ? strtoupper($cacheMapping['usage']) : null;
791 791
 
792
-        if ($usage && ! defined('Doctrine\ORM\Mapping\ClassMetadata::CACHE_USAGE_' . $usage)) {
792
+        if ($usage && ! defined('Doctrine\ORM\Mapping\ClassMetadata::CACHE_USAGE_'.$usage)) {
793 793
             throw new \InvalidArgumentException(sprintf('Invalid cache usage "%s"', $usage));
794 794
         }
795 795
 
796 796
         if ($usage) {
797
-            $usage = constant('Doctrine\ORM\Mapping\ClassMetadata::CACHE_USAGE_' . $usage);
797
+            $usage = constant('Doctrine\ORM\Mapping\ClassMetadata::CACHE_USAGE_'.$usage);
798 798
         }
799 799
 
800 800
         return [
Please login to merge, or discard this patch.
ORM/Cache/Persister/Collection/ReadOnlyCachedCollectionPersister.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,9 +30,9 @@
 block discarded – undo
30 30
  */
31 31
 class ReadOnlyCachedCollectionPersister extends NonStrictReadWriteCachedCollectionPersister
32 32
 {
33
-     /**
34
-     * {@inheritdoc}
35
-     */
33
+        /**
34
+         * {@inheritdoc}
35
+         */
36 36
     public function update(PersistentCollection $collection)
37 37
     {
38 38
         if ($collection->isDirty() && $collection->getSnapshot()) {
Please login to merge, or discard this patch.