@@ -117,6 +117,7 @@ discard block |
||
117 | 117 | } |
118 | 118 | |
119 | 119 | /** |
120 | + * @param string|false $columnPrefix |
|
120 | 121 | * @return ClassMetadataInfo |
121 | 122 | */ |
122 | 123 | private function generateIsbnEmbeddableFixture(array $embeddedClasses = [], $columnPrefix = null) |
@@ -1167,7 +1168,7 @@ discard block |
||
1167 | 1168 | |
1168 | 1169 | /** |
1169 | 1170 | * @param string $type |
1170 | - * @param \ReflectionProperty $method |
|
1171 | + * @param \ReflectionMethod $method |
|
1171 | 1172 | */ |
1172 | 1173 | private function assertPhpDocParamType($type, \ReflectionMethod $method) |
1173 | 1174 | { |
@@ -539,7 +539,7 @@ discard block |
||
539 | 539 | $this->_generator->writeEntityClass($metadata, $this->_tmpDir); |
540 | 540 | |
541 | 541 | $filename = $this->_tmpDir . DIRECTORY_SEPARATOR |
542 | - . $this->_namespace . DIRECTORY_SEPARATOR . 'DDC1784Entity.php'; |
|
542 | + . $this->_namespace . DIRECTORY_SEPARATOR . 'DDC1784Entity.php'; |
|
543 | 543 | |
544 | 544 | $this->assertFileExists($filename); |
545 | 545 | require_once $filename; |
@@ -600,9 +600,9 @@ discard block |
||
600 | 600 | |
601 | 601 | } |
602 | 602 | |
603 | - /** |
|
604 | - * @group DDC-2172 |
|
605 | - */ |
|
603 | + /** |
|
604 | + * @group DDC-2172 |
|
605 | + */ |
|
606 | 606 | public function testGetInheritanceTypeString() |
607 | 607 | { |
608 | 608 | $reflection = new \ReflectionClass('\Doctrine\ORM\Mapping\ClassMetadataInfo'); |
@@ -630,8 +630,8 @@ discard block |
||
630 | 630 | } |
631 | 631 | |
632 | 632 | /** |
633 | - * @group DDC-2172 |
|
634 | - */ |
|
633 | + * @group DDC-2172 |
|
634 | + */ |
|
635 | 635 | public function testGetChangeTrackingPolicyString() |
636 | 636 | { |
637 | 637 | $reflection = new \ReflectionClass('\Doctrine\ORM\Mapping\ClassMetadata'); |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | { |
28 | 28 | $this->_namespace = uniqid("doctrine_"); |
29 | 29 | $this->_tmpDir = \sys_get_temp_dir(); |
30 | - \mkdir($this->_tmpDir . \DIRECTORY_SEPARATOR . $this->_namespace); |
|
30 | + \mkdir($this->_tmpDir.\DIRECTORY_SEPARATOR.$this->_namespace); |
|
31 | 31 | $this->_generator = new EntityGenerator(); |
32 | 32 | $this->_generator->setAnnotationPrefix(""); |
33 | 33 | $this->_generator->setGenerateAnnotations(true); |
@@ -41,14 +41,14 @@ discard block |
||
41 | 41 | |
42 | 42 | public function tearDown() |
43 | 43 | { |
44 | - $ri = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->_tmpDir . '/' . $this->_namespace)); |
|
44 | + $ri = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->_tmpDir.'/'.$this->_namespace)); |
|
45 | 45 | foreach ($ri AS $file) { |
46 | 46 | /* @var $file \SplFileInfo */ |
47 | 47 | if ($file->isFile()) { |
48 | 48 | \unlink($file->getPathname()); |
49 | 49 | } |
50 | 50 | } |
51 | - rmdir($this->_tmpDir . '/' . $this->_namespace); |
|
51 | + rmdir($this->_tmpDir.'/'.$this->_namespace); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -58,9 +58,9 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public function generateBookEntityFixture(array $embeddedClasses = []) |
60 | 60 | { |
61 | - $metadata = new ClassMetadataInfo($this->_namespace . '\EntityGeneratorBook'); |
|
61 | + $metadata = new ClassMetadataInfo($this->_namespace.'\EntityGeneratorBook'); |
|
62 | 62 | $metadata->namespace = $this->_namespace; |
63 | - $metadata->customRepositoryClassName = $this->_namespace . '\EntityGeneratorBookRepository'; |
|
63 | + $metadata->customRepositoryClassName = $this->_namespace.'\EntityGeneratorBookRepository'; |
|
64 | 64 | |
65 | 65 | $metadata->table['name'] = 'book'; |
66 | 66 | $metadata->table['uniqueConstraints']['name_uniq'] = ['columns' => ['name']]; |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | |
103 | 103 | private function generateEntityTypeFixture(array $field) |
104 | 104 | { |
105 | - $metadata = new ClassMetadataInfo($this->_namespace . '\EntityType'); |
|
105 | + $metadata = new ClassMetadataInfo($this->_namespace.'\EntityType'); |
|
106 | 106 | $metadata->namespace = $this->_namespace; |
107 | 107 | |
108 | 108 | $metadata->table['name'] = 'entity_type'; |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | */ |
124 | 124 | private function generateIsbnEmbeddableFixture(array $embeddedClasses = [], $columnPrefix = null) |
125 | 125 | { |
126 | - $metadata = new ClassMetadataInfo($this->_namespace . '\EntityGeneratorIsbn'); |
|
126 | + $metadata = new ClassMetadataInfo($this->_namespace.'\EntityGeneratorIsbn'); |
|
127 | 127 | $metadata->namespace = $this->_namespace; |
128 | 128 | $metadata->isEmbeddedClass = true; |
129 | 129 | $metadata->mapField(['fieldName' => 'prefix', 'type' => 'integer']); |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | */ |
147 | 147 | private function generateTestEmbeddableFixture() |
148 | 148 | { |
149 | - $metadata = new ClassMetadataInfo($this->_namespace . '\EntityGeneratorTestEmbeddable'); |
|
149 | + $metadata = new ClassMetadataInfo($this->_namespace.'\EntityGeneratorTestEmbeddable'); |
|
150 | 150 | $metadata->namespace = $this->_namespace; |
151 | 151 | $metadata->isEmbeddedClass = true; |
152 | 152 | $metadata->mapField(['fieldName' => 'field1', 'type' => 'integer']); |
@@ -189,11 +189,11 @@ discard block |
||
189 | 189 | foreach ($embeddableMetadata->embeddedClasses as $property => $embeddableClass) { |
190 | 190 | $classMetadata->mapEmbedded( |
191 | 191 | [ |
192 | - 'fieldName' => $fieldName . '.' . $property, |
|
192 | + 'fieldName' => $fieldName.'.'.$property, |
|
193 | 193 | 'class' => $embeddableClass['class'], |
194 | 194 | 'columnPrefix' => $embeddableClass['columnPrefix'], |
195 | 195 | 'declaredField' => $embeddableClass['declaredField'] |
196 | - ? $fieldName . '.' . $embeddableClass['declaredField'] |
|
196 | + ? $fieldName.'.'.$embeddableClass['declaredField'] |
|
197 | 197 | : $fieldName, |
198 | 198 | 'originalField' => $embeddableClass['originalField'] ?: $property, |
199 | 199 | ] |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | private function loadEntityClass(ClassMetadataInfo $metadata) |
208 | 208 | { |
209 | 209 | $className = basename(str_replace('\\', '/', $metadata->name)); |
210 | - $path = $this->_tmpDir . '/' . $this->_namespace . '/' . $className . '.php'; |
|
210 | + $path = $this->_tmpDir.'/'.$this->_namespace.'/'.$className.'.php'; |
|
211 | 211 | |
212 | 212 | $this->assertFileExists($path); |
213 | 213 | |
@@ -267,19 +267,19 @@ discard block |
||
267 | 267 | |
268 | 268 | $book = $this->newInstance($metadata); |
269 | 269 | $this->assertTrue(class_exists($metadata->name), "Class does not exist."); |
270 | - $this->assertTrue(method_exists($metadata->namespace . '\EntityGeneratorBook', '__construct'), "EntityGeneratorBook::__construct() missing."); |
|
271 | - $this->assertTrue(method_exists($metadata->namespace . '\EntityGeneratorBook', 'getId'), "EntityGeneratorBook::getId() missing."); |
|
272 | - $this->assertTrue(method_exists($metadata->namespace . '\EntityGeneratorBook', 'setName'), "EntityGeneratorBook::setName() missing."); |
|
273 | - $this->assertTrue(method_exists($metadata->namespace . '\EntityGeneratorBook', 'getName'), "EntityGeneratorBook::getName() missing."); |
|
274 | - $this->assertTrue(method_exists($metadata->namespace . '\EntityGeneratorBook', 'setStatus'), "EntityGeneratorBook::setStatus() missing."); |
|
275 | - $this->assertTrue(method_exists($metadata->namespace . '\EntityGeneratorBook', 'getStatus'), "EntityGeneratorBook::getStatus() missing."); |
|
276 | - $this->assertTrue(method_exists($metadata->namespace . '\EntityGeneratorBook', 'setAuthor'), "EntityGeneratorBook::setAuthor() missing."); |
|
277 | - $this->assertTrue(method_exists($metadata->namespace . '\EntityGeneratorBook', 'getAuthor'), "EntityGeneratorBook::getAuthor() missing."); |
|
278 | - $this->assertTrue(method_exists($metadata->namespace . '\EntityGeneratorBook', 'getComments'), "EntityGeneratorBook::getComments() missing."); |
|
279 | - $this->assertTrue(method_exists($metadata->namespace . '\EntityGeneratorBook', 'addComment'), "EntityGeneratorBook::addComment() missing."); |
|
280 | - $this->assertTrue(method_exists($metadata->namespace . '\EntityGeneratorBook', 'removeComment'), "EntityGeneratorBook::removeComment() missing."); |
|
281 | - $this->assertTrue(method_exists($metadata->namespace . '\EntityGeneratorBook', 'setIsbn'), "EntityGeneratorBook::setIsbn() missing."); |
|
282 | - $this->assertTrue(method_exists($metadata->namespace . '\EntityGeneratorBook', 'getIsbn'), "EntityGeneratorBook::getIsbn() missing."); |
|
270 | + $this->assertTrue(method_exists($metadata->namespace.'\EntityGeneratorBook', '__construct'), "EntityGeneratorBook::__construct() missing."); |
|
271 | + $this->assertTrue(method_exists($metadata->namespace.'\EntityGeneratorBook', 'getId'), "EntityGeneratorBook::getId() missing."); |
|
272 | + $this->assertTrue(method_exists($metadata->namespace.'\EntityGeneratorBook', 'setName'), "EntityGeneratorBook::setName() missing."); |
|
273 | + $this->assertTrue(method_exists($metadata->namespace.'\EntityGeneratorBook', 'getName'), "EntityGeneratorBook::getName() missing."); |
|
274 | + $this->assertTrue(method_exists($metadata->namespace.'\EntityGeneratorBook', 'setStatus'), "EntityGeneratorBook::setStatus() missing."); |
|
275 | + $this->assertTrue(method_exists($metadata->namespace.'\EntityGeneratorBook', 'getStatus'), "EntityGeneratorBook::getStatus() missing."); |
|
276 | + $this->assertTrue(method_exists($metadata->namespace.'\EntityGeneratorBook', 'setAuthor'), "EntityGeneratorBook::setAuthor() missing."); |
|
277 | + $this->assertTrue(method_exists($metadata->namespace.'\EntityGeneratorBook', 'getAuthor'), "EntityGeneratorBook::getAuthor() missing."); |
|
278 | + $this->assertTrue(method_exists($metadata->namespace.'\EntityGeneratorBook', 'getComments'), "EntityGeneratorBook::getComments() missing."); |
|
279 | + $this->assertTrue(method_exists($metadata->namespace.'\EntityGeneratorBook', 'addComment'), "EntityGeneratorBook::addComment() missing."); |
|
280 | + $this->assertTrue(method_exists($metadata->namespace.'\EntityGeneratorBook', 'removeComment'), "EntityGeneratorBook::removeComment() missing."); |
|
281 | + $this->assertTrue(method_exists($metadata->namespace.'\EntityGeneratorBook', 'setIsbn'), "EntityGeneratorBook::setIsbn() missing."); |
|
282 | + $this->assertTrue(method_exists($metadata->namespace.'\EntityGeneratorBook', 'getIsbn'), "EntityGeneratorBook::getIsbn() missing."); |
|
283 | 283 | |
284 | 284 | $reflClass = new \ReflectionClass($metadata->name); |
285 | 285 | |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | |
333 | 333 | $this->_generator->writeEntityClass($metadata, $this->_tmpDir); |
334 | 334 | |
335 | - $this->assertFileExists($this->_tmpDir . "/" . $this->_namespace . "/EntityGeneratorBook.php~"); |
|
335 | + $this->assertFileExists($this->_tmpDir."/".$this->_namespace."/EntityGeneratorBook.php~"); |
|
336 | 336 | |
337 | 337 | $book = $this->newInstance($metadata); |
338 | 338 | $reflClass = new \ReflectionClass($metadata->name); |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | // Should not throw a PHP fatal error |
378 | 378 | $this->_generator->writeEntityClass($metadata, $this->_tmpDir); |
379 | 379 | |
380 | - $this->assertFileExists($this->_tmpDir . "/" . $this->_namespace . "/EntityGeneratorBook.php~"); |
|
380 | + $this->assertFileExists($this->_tmpDir."/".$this->_namespace."/EntityGeneratorBook.php~"); |
|
381 | 381 | |
382 | 382 | $this->newInstance($metadata); |
383 | 383 | $reflClass = new \ReflectionClass($metadata->name); |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | $this->assertPhpDocReturnType('\Doctrine\Tests\ORM\Tools\EntityGeneratorAuthor|null', new \ReflectionMethod($book, 'getAuthor')); |
413 | 413 | $this->assertPhpDocParamType('\Doctrine\Tests\ORM\Tools\EntityGeneratorAuthor|null', new \ReflectionMethod($book, 'setAuthor')); |
414 | 414 | |
415 | - $expectedClassName = '\\' . $embeddedMetadata->name; |
|
415 | + $expectedClassName = '\\'.$embeddedMetadata->name; |
|
416 | 416 | $this->assertPhpDocVarType($expectedClassName, new \ReflectionProperty($book, 'isbn')); |
417 | 417 | $this->assertPhpDocReturnType($expectedClassName, new \ReflectionMethod($book, 'getIsbn')); |
418 | 418 | $this->assertPhpDocParamType($expectedClassName, new \ReflectionMethod($book, 'setIsbn')); |
@@ -522,7 +522,7 @@ discard block |
||
522 | 522 | */ |
523 | 523 | public function testMappedSuperclassAnnotationGeneration() |
524 | 524 | { |
525 | - $metadata = new ClassMetadataInfo($this->_namespace . '\EntityGeneratorBook'); |
|
525 | + $metadata = new ClassMetadataInfo($this->_namespace.'\EntityGeneratorBook'); |
|
526 | 526 | $metadata->namespace = $this->_namespace; |
527 | 527 | $metadata->isMappedSuperclass = true; |
528 | 528 | |
@@ -560,7 +560,7 @@ discard block |
||
560 | 560 | */ |
561 | 561 | public function testGenerateEntityWithSequenceGenerator() |
562 | 562 | { |
563 | - $metadata = new ClassMetadataInfo($this->_namespace . '\DDC1784Entity'); |
|
563 | + $metadata = new ClassMetadataInfo($this->_namespace.'\DDC1784Entity'); |
|
564 | 564 | $metadata->namespace = $this->_namespace; |
565 | 565 | $metadata->mapField(['fieldName' => 'id', 'type' => 'integer', 'id' => true]); |
566 | 566 | $metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_SEQUENCE); |
@@ -573,8 +573,8 @@ discard block |
||
573 | 573 | ); |
574 | 574 | $this->_generator->writeEntityClass($metadata, $this->_tmpDir); |
575 | 575 | |
576 | - $filename = $this->_tmpDir . DIRECTORY_SEPARATOR |
|
577 | - . $this->_namespace . DIRECTORY_SEPARATOR . 'DDC1784Entity.php'; |
|
576 | + $filename = $this->_tmpDir.DIRECTORY_SEPARATOR |
|
577 | + . $this->_namespace.DIRECTORY_SEPARATOR.'DDC1784Entity.php'; |
|
578 | 578 | |
579 | 579 | $this->assertFileExists($filename); |
580 | 580 | require_once $filename; |
@@ -594,7 +594,7 @@ discard block |
||
594 | 594 | */ |
595 | 595 | public function testGenerateEntityWithMultipleInverseJoinColumns() |
596 | 596 | { |
597 | - $metadata = new ClassMetadataInfo($this->_namespace . '\DDC2079Entity'); |
|
597 | + $metadata = new ClassMetadataInfo($this->_namespace.'\DDC2079Entity'); |
|
598 | 598 | $metadata->namespace = $this->_namespace; |
599 | 599 | $metadata->mapField(['fieldName' => 'id', 'type' => 'integer', 'id' => true]); |
600 | 600 | $metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_SEQUENCE); |
@@ -605,20 +605,20 @@ discard block |
||
605 | 605 | 'joinTable' => [ |
606 | 606 | 'name' => 'unidade_centro_custo', |
607 | 607 | 'joinColumns' => [ |
608 | - ['name' => 'idorcamento', 'referencedColumnName' => 'idorcamento'], |
|
609 | - ['name' => 'idunidade', 'referencedColumnName' => 'idunidade'] |
|
608 | + ['name' => 'idorcamento', 'referencedColumnName' => 'idorcamento'], |
|
609 | + ['name' => 'idunidade', 'referencedColumnName' => 'idunidade'] |
|
610 | 610 | ], |
611 | 611 | 'inverseJoinColumns' => [ |
612 | - ['name' => 'idcentrocusto', 'referencedColumnName' => 'idcentrocusto'], |
|
613 | - ['name' => 'idpais', 'referencedColumnName' => 'idpais'], |
|
612 | + ['name' => 'idcentrocusto', 'referencedColumnName' => 'idcentrocusto'], |
|
613 | + ['name' => 'idpais', 'referencedColumnName' => 'idpais'], |
|
614 | 614 | ], |
615 | 615 | ], |
616 | 616 | ] |
617 | 617 | ); |
618 | 618 | $this->_generator->writeEntityClass($metadata, $this->_tmpDir); |
619 | 619 | |
620 | - $filename = $this->_tmpDir . DIRECTORY_SEPARATOR |
|
621 | - . $this->_namespace . DIRECTORY_SEPARATOR . 'DDC2079Entity.php'; |
|
620 | + $filename = $this->_tmpDir.DIRECTORY_SEPARATOR |
|
621 | + . $this->_namespace.DIRECTORY_SEPARATOR.'DDC2079Entity.php'; |
|
622 | 622 | |
623 | 623 | $this->assertFileExists($filename); |
624 | 624 | require_once $filename; |
@@ -648,7 +648,7 @@ discard block |
||
648 | 648 | $method->setAccessible(true); |
649 | 649 | |
650 | 650 | foreach ($constants as $name => $value) { |
651 | - if( ! preg_match($pattern, $name)) { |
|
651 | + if ( ! preg_match($pattern, $name)) { |
|
652 | 652 | continue; |
653 | 653 | } |
654 | 654 | |
@@ -677,7 +677,7 @@ discard block |
||
677 | 677 | $method->setAccessible(true); |
678 | 678 | |
679 | 679 | foreach ($constants as $name => $value) { |
680 | - if( ! preg_match($pattern, $name)) { |
|
680 | + if ( ! preg_match($pattern, $name)) { |
|
681 | 681 | continue; |
682 | 682 | } |
683 | 683 | |
@@ -706,7 +706,7 @@ discard block |
||
706 | 706 | $method->setAccessible(true); |
707 | 707 | |
708 | 708 | foreach ($constants as $name => $value) { |
709 | - if( ! preg_match($pattern, $name)) { |
|
709 | + if ( ! preg_match($pattern, $name)) { |
|
710 | 710 | continue; |
711 | 711 | } |
712 | 712 | |
@@ -730,7 +730,7 @@ discard block |
||
730 | 730 | public function testEntityTypeAlias(array $field) |
731 | 731 | { |
732 | 732 | $metadata = $this->generateEntityTypeFixture($field); |
733 | - $path = $this->_tmpDir . '/'. $this->_namespace . '/EntityType.php'; |
|
733 | + $path = $this->_tmpDir.'/'.$this->_namespace.'/EntityType.php'; |
|
734 | 734 | |
735 | 735 | $this->assertFileExists($path); |
736 | 736 | require_once $path; |
@@ -741,8 +741,8 @@ discard block |
||
741 | 741 | $type = $field['phpType']; |
742 | 742 | $name = $field['fieldName']; |
743 | 743 | $value = $field['value']; |
744 | - $getter = "get" . ucfirst($name); |
|
745 | - $setter = "set" . ucfirst($name); |
|
744 | + $getter = "get".ucfirst($name); |
|
745 | + $setter = "set".ucfirst($name); |
|
746 | 746 | |
747 | 747 | $this->assertPhpDocVarType($type, $reflClass->getProperty($name)); |
748 | 748 | $this->assertPhpDocParamType($type, $reflClass->getMethod($setter)); |
@@ -763,13 +763,13 @@ discard block |
||
763 | 763 | |
764 | 764 | $user = new DDC2372User(); |
765 | 765 | $metadata = $cmf->getMetadataFor(get_class($user)); |
766 | - $metadata->name = $this->_namespace . "\DDC2372User"; |
|
766 | + $metadata->name = $this->_namespace."\DDC2372User"; |
|
767 | 767 | $metadata->namespace = $this->_namespace; |
768 | 768 | |
769 | 769 | $this->_generator->writeEntityClass($metadata, $this->_tmpDir); |
770 | 770 | |
771 | - $this->assertFileExists($this->_tmpDir . "/" . $this->_namespace . "/DDC2372User.php"); |
|
772 | - require $this->_tmpDir . "/" . $this->_namespace . "/DDC2372User.php"; |
|
771 | + $this->assertFileExists($this->_tmpDir."/".$this->_namespace."/DDC2372User.php"); |
|
772 | + require $this->_tmpDir."/".$this->_namespace."/DDC2372User.php"; |
|
773 | 773 | |
774 | 774 | $reflClass = new \ReflectionClass($metadata->name); |
775 | 775 | |
@@ -789,13 +789,13 @@ discard block |
||
789 | 789 | |
790 | 790 | $user = new DDC2372Admin(); |
791 | 791 | $metadata = $cmf->getMetadataFor(get_class($user)); |
792 | - $metadata->name = $this->_namespace . "\DDC2372Admin"; |
|
792 | + $metadata->name = $this->_namespace."\DDC2372Admin"; |
|
793 | 793 | $metadata->namespace = $this->_namespace; |
794 | 794 | |
795 | 795 | $this->_generator->writeEntityClass($metadata, $this->_tmpDir); |
796 | 796 | |
797 | - $this->assertFileExists($this->_tmpDir . "/" . $this->_namespace . "/DDC2372Admin.php"); |
|
798 | - require $this->_tmpDir . "/" . $this->_namespace . "/DDC2372Admin.php"; |
|
797 | + $this->assertFileExists($this->_tmpDir."/".$this->_namespace."/DDC2372Admin.php"); |
|
798 | + require $this->_tmpDir."/".$this->_namespace."/DDC2372Admin.php"; |
|
799 | 799 | |
800 | 800 | $reflClass = new \ReflectionClass($metadata->name); |
801 | 801 | |
@@ -815,20 +815,20 @@ discard block |
||
815 | 815 | $cmf->setEntityManager($em); |
816 | 816 | |
817 | 817 | $ns = $this->_namespace; |
818 | - $nsdir = $this->_tmpDir . '/' . $ns; |
|
818 | + $nsdir = $this->_tmpDir.'/'.$ns; |
|
819 | 819 | |
820 | 820 | $content = str_replace( |
821 | 821 | 'namespace Doctrine\Tests\Models\DDC1590', |
822 | - 'namespace ' . $ns, |
|
823 | - file_get_contents(__DIR__ . '/../../Models/DDC1590/DDC1590User.php') |
|
822 | + 'namespace '.$ns, |
|
823 | + file_get_contents(__DIR__.'/../../Models/DDC1590/DDC1590User.php') |
|
824 | 824 | ); |
825 | 825 | |
826 | - $fname = $nsdir . "/DDC1590User.php"; |
|
826 | + $fname = $nsdir."/DDC1590User.php"; |
|
827 | 827 | file_put_contents($fname, $content); |
828 | 828 | require $fname; |
829 | 829 | |
830 | 830 | |
831 | - $metadata = $cmf->getMetadataFor($ns . '\DDC1590User'); |
|
831 | + $metadata = $cmf->getMetadataFor($ns.'\DDC1590User'); |
|
832 | 832 | $this->_generator->writeEntityClass($metadata, $this->_tmpDir); |
833 | 833 | |
834 | 834 | // class DDC1590User extends DDC1590Entity { ... } |
@@ -836,13 +836,13 @@ discard block |
||
836 | 836 | |
837 | 837 | // class _DDC1590User extends DDC1590Entity { ... } |
838 | 838 | $source2 = str_replace('class DDC1590User', 'class _DDC1590User', $source); |
839 | - $fname2 = $nsdir . "/_DDC1590User.php"; |
|
839 | + $fname2 = $nsdir."/_DDC1590User.php"; |
|
840 | 840 | file_put_contents($fname2, $source2); |
841 | 841 | require $fname2; |
842 | 842 | |
843 | 843 | // class __DDC1590User { ... } |
844 | 844 | $source3 = str_replace('class DDC1590User extends DDC1590Entity', 'class __DDC1590User', $source); |
845 | - $fname3 = $nsdir . "/__DDC1590User.php"; |
|
845 | + $fname3 = $nsdir."/__DDC1590User.php"; |
|
846 | 846 | file_put_contents($fname3, $source3); |
847 | 847 | require $fname3; |
848 | 848 | |
@@ -996,7 +996,7 @@ discard block |
||
996 | 996 | $this->loadEntityClass($metadata); |
997 | 997 | |
998 | 998 | $className = basename(str_replace('\\', '/', $metadata->name)); |
999 | - $path = $this->_tmpDir . '/' . $this->_namespace . '/' . $className . '.php'; |
|
999 | + $path = $this->_tmpDir.'/'.$this->_namespace.'/'.$className.'.php'; |
|
1000 | 1000 | $classTest = file_get_contents($path); |
1001 | 1001 | |
1002 | 1002 | $this->_generator->setRegenerateEntityIfExists(true); |
@@ -1005,7 +1005,7 @@ discard block |
||
1005 | 1005 | $this->_generator->writeEntityClass($metadata, $this->_tmpDir); |
1006 | 1006 | $classNew = file_get_contents($path); |
1007 | 1007 | |
1008 | - $this->assertSame($classTest,$classNew); |
|
1008 | + $this->assertSame($classTest, $classNew); |
|
1009 | 1009 | } |
1010 | 1010 | |
1011 | 1011 | public function testGenerateMethodsTypeHinting() |
@@ -1079,19 +1079,19 @@ discard block |
||
1079 | 1079 | $this->_generator->setGenerateMethodsTypeHinting(true); |
1080 | 1080 | |
1081 | 1081 | $metadata = $this->generateEntityTypeFixture($field); |
1082 | - $path = $this->_tmpDir . '/'. $this->_namespace . '/EntityType.php'; |
|
1082 | + $path = $this->_tmpDir.'/'.$this->_namespace.'/EntityType.php'; |
|
1083 | 1083 | |
1084 | 1084 | $this->assertFileExists($path); |
1085 | 1085 | require_once $path; |
1086 | 1086 | |
1087 | - $type = $field['phpType']; |
|
1087 | + $type = $field['phpType']; |
|
1088 | 1088 | if ('\\' === $type[0]) { |
1089 | 1089 | $type = substr($type, 1); |
1090 | 1090 | } |
1091 | 1091 | |
1092 | 1092 | $name = $field['fieldName']; |
1093 | - $getter = "get" . ucfirst($name); |
|
1094 | - $setter = "set" . ucfirst($name); |
|
1093 | + $getter = "get".ucfirst($name); |
|
1094 | + $setter = "set".ucfirst($name); |
|
1095 | 1095 | |
1096 | 1096 | $reflMethod = new \ReflectionMethod($metadata->name, $setter); |
1097 | 1097 | $parameters = $reflMethod->getParameters(); |
@@ -25,13 +25,13 @@ |
||
25 | 25 | $classLoader = new \Doctrine\Common\ClassLoader('Symfony'); |
26 | 26 | $classLoader->register(); |
27 | 27 | |
28 | -$configFile = getcwd() . DIRECTORY_SEPARATOR . 'cli-config.php'; |
|
28 | +$configFile = getcwd().DIRECTORY_SEPARATOR.'cli-config.php'; |
|
29 | 29 | |
30 | 30 | $helperSet = null; |
31 | 31 | if (file_exists($configFile)) { |
32 | 32 | if ( ! is_readable($configFile)) { |
33 | 33 | trigger_error( |
34 | - 'Configuration file [' . $configFile . '] does not have read permission.', E_USER_ERROR |
|
34 | + 'Configuration file ['.$configFile.'] does not have read permission.', E_USER_ERROR |
|
35 | 35 | ); |
36 | 36 | } |
37 | 37 |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | use Doctrine\ORM\Tools\Console\ConsoleRunner; |
22 | 22 | |
23 | 23 | $autoloadFiles = [ |
24 | - __DIR__ . '/../vendor/autoload.php', |
|
25 | - __DIR__ . '/../../../autoload.php' |
|
24 | + __DIR__.'/../vendor/autoload.php', |
|
25 | + __DIR__.'/../../../autoload.php' |
|
26 | 26 | ]; |
27 | 27 | |
28 | 28 | foreach ($autoloadFiles as $autoloadFile) { |
@@ -32,11 +32,11 @@ discard block |
||
32 | 32 | } |
33 | 33 | } |
34 | 34 | |
35 | -$directories = [getcwd(), getcwd() . DIRECTORY_SEPARATOR . 'config']; |
|
35 | +$directories = [getcwd(), getcwd().DIRECTORY_SEPARATOR.'config']; |
|
36 | 36 | |
37 | 37 | $configFile = null; |
38 | 38 | foreach ($directories as $directory) { |
39 | - $configFile = $directory . DIRECTORY_SEPARATOR . 'cli-config.php'; |
|
39 | + $configFile = $directory.DIRECTORY_SEPARATOR.'cli-config.php'; |
|
40 | 40 | |
41 | 41 | if (file_exists($configFile)) { |
42 | 42 | break; |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | } |
50 | 50 | |
51 | 51 | if ( ! is_readable($configFile)) { |
52 | - echo 'Configuration file [' . $configFile . '] does not have read permission.' . "\n"; |
|
52 | + echo 'Configuration file ['.$configFile.'] does not have read permission.'."\n"; |
|
53 | 53 | exit(1); |
54 | 54 | } |
55 | 55 |
@@ -787,7 +787,12 @@ |
||
787 | 787 | $queries = ""; |
788 | 788 | $last25queries = array_slice(array_reverse($this->_sqlLoggerStack->queries, true), 0, 25, true); |
789 | 789 | foreach ($last25queries as $i => $query) { |
790 | - $params = array_map(function($p) { if (is_object($p)) return get_class($p); else return var_export($p, true); }, $query['params'] ?: [] |
|
790 | + $params = array_map(function($p) { if (is_object($p)) { |
|
791 | + return get_class($p); |
|
792 | + } else { |
|
793 | + return var_export($p, true); |
|
794 | + } |
|
795 | + }, $query['params'] ?: [] |
|
791 | 796 | ); |
792 | 797 | $queries .= $i.". SQL: '".$query['sql']."' Params: ".implode(", ", $params).PHP_EOL; |
793 | 798 | } |
@@ -5,7 +5,6 @@ |
||
5 | 5 | use Doctrine\Common\Cache\ArrayCache; |
6 | 6 | use Doctrine\Common\Persistence\Mapping\Driver\MappingDriver; |
7 | 7 | use Doctrine\DBAL\Driver\Connection; |
8 | -use Doctrine\DBAL\Driver\PDOSqlite\Driver as SqliteDriver; |
|
9 | 8 | use Doctrine\DBAL\Logging\DebugStack; |
10 | 9 | use Doctrine\DBAL\Types\Type; |
11 | 10 | use Doctrine\ORM\Cache\CacheConfiguration; |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | $conn->executeUpdate('DELETE FROM RoutingLocation'); |
401 | 401 | } |
402 | 402 | |
403 | - if(isset($this->_usedModelSets['navigation'])) { |
|
403 | + if (isset($this->_usedModelSets['navigation'])) { |
|
404 | 404 | $conn->executeUpdate('DELETE FROM navigation_tour_pois'); |
405 | 405 | $conn->executeUpdate('DELETE FROM navigation_photos'); |
406 | 406 | $conn->executeUpdate('DELETE FROM navigation_pois'); |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | $conn->executeUpdate('DELETE FROM navigation_countries'); |
409 | 409 | } |
410 | 410 | if (isset($this->_usedModelSets['directorytree'])) { |
411 | - $conn->executeUpdate('DELETE FROM ' . $platform->quoteIdentifier("file")); |
|
411 | + $conn->executeUpdate('DELETE FROM '.$platform->quoteIdentifier("file")); |
|
412 | 412 | // MySQL doesn't know deferred deletions therefore only executing the second query gives errors. |
413 | 413 | $conn->executeUpdate('DELETE FROM Directory WHERE parentDirectory_id IS NOT NULL'); |
414 | 414 | $conn->executeUpdate('DELETE FROM Directory'); |
@@ -503,12 +503,12 @@ discard block |
||
503 | 503 | ) |
504 | 504 | ); |
505 | 505 | |
506 | - $conn->executeUpdate('DELETE FROM ' . $platform->quoteIdentifier('quote-users-groups')); |
|
507 | - $conn->executeUpdate('DELETE FROM ' . $platform->quoteIdentifier('quote-group')); |
|
508 | - $conn->executeUpdate('DELETE FROM ' . $platform->quoteIdentifier('quote-phone')); |
|
509 | - $conn->executeUpdate('DELETE FROM ' . $platform->quoteIdentifier('quote-user')); |
|
510 | - $conn->executeUpdate('DELETE FROM ' . $platform->quoteIdentifier('quote-address')); |
|
511 | - $conn->executeUpdate('DELETE FROM ' . $platform->quoteIdentifier('quote-city')); |
|
506 | + $conn->executeUpdate('DELETE FROM '.$platform->quoteIdentifier('quote-users-groups')); |
|
507 | + $conn->executeUpdate('DELETE FROM '.$platform->quoteIdentifier('quote-group')); |
|
508 | + $conn->executeUpdate('DELETE FROM '.$platform->quoteIdentifier('quote-phone')); |
|
509 | + $conn->executeUpdate('DELETE FROM '.$platform->quoteIdentifier('quote-user')); |
|
510 | + $conn->executeUpdate('DELETE FROM '.$platform->quoteIdentifier('quote-address')); |
|
511 | + $conn->executeUpdate('DELETE FROM '.$platform->quoteIdentifier('quote-city')); |
|
512 | 512 | } |
513 | 513 | |
514 | 514 | if (isset($this->_usedModelSets['vct_onetoone'])) { |
@@ -647,9 +647,9 @@ discard block |
||
647 | 647 | |
648 | 648 | if (isset($GLOBALS['DOCTRINE_MARK_SQL_LOGS'])) { |
649 | 649 | if (in_array(static::$_sharedConn->getDatabasePlatform()->getName(), ["mysql", "postgresql"])) { |
650 | - static::$_sharedConn->executeQuery('SELECT 1 /*' . get_class($this) . '*/'); |
|
650 | + static::$_sharedConn->executeQuery('SELECT 1 /*'.get_class($this).'*/'); |
|
651 | 651 | } else if (static::$_sharedConn->getDatabasePlatform()->getName() == "oracle") { |
652 | - static::$_sharedConn->executeQuery('SELECT 1 /*' . get_class($this) . '*/ FROM dual'); |
|
652 | + static::$_sharedConn->executeQuery('SELECT 1 /*'.get_class($this).'*/ FROM dual'); |
|
653 | 653 | } |
654 | 654 | } |
655 | 655 | |
@@ -711,7 +711,7 @@ discard block |
||
711 | 711 | $config = new Configuration(); |
712 | 712 | $config->setMetadataCacheImpl(self::$_metadataCacheImpl); |
713 | 713 | $config->setQueryCacheImpl(self::$_queryCacheImpl); |
714 | - $config->setProxyDir(__DIR__ . '/Proxies'); |
|
714 | + $config->setProxyDir(__DIR__.'/Proxies'); |
|
715 | 715 | $config->setProxyNamespace('Doctrine\Tests\Proxies'); |
716 | 716 | |
717 | 717 | if (null !== $this->resultCacheImpl) { |
@@ -743,8 +743,8 @@ discard block |
||
743 | 743 | $config->setMetadataDriverImpl( |
744 | 744 | $mappingDriver ?? $config->newDefaultAnnotationDriver( |
745 | 745 | [ |
746 | - realpath(__DIR__ . '/Models/Cache'), |
|
747 | - realpath(__DIR__ . '/Models/GeoNames') |
|
746 | + realpath(__DIR__.'/Models/Cache'), |
|
747 | + realpath(__DIR__.'/Models/GeoNames') |
|
748 | 748 | ], |
749 | 749 | true |
750 | 750 | ) |
@@ -792,7 +792,7 @@ discard block |
||
792 | 792 | throw $e; |
793 | 793 | } |
794 | 794 | |
795 | - if(isset($this->_sqlLoggerStack->queries) && count($this->_sqlLoggerStack->queries)) { |
|
795 | + if (isset($this->_sqlLoggerStack->queries) && count($this->_sqlLoggerStack->queries)) { |
|
796 | 796 | $queries = ""; |
797 | 797 | $last25queries = array_slice(array_reverse($this->_sqlLoggerStack->queries, true), 0, 25, true); |
798 | 798 | foreach ($last25queries as $i => $query) { |
@@ -803,9 +803,9 @@ discard block |
||
803 | 803 | |
804 | 804 | $trace = $e->getTrace(); |
805 | 805 | $traceMsg = ""; |
806 | - foreach($trace AS $part) { |
|
807 | - if(isset($part['file'])) { |
|
808 | - if(strpos($part['file'], "PHPUnit/") !== false) { |
|
806 | + foreach ($trace AS $part) { |
|
807 | + if (isset($part['file'])) { |
|
808 | + if (strpos($part['file'], "PHPUnit/") !== false) { |
|
809 | 809 | // Beginning with PHPUnit files we don't print the trace anymore. |
810 | 810 | break; |
811 | 811 | } |
@@ -816,7 +816,7 @@ discard block |
||
816 | 816 | |
817 | 817 | $message = "[".get_class($e)."] ".$e->getMessage().PHP_EOL.PHP_EOL."With queries:".PHP_EOL.$queries.PHP_EOL."Trace:".PHP_EOL.$traceMsg; |
818 | 818 | |
819 | - throw new \Exception($message, (int)$e->getCode(), $e); |
|
819 | + throw new \Exception($message, (int) $e->getCode(), $e); |
|
820 | 820 | } |
821 | 821 | throw $e; |
822 | 822 | } |
@@ -821,6 +821,9 @@ |
||
821 | 821 | throw $e; |
822 | 822 | } |
823 | 823 | |
824 | + /** |
|
825 | + * @param string $expectedSql |
|
826 | + */ |
|
824 | 827 | public function assertSQLEquals($expectedSql, $actualSql) |
825 | 828 | { |
826 | 829 | return $this->assertEquals(strtolower($expectedSql), strtolower($actualSql), "Lowercase comparison of SQL statements failed."); |
@@ -7,21 +7,21 @@ |
||
7 | 7 | error_reporting(E_ALL | E_STRICT); |
8 | 8 | date_default_timezone_set('UTC'); |
9 | 9 | |
10 | -if (file_exists(__DIR__ . '/../../../vendor/autoload.php')) { |
|
10 | +if (file_exists(__DIR__.'/../../../vendor/autoload.php')) { |
|
11 | 11 | // dependencies were installed via composer - this is the main project |
12 | - require __DIR__ . '/../../../vendor/autoload.php'; |
|
13 | -} elseif (file_exists(__DIR__ . '/../../../../../autoload.php')) { |
|
12 | + require __DIR__.'/../../../vendor/autoload.php'; |
|
13 | +} elseif (file_exists(__DIR__.'/../../../../../autoload.php')) { |
|
14 | 14 | // installed as a dependency in `vendor` |
15 | - require __DIR__ . '/../../../../../autoload.php'; |
|
15 | + require __DIR__.'/../../../../../autoload.php'; |
|
16 | 16 | } else { |
17 | 17 | throw new \Exception('Can\'t find autoload.php. Did you install dependencies via composer?'); |
18 | 18 | } |
19 | 19 | |
20 | -if ( ! file_exists(__DIR__ . '/Proxies') && ! mkdir(__DIR__ . '/Proxies')) { |
|
21 | - throw new \Exception("Could not create " . __DIR__."/Proxies Folder."); |
|
20 | +if ( ! file_exists(__DIR__.'/Proxies') && ! mkdir(__DIR__.'/Proxies')) { |
|
21 | + throw new \Exception("Could not create ".__DIR__."/Proxies Folder."); |
|
22 | 22 | } |
23 | 23 | |
24 | -if ( ! file_exists(__DIR__ . '/ORM/Proxy/generated') && ! mkdir(__DIR__ . '/ORM/Proxy/generated')) { |
|
25 | - throw new \Exception('Could not create ' . __DIR__ . '/ORM/Proxy/generated Folder.'); |
|
24 | +if ( ! file_exists(__DIR__.'/ORM/Proxy/generated') && ! mkdir(__DIR__.'/ORM/Proxy/generated')) { |
|
25 | + throw new \Exception('Could not create '.__DIR__.'/ORM/Proxy/generated Folder.'); |
|
26 | 26 | } |
27 | 27 |
@@ -46,7 +46,9 @@ |
||
46 | 46 | public function fetchColumn($columnNumber = 0) |
47 | 47 | { |
48 | 48 | $row = current($this->_resultSet); |
49 | - if ( ! is_array($row)) return false; |
|
49 | + if ( ! is_array($row)) { |
|
50 | + return false; |
|
51 | + } |
|
50 | 52 | $val = array_shift($row); |
51 | 53 | return $val !== null ? $val : false; |
52 | 54 | } |
@@ -95,7 +95,7 @@ |
||
95 | 95 | public function quote($input, $type = null) |
96 | 96 | { |
97 | 97 | if (is_string($input)) { |
98 | - return "'" . $input . "'"; |
|
98 | + return "'".$input."'"; |
|
99 | 99 | } |
100 | 100 | return $input; |
101 | 101 | } |
@@ -35,7 +35,7 @@ |
||
35 | 35 | /** |
36 | 36 | * {@inheritdoc} |
37 | 37 | */ |
38 | - public function errorInfo(){} |
|
38 | + public function errorInfo() {} |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * {@inheritdoc} |
@@ -49,7 +49,7 @@ |
||
49 | 49 | /** |
50 | 50 | * {@inheritdoc} |
51 | 51 | */ |
52 | - public function quote($input, $type=\PDO::PARAM_STR) |
|
52 | + public function quote($input, $type = \PDO::PARAM_STR) |
|
53 | 53 | { |
54 | 54 | } |
55 | 55 |