@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | public static function pathRequired() : self |
| 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 | |
@@ -37,11 +37,11 @@ discard block |
||
| 37 | 37 | ?string $path = null |
| 38 | 38 | ) : self { |
| 39 | 39 | if ($path !== null) { |
| 40 | - $path = '[' . $path . ']'; |
|
| 40 | + $path = '['.$path.']'; |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | return new self(sprintf( |
| 44 | - 'File mapping drivers must have a valid directory path, ' . |
|
| 44 | + 'File mapping drivers must have a valid directory path, '. |
|
| 45 | 45 | 'however the given path %s seems to be incorrect!', |
| 46 | 46 | $path |
| 47 | 47 | )); |
@@ -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 | |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | $sourceFile = $rc->getFileName(); |
| 111 | 111 | |
| 112 | - if (! in_array($sourceFile, $includedFiles, true) || $this->isTransient($className)) { |
|
| 112 | + if (!in_array($sourceFile, $includedFiles, true) || $this->isTransient($className)) { |
|
| 113 | 113 | continue; |
| 114 | 114 | } |
| 115 | 115 | |
@@ -126,6 +126,6 @@ discard block |
||
| 126 | 126 | */ |
| 127 | 127 | public function isTransient(string $className) : bool |
| 128 | 128 | { |
| 129 | - return ! method_exists($className, 'loadMetadata'); |
|
| 129 | + return !method_exists($className, 'loadMetadata'); |
|
| 130 | 130 | } |
| 131 | 131 | } |
@@ -129,12 +129,12 @@ discard block |
||
| 129 | 129 | */ |
| 130 | 130 | public function fileExists(string $className) : bool |
| 131 | 131 | { |
| 132 | - $defaultFileName = str_replace('\\', $this->nsSeparator, $className) . $this->fileExtension; |
|
| 132 | + $defaultFileName = str_replace('\\', $this->nsSeparator, $className).$this->fileExtension; |
|
| 133 | 133 | |
| 134 | 134 | foreach ($this->paths as $path) { |
| 135 | - if (! isset($this->prefixes[$path])) { |
|
| 135 | + if (!isset($this->prefixes[$path])) { |
|
| 136 | 136 | // global namespace class |
| 137 | - if (is_file($path . DIRECTORY_SEPARATOR . $defaultFileName)) { |
|
| 137 | + if (is_file($path.DIRECTORY_SEPARATOR.$defaultFileName)) { |
|
| 138 | 138 | return true; |
| 139 | 139 | } |
| 140 | 140 | |
@@ -143,11 +143,11 @@ discard block |
||
| 143 | 143 | |
| 144 | 144 | $prefix = $this->prefixes[$path]; |
| 145 | 145 | |
| 146 | - if (strpos($className, $prefix . '\\') !== 0) { |
|
| 146 | + if (strpos($className, $prefix.'\\') !== 0) { |
|
| 147 | 147 | continue; |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | - $filename = $path . '/' . strtr(substr($className, strlen($prefix) + 1), '\\', $this->nsSeparator) . $this->fileExtension; |
|
| 150 | + $filename = $path.'/'.strtr(substr($className, strlen($prefix) + 1), '\\', $this->nsSeparator).$this->fileExtension; |
|
| 151 | 151 | |
| 152 | 152 | if (is_file($filename)) { |
| 153 | 153 | return true; |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | $classes = []; |
| 170 | 170 | |
| 171 | 171 | foreach ($this->paths as $path) { |
| 172 | - if (! is_dir($path)) { |
|
| 172 | + if (!is_dir($path)) { |
|
| 173 | 173 | throw MappingException::fileMappingDriversRequireConfiguredDirectoryPath($path); |
| 174 | 174 | } |
| 175 | 175 | |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | '\\' |
| 195 | 195 | ); |
| 196 | 196 | |
| 197 | - $classes[] = $this->prefixes[$path] . str_replace(DIRECTORY_SEPARATOR, '\\', $nsSuffix) . '\\' . str_replace($this->nsSeparator, '\\', $fileName); |
|
| 197 | + $classes[] = $this->prefixes[$path].str_replace(DIRECTORY_SEPARATOR, '\\', $nsSuffix).'\\'.str_replace($this->nsSeparator, '\\', $fileName); |
|
| 198 | 198 | } else { |
| 199 | 199 | /** @var string $className */ |
| 200 | 200 | $className = str_replace($this->nsSeparator, '\\', $fileName); |
@@ -212,11 +212,11 @@ discard block |
||
| 212 | 212 | */ |
| 213 | 213 | public function findMappingFile(string $className) : string |
| 214 | 214 | { |
| 215 | - $defaultFileName = str_replace('\\', $this->nsSeparator, $className) . $this->fileExtension; |
|
| 215 | + $defaultFileName = str_replace('\\', $this->nsSeparator, $className).$this->fileExtension; |
|
| 216 | 216 | foreach ($this->paths as $path) { |
| 217 | - if (! isset($this->prefixes[$path])) { |
|
| 218 | - if (is_file($path . DIRECTORY_SEPARATOR . $defaultFileName)) { |
|
| 219 | - return $path . DIRECTORY_SEPARATOR . $defaultFileName; |
|
| 217 | + if (!isset($this->prefixes[$path])) { |
|
| 218 | + if (is_file($path.DIRECTORY_SEPARATOR.$defaultFileName)) { |
|
| 219 | + return $path.DIRECTORY_SEPARATOR.$defaultFileName; |
|
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | continue; |
@@ -224,11 +224,11 @@ discard block |
||
| 224 | 224 | |
| 225 | 225 | $prefix = $this->prefixes[$path]; |
| 226 | 226 | |
| 227 | - if (strpos($className, $prefix . '\\') !== 0) { |
|
| 227 | + if (strpos($className, $prefix.'\\') !== 0) { |
|
| 228 | 228 | continue; |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | - $filename = $path . '/' . strtr(substr($className, strlen($prefix) + 1), '\\', $this->nsSeparator) . $this->fileExtension; |
|
| 231 | + $filename = $path.'/'.strtr(substr($className, strlen($prefix) + 1), '\\', $this->nsSeparator).$this->fileExtension; |
|
| 232 | 232 | if (is_file($filename)) { |
| 233 | 233 | return $filename; |
| 234 | 234 | } |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | |
| 240 | 240 | throw MappingException::mappingFileNotFound( |
| 241 | 241 | $className, |
| 242 | - substr($className, $pos + 1) . $this->fileExtension |
|
| 242 | + substr($className, $pos + 1).$this->fileExtension |
|
| 243 | 243 | ); |
| 244 | 244 | } |
| 245 | 245 | |
@@ -82,10 +82,10 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | $result = $this->loadMappingFile($this->locator->findMappingFile($className)); |
| 84 | 84 | |
| 85 | - if (! isset($result[$className])) { |
|
| 85 | + if (!isset($result[$className])) { |
|
| 86 | 86 | throw MappingException::invalidMappingFile( |
| 87 | 87 | $className, |
| 88 | - str_replace('\\', '.', $className) . $this->locator->getFileExtension() |
|
| 88 | + str_replace('\\', '.', $className).$this->locator->getFileExtension() |
|
| 89 | 89 | ); |
| 90 | 90 | } |
| 91 | 91 | |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | return false; |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - return ! $this->locator->fileExists($className); |
|
| 110 | + return !$this->locator->fileExists($className); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | /** |
@@ -165,8 +165,8 @@ discard block |
||
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | foreach ($this->locator->getPaths() as $path) { |
| 168 | - $file = $path . '/' . $this->globalBasename . $this->locator->getFileExtension(); |
|
| 169 | - if (! is_file($file)) { |
|
| 168 | + $file = $path.'/'.$this->globalBasename.$this->locator->getFileExtension(); |
|
| 169 | + if (!is_file($file)) { |
|
| 170 | 170 | continue; |
| 171 | 171 | } |
| 172 | 172 | |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | return; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - if (! is_array($paths)) { |
|
| 92 | + if (!is_array($paths)) { |
|
| 93 | 93 | $paths = [$paths]; |
| 94 | 94 | } |
| 95 | 95 | |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | $includedFiles = []; |
| 200 | 200 | |
| 201 | 201 | foreach ($this->paths as $path) { |
| 202 | - if (! is_dir($path)) { |
|
| 202 | + if (!is_dir($path)) { |
|
| 203 | 203 | throw MappingException::fileMappingDriversRequireConfiguredDirectoryPath($path); |
| 204 | 204 | } |
| 205 | 205 | |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS), |
| 209 | 209 | RecursiveIteratorIterator::LEAVES_ONLY |
| 210 | 210 | ), |
| 211 | - '/^.+' . preg_quote($this->fileExtension) . '$/i', |
|
| 211 | + '/^.+'.preg_quote($this->fileExtension).'$/i', |
|
| 212 | 212 | RecursiveRegexIterator::GET_MATCH |
| 213 | 213 | ); |
| 214 | 214 | |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | |
| 245 | 245 | $sourceFile = $rc->getFileName(); |
| 246 | 246 | |
| 247 | - if (! in_array($sourceFile, $includedFiles, true) || $this->isTransient($className)) { |
|
| 247 | + if (!in_array($sourceFile, $includedFiles, true) || $this->isTransient($className)) { |
|
| 248 | 248 | continue; |
| 249 | 249 | } |
| 250 | 250 | |
@@ -94,12 +94,12 @@ discard block |
||
| 94 | 94 | */ |
| 95 | 95 | public function findMappingFile(string $className) : string |
| 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 | |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | $classes = []; |
| 119 | 119 | |
| 120 | 120 | foreach ($this->paths as $path) { |
| 121 | - if (! is_dir($path)) { |
|
| 121 | + if (!is_dir($path)) { |
|
| 122 | 122 | throw MappingException::fileMappingDriversRequireConfiguredDirectoryPath($path); |
| 123 | 123 | } |
| 124 | 124 | |
@@ -151,11 +151,11 @@ discard block |
||
| 151 | 151 | */ |
| 152 | 152 | public function fileExists(string $className) : bool |
| 153 | 153 | { |
| 154 | - $fileName = str_replace('\\', '.', $className) . $this->fileExtension; |
|
| 154 | + $fileName = str_replace('\\', '.', $className).$this->fileExtension; |
|
| 155 | 155 | |
| 156 | 156 | // Check whether file exists |
| 157 | 157 | foreach ($this->paths as $path) { |
| 158 | - if (is_file($path . DIRECTORY_SEPARATOR . $fileName)) { |
|
| 158 | + if (is_file($path.DIRECTORY_SEPARATOR.$fileName)) { |
|
| 159 | 159 | return true; |
| 160 | 160 | } |
| 161 | 161 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | $name = $this->defaultConnection; |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - if (! isset($this->connections[$name])) { |
|
| 94 | + if (!isset($this->connections[$name])) { |
|
| 95 | 95 | throw new InvalidArgumentException( |
| 96 | 96 | sprintf('Doctrine %s Connection named "%s" does not exist.', $this->name, $name) |
| 97 | 97 | ); |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | $name = $this->defaultManager; |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | - if (! isset($this->managers[$name])) { |
|
| 151 | + if (!isset($this->managers[$name])) { |
|
| 152 | 152 | throw new InvalidArgumentException( |
| 153 | 153 | sprintf('Doctrine %s Manager named "%s" does not exist.', $this->name, $name) |
| 154 | 154 | ); |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | if (strpos($class, ':') !== false) { |
| 170 | 170 | [$namespaceAlias, $simpleClassName] = explode(':', $class, 2); |
| 171 | 171 | |
| 172 | - $class = $this->getAliasNamespace($namespaceAlias) . '\\' . $simpleClassName; |
|
| 172 | + $class = $this->getAliasNamespace($namespaceAlias).'\\'.$simpleClassName; |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | $proxyClass = new ReflectionClass($class); |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | /** @var ObjectManager $manager */ |
| 189 | 189 | $manager = $this->getService($id); |
| 190 | 190 | |
| 191 | - if (! $manager->getMetadataFactory()->isTransient($class)) { |
|
| 191 | + if (!$manager->getMetadataFactory()->isTransient($class)) { |
|
| 192 | 192 | return $manager; |
| 193 | 193 | } |
| 194 | 194 | } |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | $name = $this->defaultManager; |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | - if (! isset($this->managers[$name])) { |
|
| 250 | + if (!isset($this->managers[$name])) { |
|
| 251 | 251 | throw new InvalidArgumentException(sprintf('Doctrine %s Manager named "%s" does not exist.', $this->name, $name)); |
| 252 | 252 | } |
| 253 | 253 | |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | { |
| 15 | 15 | public function testGetPaths() : void |
| 16 | 16 | { |
| 17 | - $path = __DIR__ . '/_files'; |
|
| 17 | + $path = __DIR__.'/_files'; |
|
| 18 | 18 | |
| 19 | 19 | $locator = new DefaultFileLocator([$path]); |
| 20 | 20 | self::assertSame([$path], $locator->getPaths()); |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | public function testUniquePaths() : void |
| 35 | 35 | { |
| 36 | - $path = __DIR__ . '/_files'; |
|
| 36 | + $path = __DIR__.'/_files'; |
|
| 37 | 37 | |
| 38 | 38 | $locator = new DefaultFileLocator([$path, $path]); |
| 39 | 39 | self::assertSame([$path], $locator->getPaths()); |
@@ -41,16 +41,16 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | public function testFindMappingFile() : void |
| 43 | 43 | { |
| 44 | - $path = __DIR__ . '/_files'; |
|
| 44 | + $path = __DIR__.'/_files'; |
|
| 45 | 45 | |
| 46 | 46 | $locator = new DefaultFileLocator([$path], '.yml'); |
| 47 | 47 | |
| 48 | - self::assertSame(__DIR__ . '/_files' . DIRECTORY_SEPARATOR . 'stdClass.yml', $locator->findMappingFile('stdClass')); |
|
| 48 | + self::assertSame(__DIR__.'/_files'.DIRECTORY_SEPARATOR.'stdClass.yml', $locator->findMappingFile('stdClass')); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | public function testFindMappingFileNotFound() : void |
| 52 | 52 | { |
| 53 | - $path = __DIR__ . '/_files'; |
|
| 53 | + $path = __DIR__.'/_files'; |
|
| 54 | 54 | |
| 55 | 55 | $locator = new DefaultFileLocator([$path], '.yml'); |
| 56 | 56 | |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | public function testGetAllClassNames() : void |
| 63 | 63 | { |
| 64 | - $path = __DIR__ . '/_files'; |
|
| 64 | + $path = __DIR__.'/_files'; |
|
| 65 | 65 | |
| 66 | 66 | $locator = new DefaultFileLocator([$path], '.yml'); |
| 67 | 67 | $allClasses = $locator->getAllClassNames(''); |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | |
| 82 | 82 | public function testGetAllClassNamesNonMatchingFileExtension() : void |
| 83 | 83 | { |
| 84 | - $path = __DIR__ . '/_files'; |
|
| 84 | + $path = __DIR__.'/_files'; |
|
| 85 | 85 | |
| 86 | 86 | $locator = new DefaultFileLocator([$path], '.xml'); |
| 87 | 87 | self::assertSame([], $locator->getAllClassNames('global')); |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | public function testFileExists() : void |
| 91 | 91 | { |
| 92 | - $path = __DIR__ . '/_files'; |
|
| 92 | + $path = __DIR__.'/_files'; |
|
| 93 | 93 | |
| 94 | 94 | $locator = new DefaultFileLocator([$path], '.yml'); |
| 95 | 95 | |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | */ |
| 78 | 78 | public function getAllMetadata() : array |
| 79 | 79 | { |
| 80 | - if (! $this->initialized) { |
|
| 80 | + if (!$this->initialized) { |
|
| 81 | 81 | $this->initialize(); |
| 82 | 82 | } |
| 83 | 83 | |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | |
| 165 | 165 | try { |
| 166 | 166 | if ($this->cacheDriver !== null) { |
| 167 | - $cached = $this->cacheDriver->fetch($realClassName . $this->cacheSalt); |
|
| 167 | + $cached = $this->cacheDriver->fetch($realClassName.$this->cacheSalt); |
|
| 168 | 168 | |
| 169 | 169 | if ($cached instanceof ClassMetadata) { |
| 170 | 170 | $this->loadedMetadata[$realClassName] = $cached; |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | } else { |
| 174 | 174 | foreach ($this->loadMetadata($realClassName) as $loadedClassName) { |
| 175 | 175 | $this->cacheDriver->save( |
| 176 | - $loadedClassName . $this->cacheSalt, |
|
| 176 | + $loadedClassName.$this->cacheSalt, |
|
| 177 | 177 | $this->loadedMetadata[$loadedClassName] |
| 178 | 178 | ); |
| 179 | 179 | } |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | */ |
| 260 | 260 | protected function loadMetadata(string $name) : array |
| 261 | 261 | { |
| 262 | - if (! $this->initialized) { |
|
| 262 | + if (!$this->initialized) { |
|
| 263 | 263 | $this->initialize(); |
| 264 | 264 | } |
| 265 | 265 | |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | */ |
| 344 | 344 | public function isTransient(string $class) : bool |
| 345 | 345 | { |
| 346 | - if (! $this->initialized) { |
|
| 346 | + if (!$this->initialized) { |
|
| 347 | 347 | $this->initialize(); |
| 348 | 348 | } |
| 349 | 349 | |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | */ |
| 383 | 383 | private function getRealClass(string $class) : string |
| 384 | 384 | { |
| 385 | - $pos = strrpos($class, '\\' . Proxy::MARKER . '\\'); |
|
| 385 | + $pos = strrpos($class, '\\'.Proxy::MARKER.'\\'); |
|
| 386 | 386 | |
| 387 | 387 | if ($pos === false) { |
| 388 | 388 | return $class; |