@@ -16,12 +16,12 @@ |
||
16 | 16 | error_reporting(E_ALL | E_STRICT); |
17 | 17 | |
18 | 18 | // register silently failing autoloader |
19 | -spl_autoload_register(static function ($class) { |
|
19 | +spl_autoload_register(static function($class) { |
|
20 | 20 | if (strpos($class, 'Doctrine\Tests\\') !== 0) { |
21 | 21 | return; |
22 | 22 | } |
23 | 23 | |
24 | - $path = __DIR__ . '/../../' . strtr($class, '\\', '/') . '.php'; |
|
24 | + $path = __DIR__.'/../../'.strtr($class, '\\', '/').'.php'; |
|
25 | 25 | if (is_file($path) && is_readable($path)) { |
26 | 26 | require_once $path; |
27 | 27 |
@@ -124,11 +124,11 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | return $this->classNames; |
75 | 75 | } |
76 | 76 | |
77 | - if (! $this->paths) { |
|
77 | + if (!$this->paths) { |
|
78 | 78 | throw MappingException::pathRequired(); |
79 | 79 | } |
80 | 80 | |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | $includedFiles = []; |
83 | 83 | |
84 | 84 | foreach ($this->paths as $path) { |
85 | - if (! is_dir($path)) { |
|
85 | + if (!is_dir($path)) { |
|
86 | 86 | throw MappingException::fileMappingDriversRequireConfiguredDirectoryPath($path); |
87 | 87 | } |
88 | 88 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | foreach ($declared as $className) { |
108 | 108 | $rc = new ReflectionClass($className); |
109 | 109 | $sourceFile = $rc->getFileName(); |
110 | - if (! in_array($sourceFile, $includedFiles) || $this->isTransient($className)) { |
|
110 | + if (!in_array($sourceFile, $includedFiles) || $this->isTransient($className)) { |
|
111 | 111 | continue; |
112 | 112 | } |
113 | 113 | |
@@ -124,6 +124,6 @@ discard block |
||
124 | 124 | */ |
125 | 125 | public function isTransient($className) |
126 | 126 | { |
127 | - return ! method_exists($className, 'loadMetadata'); |
|
127 | + return !method_exists($className, 'loadMetadata'); |
|
128 | 128 | } |
129 | 129 | } |
@@ -93,7 +93,7 @@ |
||
93 | 93 | foreach ($this->drivers as $namespace => $driver) { |
94 | 94 | $oid = spl_object_hash($driver); |
95 | 95 | |
96 | - if (! isset($driverClasses[$oid])) { |
|
96 | + if (!isset($driverClasses[$oid])) { |
|
97 | 97 | $driverClasses[$oid] = $driver->getAllClassNames(); |
98 | 98 | } |
99 | 99 |
@@ -94,12 +94,12 @@ discard block |
||
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 |
||
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 |
||
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 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | public function __construct($reader, $paths = null) |
80 | 80 | { |
81 | 81 | $this->reader = $reader; |
82 | - if (! $paths) { |
|
82 | + if (!$paths) { |
|
83 | 83 | return; |
84 | 84 | } |
85 | 85 | |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | return $this->classNames; |
193 | 193 | } |
194 | 194 | |
195 | - if (! $this->paths) { |
|
195 | + if (!$this->paths) { |
|
196 | 196 | throw MappingException::pathRequired(); |
197 | 197 | } |
198 | 198 | |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | $includedFiles = []; |
201 | 201 | |
202 | 202 | foreach ($this->paths as $path) { |
203 | - if (! is_dir($path)) { |
|
203 | + if (!is_dir($path)) { |
|
204 | 204 | throw MappingException::fileMappingDriversRequireConfiguredDirectoryPath($path); |
205 | 205 | } |
206 | 206 | |
@@ -209,14 +209,14 @@ discard block |
||
209 | 209 | new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS), |
210 | 210 | RecursiveIteratorIterator::LEAVES_ONLY |
211 | 211 | ), |
212 | - '/^.+' . preg_quote($this->fileExtension) . '$/i', |
|
212 | + '/^.+'.preg_quote($this->fileExtension).'$/i', |
|
213 | 213 | RecursiveRegexIterator::GET_MATCH |
214 | 214 | ); |
215 | 215 | |
216 | 216 | foreach ($iterator as $file) { |
217 | 217 | $sourceFile = $file[0]; |
218 | 218 | |
219 | - if (! preg_match('(^phar:)i', $sourceFile)) { |
|
219 | + if (!preg_match('(^phar:)i', $sourceFile)) { |
|
220 | 220 | $sourceFile = realpath($sourceFile); |
221 | 221 | } |
222 | 222 | |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | foreach ($declared as $className) { |
241 | 241 | $rc = new ReflectionClass($className); |
242 | 242 | $sourceFile = $rc->getFileName(); |
243 | - if (! in_array($sourceFile, $includedFiles) || $this->isTransient($className)) { |
|
243 | + if (!in_array($sourceFile, $includedFiles) || $this->isTransient($className)) { |
|
244 | 244 | continue; |
245 | 245 | } |
246 | 246 |
@@ -90,8 +90,8 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -29,7 +29,7 @@ discard block |
||
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 |
||
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 | )); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function getAllMetadata() |
81 | 81 | { |
82 | - if (! $this->initialized) { |
|
82 | + if (!$this->initialized) { |
|
83 | 83 | $this->initialize(); |
84 | 84 | } |
85 | 85 | |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | |
175 | 175 | try { |
176 | 176 | if ($this->cacheDriver) { |
177 | - $cached = $this->cacheDriver->fetch($realClassName . $this->cacheSalt); |
|
177 | + $cached = $this->cacheDriver->fetch($realClassName.$this->cacheSalt); |
|
178 | 178 | if ($cached instanceof ClassMetadata) { |
179 | 179 | $this->loadedMetadata[$realClassName] = $cached; |
180 | 180 | |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | } else { |
183 | 183 | foreach ($this->loadMetadata($realClassName) as $loadedClassName) { |
184 | 184 | $this->cacheDriver->save( |
185 | - $loadedClassName . $this->cacheSalt, |
|
185 | + $loadedClassName.$this->cacheSalt, |
|
186 | 186 | $this->loadedMetadata[$loadedClassName], |
187 | 187 | null |
188 | 188 | ); |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | } catch (MappingException $loadingException) { |
195 | 195 | $fallbackMetadataResponse = $this->onNotFoundMetadata($realClassName); |
196 | 196 | |
197 | - if (! $fallbackMetadataResponse) { |
|
197 | + if (!$fallbackMetadataResponse) { |
|
198 | 198 | throw $loadingException; |
199 | 199 | } |
200 | 200 | |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | */ |
276 | 276 | protected function loadMetadata($name) |
277 | 277 | { |
278 | - if (! $this->initialized) { |
|
278 | + if (!$this->initialized) { |
|
279 | 279 | $this->initialize(); |
280 | 280 | } |
281 | 281 | |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | */ |
362 | 362 | public function isTransient($class) |
363 | 363 | { |
364 | - if (! $this->initialized) { |
|
364 | + if (!$this->initialized) { |
|
365 | 365 | $this->initialize(); |
366 | 366 | } |
367 | 367 | |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | */ |
403 | 403 | private function getRealClass(string $class) : string |
404 | 404 | { |
405 | - $pos = strrpos($class, '\\' . Proxy::MARKER . '\\'); |
|
405 | + $pos = strrpos($class, '\\'.Proxy::MARKER.'\\'); |
|
406 | 406 | |
407 | 407 | if ($pos === false) { |
408 | 408 | return $class; |