Passed
Push — master ( 9e6266...33fd51 )
by Jonathan
33s
created
lib/Doctrine/Common/Persistence/PersistentObject.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
     public function injectObjectManager(ObjectManager $objectManager, ClassMetadata $classMetadata)
76 76
     {
77 77
         if ($objectManager !== self::$objectManager) {
78
-            throw new \RuntimeException('Trying to use PersistentObject with different ObjectManager instances. ' .
78
+            throw new \RuntimeException('Trying to use PersistentObject with different ObjectManager instances. '.
79 79
                 'Was PersistentObject::setObjectManager() called?');
80 80
         }
81 81
 
@@ -95,17 +95,17 @@  discard block
 block discarded – undo
95 95
      */
96 96
     private function set($field, $args)
97 97
     {
98
-        if ($this->cm->hasField($field) && ! $this->cm->isIdentifier($field)) {
98
+        if ($this->cm->hasField($field) && !$this->cm->isIdentifier($field)) {
99 99
             $this->$field = $args[0];
100 100
         } elseif ($this->cm->hasAssociation($field) && $this->cm->isSingleValuedAssociation($field)) {
101 101
             $targetClass = $this->cm->getAssociationTargetClass($field);
102
-            if (! ($args[0] instanceof $targetClass) && $args[0] !== null) {
103
-                throw new \InvalidArgumentException("Expected persistent object of type '" . $targetClass . "'");
102
+            if (!($args[0] instanceof $targetClass) && $args[0] !== null) {
103
+                throw new \InvalidArgumentException("Expected persistent object of type '".$targetClass."'");
104 104
             }
105 105
             $this->$field = $args[0];
106 106
             $this->completeOwningSide($field, $targetClass, $args[0]);
107 107
         } else {
108
-            throw new \BadMethodCallException("no field with name '" . $field . "' exists on '" . $this->cm->getName() . "'");
108
+            throw new \BadMethodCallException("no field with name '".$field."' exists on '".$this->cm->getName()."'");
109 109
         }
110 110
     }
111 111
 
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
             return $this->$field;
125 125
         }
126 126
 
127
-        throw new \BadMethodCallException("no field with name '" . $field . "' exists on '" . $this->cm->getName() . "'");
127
+        throw new \BadMethodCallException("no field with name '".$field."' exists on '".$this->cm->getName()."'");
128 128
     }
129 129
 
130 130
     /**
@@ -140,14 +140,14 @@  discard block
 block discarded – undo
140 140
     {
141 141
         // add this object on the owning side as well, for obvious infinite recursion
142 142
         // reasons this is only done when called on the inverse side.
143
-        if (! $this->cm->isAssociationInverseSide($field)) {
143
+        if (!$this->cm->isAssociationInverseSide($field)) {
144 144
             return;
145 145
         }
146 146
 
147 147
         $mappedByField  = $this->cm->getAssociationMappedByTargetField($field);
148 148
         $targetMetadata = self::$objectManager->getClassMetadata($targetClass);
149 149
 
150
-        $setter = ($targetMetadata->isCollectionValuedAssociation($mappedByField) ? 'add' : 'set') . $mappedByField;
150
+        $setter = ($targetMetadata->isCollectionValuedAssociation($mappedByField) ? 'add' : 'set').$mappedByField;
151 151
         $targetObject->$setter($this);
152 152
     }
153 153
 
@@ -164,15 +164,15 @@  discard block
 block discarded – undo
164 164
      */
165 165
     private function add($field, $args)
166 166
     {
167
-        if (! $this->cm->hasAssociation($field) || ! $this->cm->isCollectionValuedAssociation($field)) {
168
-            throw new \BadMethodCallException('There is no method add' . $field . '() on ' . $this->cm->getName());
167
+        if (!$this->cm->hasAssociation($field) || !$this->cm->isCollectionValuedAssociation($field)) {
168
+            throw new \BadMethodCallException('There is no method add'.$field.'() on '.$this->cm->getName());
169 169
         }
170 170
 
171 171
         $targetClass = $this->cm->getAssociationTargetClass($field);
172
-        if (! ($args[0] instanceof $targetClass)) {
173
-            throw new \InvalidArgumentException("Expected persistent object of type '" . $targetClass . "'");
172
+        if (!($args[0] instanceof $targetClass)) {
173
+            throw new \InvalidArgumentException("Expected persistent object of type '".$targetClass."'");
174 174
         }
175
-        if (! ($this->$field instanceof Collection)) {
175
+        if (!($this->$field instanceof Collection)) {
176 176
             $this->$field = new ArrayCollection($this->$field ?: []);
177 177
         }
178 178
         $this->$field->add($args[0]);
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
             return;
193 193
         }
194 194
 
195
-        if (! self::$objectManager) {
195
+        if (!self::$objectManager) {
196 196
             throw new \RuntimeException('No runtime object manager set. Call PersistentObject#setObjectManager().');
197 197
         }
198 198
 
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
         } elseif ($command === 'add') {
223 223
             $this->add($field, $args);
224 224
         } else {
225
-            throw new \BadMethodCallException('There is no method ' . $method . ' on ' . $this->cm->getName());
225
+            throw new \BadMethodCallException('There is no method '.$method.' on '.$this->cm->getName());
226 226
         }
227 227
     }
228 228
 }
Please login to merge, or discard this patch.
lib/Doctrine/Common/Persistence/AbstractManagerRegistry.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
             $name = $this->defaultConnection;
90 90
         }
91 91
 
92
-        if (! isset($this->connections[$name])) {
92
+        if (!isset($this->connections[$name])) {
93 93
             throw new \InvalidArgumentException(sprintf('Doctrine %s Connection named "%s" does not exist.', $this->name, $name));
94 94
         }
95 95
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
             $name = $this->defaultManager;
145 145
         }
146 146
 
147
-        if (! isset($this->managers[$name])) {
147
+        if (!isset($this->managers[$name])) {
148 148
             throw new \InvalidArgumentException(sprintf('Doctrine %s Manager named "%s" does not exist.', $this->name, $name));
149 149
         }
150 150
 
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
         // Check for namespace alias
160 160
         if (strpos($class, ':') !== false) {
161 161
             list($namespaceAlias, $simpleClassName) = explode(':', $class, 2);
162
-            $class                                  = $this->getAliasNamespace($namespaceAlias) . '\\' . $simpleClassName;
162
+            $class                                  = $this->getAliasNamespace($namespaceAlias).'\\'.$simpleClassName;
163 163
         }
164 164
 
165 165
         $proxyClass = new \ReflectionClass($class);
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
         if ($proxyClass->implementsInterface($this->proxyInterfaceName)) {
168 168
             $parentClass = $proxyClass->getParentClass();
169 169
 
170
-            if (! $parentClass) {
170
+            if (!$parentClass) {
171 171
                 return null;
172 172
             }
173 173
 
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
         foreach ($this->managers as $id) {
178 178
             $manager = $this->getService($id);
179 179
 
180
-            if (! $manager->getMetadataFactory()->isTransient($class)) {
180
+            if (!$manager->getMetadataFactory()->isTransient($class)) {
181 181
                 return $manager;
182 182
             }
183 183
         }
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
             $name = $this->defaultManager;
222 222
         }
223 223
 
224
-        if (! isset($this->managers[$name])) {
224
+        if (!isset($this->managers[$name])) {
225 225
             throw new \InvalidArgumentException(sprintf('Doctrine %s Manager named "%s" does not exist.', $this->name, $name));
226 226
         }
227 227
 
Please login to merge, or discard this patch.
lib/Doctrine/Common/Persistence/Mapping/RuntimeReflectionService.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
      */
20 20
     public function getParentClasses($class)
21 21
     {
22
-        if (! class_exists($class)) {
22
+        if (!class_exists($class)) {
23 23
             throw MappingException::nonExistingClass($class);
24 24
         }
25 25
 
Please login to merge, or discard this patch.
lib/Doctrine/Common/Persistence/Mapping/MappingException.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
      */
30 30
     public static function pathRequired()
31 31
     {
32
-        return new self('Specifying the paths to your entities is required ' .
32
+        return new self('Specifying the paths to your entities is required '.
33 33
             'in the AnnotationDriver to retrieve all class names.');
34 34
     }
35 35
 
@@ -40,12 +40,12 @@  discard block
 block discarded – undo
40 40
      */
41 41
     public static function fileMappingDriversRequireConfiguredDirectoryPath($path = null)
42 42
     {
43
-        if (! empty($path)) {
44
-            $path = '[' . $path . ']';
43
+        if (!empty($path)) {
44
+            $path = '['.$path.']';
45 45
         }
46 46
 
47 47
         return new self(sprintf(
48
-            'File mapping drivers must have a valid directory path, ' .
48
+            'File mapping drivers must have a valid directory path, '.
49 49
             'however the given path %s seems to be incorrect!',
50 50
             $path
51 51
         ));
Please login to merge, or discard this patch.
lib/Doctrine/Common/Persistence/Mapping/Driver/AnnotationDriver.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
     public function __construct($reader, $paths = null)
74 74
     {
75 75
         $this->reader = $reader;
76
-        if (! $paths) {
76
+        if (!$paths) {
77 77
             return;
78 78
         }
79 79
 
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
             return $this->classNames;
187 187
         }
188 188
 
189
-        if (! $this->paths) {
189
+        if (!$this->paths) {
190 190
             throw MappingException::pathRequired();
191 191
         }
192 192
 
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
         $includedFiles = [];
195 195
 
196 196
         foreach ($this->paths as $path) {
197
-            if (! is_dir($path)) {
197
+            if (!is_dir($path)) {
198 198
                 throw MappingException::fileMappingDriversRequireConfiguredDirectoryPath($path);
199 199
             }
200 200
 
@@ -203,14 +203,14 @@  discard block
 block discarded – undo
203 203
                     new \RecursiveDirectoryIterator($path, \FilesystemIterator::SKIP_DOTS),
204 204
                     \RecursiveIteratorIterator::LEAVES_ONLY
205 205
                 ),
206
-                '/^.+' . preg_quote($this->fileExtension) . '$/i',
206
+                '/^.+'.preg_quote($this->fileExtension).'$/i',
207 207
                 \RecursiveRegexIterator::GET_MATCH
208 208
             );
209 209
 
210 210
             foreach ($iterator as $file) {
211 211
                 $sourceFile = $file[0];
212 212
 
213
-                if (! preg_match('(^phar:)i', $sourceFile)) {
213
+                if (!preg_match('(^phar:)i', $sourceFile)) {
214 214
                     $sourceFile = realpath($sourceFile);
215 215
                 }
216 216
 
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
         foreach ($declared as $className) {
235 235
             $rc         = new \ReflectionClass($className);
236 236
             $sourceFile = $rc->getFileName();
237
-            if (! in_array($sourceFile, $includedFiles) || $this->isTransient($className)) {
237
+            if (!in_array($sourceFile, $includedFiles) || $this->isTransient($className)) {
238 238
                 continue;
239 239
             }
240 240
 
Please login to merge, or discard this patch.
lib/Doctrine/Common/Persistence/Mapping/Driver/StaticPHPDriver.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
             return $this->classNames;
74 74
         }
75 75
 
76
-        if (! $this->paths) {
76
+        if (!$this->paths) {
77 77
             throw MappingException::pathRequired();
78 78
         }
79 79
 
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
         $includedFiles = [];
82 82
 
83 83
         foreach ($this->paths as $path) {
84
-            if (! is_dir($path)) {
84
+            if (!is_dir($path)) {
85 85
                 throw MappingException::fileMappingDriversRequireConfiguredDirectoryPath($path);
86 86
             }
87 87
 
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
         foreach ($declared as $className) {
107 107
             $rc         = new \ReflectionClass($className);
108 108
             $sourceFile = $rc->getFileName();
109
-            if (! in_array($sourceFile, $includedFiles) || $this->isTransient($className)) {
109
+            if (!in_array($sourceFile, $includedFiles) || $this->isTransient($className)) {
110 110
                 continue;
111 111
             }
112 112
 
@@ -123,6 +123,6 @@  discard block
 block discarded – undo
123 123
      */
124 124
     public function isTransient($className)
125 125
     {
126
-        return ! method_exists($className, 'loadMetadata');
126
+        return !method_exists($className, 'loadMetadata');
127 127
     }
128 128
 }
Please login to merge, or discard this patch.
lib/Doctrine/Common/Persistence/Mapping/Driver/FileDriver.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
         }
91 91
 
92 92
         $result = $this->loadMappingFile($this->locator->findMappingFile($className));
93
-        if (! isset($result[$className])) {
94
-            throw MappingException::invalidMappingFile($className, str_replace('\\', '.', $className) . $this->locator->getFileExtension());
93
+        if (!isset($result[$className])) {
94
+            throw MappingException::invalidMappingFile($className, str_replace('\\', '.', $className).$this->locator->getFileExtension());
95 95
         }
96 96
 
97 97
         $this->classCache[$className] = $result[$className];
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
             return false;
113 113
         }
114 114
 
115
-        return ! $this->locator->fileExists($className);
115
+        return !$this->locator->fileExists($className);
116 116
     }
117 117
 
118 118
     /**
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
             $this->initialize();
125 125
         }
126 126
 
127
-        if (! $this->classCache) {
127
+        if (!$this->classCache) {
128 128
             return (array) $this->locator->getAllClassNames($this->globalBasename);
129 129
         }
130 130
 
@@ -163,8 +163,8 @@  discard block
 block discarded – undo
163 163
         }
164 164
 
165 165
         foreach ($this->locator->getPaths() as $path) {
166
-            $file = $path . '/' . $this->globalBasename . $this->locator->getFileExtension();
167
-            if (! is_file($file)) {
166
+            $file = $path.'/'.$this->globalBasename.$this->locator->getFileExtension();
167
+            if (!is_file($file)) {
168 168
                 continue;
169 169
             }
170 170
 
Please login to merge, or discard this patch.
lib/Doctrine/Common/Persistence/Mapping/Driver/DefaultFileLocator.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -94,12 +94,12 @@  discard block
 block discarded – undo
94 94
      */
95 95
     public function findMappingFile($className)
96 96
     {
97
-        $fileName = str_replace('\\', '.', $className) . $this->fileExtension;
97
+        $fileName = str_replace('\\', '.', $className).$this->fileExtension;
98 98
 
99 99
         // Check whether file exists
100 100
         foreach ($this->paths as $path) {
101
-            if (is_file($path . DIRECTORY_SEPARATOR . $fileName)) {
102
-                return $path . DIRECTORY_SEPARATOR . $fileName;
101
+            if (is_file($path.DIRECTORY_SEPARATOR.$fileName)) {
102
+                return $path.DIRECTORY_SEPARATOR.$fileName;
103 103
             }
104 104
         }
105 105
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 
116 116
         if ($this->paths) {
117 117
             foreach ($this->paths as $path) {
118
-                if (! is_dir($path)) {
118
+                if (!is_dir($path)) {
119 119
                     throw MappingException::fileMappingDriversRequireConfiguredDirectoryPath($path);
120 120
                 }
121 121
 
@@ -145,11 +145,11 @@  discard block
 block discarded – undo
145 145
      */
146 146
     public function fileExists($className)
147 147
     {
148
-        $fileName = str_replace('\\', '.', $className) . $this->fileExtension;
148
+        $fileName = str_replace('\\', '.', $className).$this->fileExtension;
149 149
 
150 150
         // Check whether file exists
151 151
         foreach ((array) $this->paths as $path) {
152
-            if (is_file($path . DIRECTORY_SEPARATOR . $fileName)) {
152
+            if (is_file($path.DIRECTORY_SEPARATOR.$fileName)) {
153 153
                 return true;
154 154
             }
155 155
         }
Please login to merge, or discard this patch.
lib/Doctrine/Common/Persistence/Mapping/Driver/SymfonyFileLocator.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -124,11 +124,11 @@  discard block
 block discarded – undo
124 124
      */
125 125
     public function fileExists($className)
126 126
     {
127
-        $defaultFileName = str_replace('\\', $this->nsSeparator, $className) . $this->fileExtension;
127
+        $defaultFileName = str_replace('\\', $this->nsSeparator, $className).$this->fileExtension;
128 128
         foreach ($this->paths as $path) {
129
-            if (! isset($this->prefixes[$path])) {
129
+            if (!isset($this->prefixes[$path])) {
130 130
                 // global namespace class
131
-                if (is_file($path . DIRECTORY_SEPARATOR . $defaultFileName)) {
131
+                if (is_file($path.DIRECTORY_SEPARATOR.$defaultFileName)) {
132 132
                     return true;
133 133
                 }
134 134
 
@@ -137,11 +137,11 @@  discard block
 block discarded – undo
137 137
 
138 138
             $prefix = $this->prefixes[$path];
139 139
 
140
-            if (strpos($className, $prefix . '\\') !== 0) {
140
+            if (strpos($className, $prefix.'\\') !== 0) {
141 141
                 continue;
142 142
             }
143 143
 
144
-            $filename = $path . '/' . strtr(substr($className, strlen($prefix) + 1), '\\', $this->nsSeparator) . $this->fileExtension;
144
+            $filename = $path.'/'.strtr(substr($className, strlen($prefix) + 1), '\\', $this->nsSeparator).$this->fileExtension;
145 145
             if (is_file($filename)) {
146 146
                 return true;
147 147
             }
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 
160 160
         if ($this->paths) {
161 161
             foreach ((array) $this->paths as $path) {
162
-                if (! is_dir($path)) {
162
+                if (!is_dir($path)) {
163 163
                     throw MappingException::fileMappingDriversRequireConfiguredDirectoryPath($path);
164 164
                 }
165 165
 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
                             '\\'
185 185
                         );
186 186
 
187
-                        $classes[] = $this->prefixes[$path] . str_replace(DIRECTORY_SEPARATOR, '\\', $nsSuffix) . '\\' . str_replace($this->nsSeparator, '\\', $fileName);
187
+                        $classes[] = $this->prefixes[$path].str_replace(DIRECTORY_SEPARATOR, '\\', $nsSuffix).'\\'.str_replace($this->nsSeparator, '\\', $fileName);
188 188
                     } else {
189 189
                         $classes[] = str_replace($this->nsSeparator, '\\', $fileName);
190 190
                     }
@@ -200,11 +200,11 @@  discard block
 block discarded – undo
200 200
      */
201 201
     public function findMappingFile($className)
202 202
     {
203
-        $defaultFileName = str_replace('\\', $this->nsSeparator, $className) . $this->fileExtension;
203
+        $defaultFileName = str_replace('\\', $this->nsSeparator, $className).$this->fileExtension;
204 204
         foreach ($this->paths as $path) {
205
-            if (! isset($this->prefixes[$path])) {
206
-                if (is_file($path . DIRECTORY_SEPARATOR . $defaultFileName)) {
207
-                    return $path . DIRECTORY_SEPARATOR . $defaultFileName;
205
+            if (!isset($this->prefixes[$path])) {
206
+                if (is_file($path.DIRECTORY_SEPARATOR.$defaultFileName)) {
207
+                    return $path.DIRECTORY_SEPARATOR.$defaultFileName;
208 208
                 }
209 209
 
210 210
                 continue;
@@ -212,16 +212,16 @@  discard block
 block discarded – undo
212 212
 
213 213
             $prefix = $this->prefixes[$path];
214 214
 
215
-            if (strpos($className, $prefix . '\\') !== 0) {
215
+            if (strpos($className, $prefix.'\\') !== 0) {
216 216
                 continue;
217 217
             }
218 218
 
219
-            $filename = $path . '/' . strtr(substr($className, strlen($prefix) + 1), '\\', $this->nsSeparator) . $this->fileExtension;
219
+            $filename = $path.'/'.strtr(substr($className, strlen($prefix) + 1), '\\', $this->nsSeparator).$this->fileExtension;
220 220
             if (is_file($filename)) {
221 221
                 return $filename;
222 222
             }
223 223
         }
224 224
 
225
-        throw MappingException::mappingFileNotFound($className, substr($className, strrpos($className, '\\') + 1) . $this->fileExtension);
225
+        throw MappingException::mappingFileNotFound($className, substr($className, strrpos($className, '\\') + 1).$this->fileExtension);
226 226
     }
227 227
 }
Please login to merge, or discard this patch.