@@ -121,11 +121,11 @@ discard block |
||
| 121 | 121 | */ |
| 122 | 122 | public function fileExists(string $className) : bool |
| 123 | 123 | { |
| 124 | - $defaultFileName = str_replace('\\', $this->nsSeparator, $className) . $this->fileExtension; |
|
| 124 | + $defaultFileName = str_replace('\\', $this->nsSeparator, $className).$this->fileExtension; |
|
| 125 | 125 | foreach ($this->paths as $path) { |
| 126 | - if (! isset($this->prefixes[$path])) { |
|
| 126 | + if (!isset($this->prefixes[$path])) { |
|
| 127 | 127 | // global namespace class |
| 128 | - if (is_file($path . DIRECTORY_SEPARATOR . $defaultFileName)) { |
|
| 128 | + if (is_file($path.DIRECTORY_SEPARATOR.$defaultFileName)) { |
|
| 129 | 129 | return true; |
| 130 | 130 | } |
| 131 | 131 | |
@@ -134,11 +134,11 @@ discard block |
||
| 134 | 134 | |
| 135 | 135 | $prefix = $this->prefixes[$path]; |
| 136 | 136 | |
| 137 | - if (strpos($className, $prefix . '\\') !== 0) { |
|
| 137 | + if (strpos($className, $prefix.'\\') !== 0) { |
|
| 138 | 138 | continue; |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - $filename = $path . '/' . strtr(substr($className, strlen($prefix) + 1), '\\', $this->nsSeparator) . $this->fileExtension; |
|
| 141 | + $filename = $path.'/'.strtr(substr($className, strlen($prefix) + 1), '\\', $this->nsSeparator).$this->fileExtension; |
|
| 142 | 142 | if (is_file($filename)) { |
| 143 | 143 | return true; |
| 144 | 144 | } |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | |
| 157 | 157 | if ($this->paths) { |
| 158 | 158 | foreach ((array) $this->paths as $path) { |
| 159 | - if (! is_dir($path)) { |
|
| 159 | + if (!is_dir($path)) { |
|
| 160 | 160 | throw MappingException::fileMappingDriversRequireConfiguredDirectoryPath($path); |
| 161 | 161 | } |
| 162 | 162 | |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | '\\' |
| 182 | 182 | ); |
| 183 | 183 | |
| 184 | - $classes[] = $this->prefixes[$path] . str_replace(DIRECTORY_SEPARATOR, '\\', $nsSuffix) . '\\' . str_replace($this->nsSeparator, '\\', $fileName); |
|
| 184 | + $classes[] = $this->prefixes[$path].str_replace(DIRECTORY_SEPARATOR, '\\', $nsSuffix).'\\'.str_replace($this->nsSeparator, '\\', $fileName); |
|
| 185 | 185 | } else { |
| 186 | 186 | $classes[] = str_replace($this->nsSeparator, '\\', $fileName); |
| 187 | 187 | } |
@@ -197,11 +197,11 @@ discard block |
||
| 197 | 197 | */ |
| 198 | 198 | public function findMappingFile(string $className) : string |
| 199 | 199 | { |
| 200 | - $defaultFileName = str_replace('\\', $this->nsSeparator, $className) . $this->fileExtension; |
|
| 200 | + $defaultFileName = str_replace('\\', $this->nsSeparator, $className).$this->fileExtension; |
|
| 201 | 201 | foreach ($this->paths as $path) { |
| 202 | - if (! isset($this->prefixes[$path])) { |
|
| 203 | - if (is_file($path . DIRECTORY_SEPARATOR . $defaultFileName)) { |
|
| 204 | - return $path . DIRECTORY_SEPARATOR . $defaultFileName; |
|
| 202 | + if (!isset($this->prefixes[$path])) { |
|
| 203 | + if (is_file($path.DIRECTORY_SEPARATOR.$defaultFileName)) { |
|
| 204 | + return $path.DIRECTORY_SEPARATOR.$defaultFileName; |
|
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | continue; |
@@ -209,16 +209,16 @@ discard block |
||
| 209 | 209 | |
| 210 | 210 | $prefix = $this->prefixes[$path]; |
| 211 | 211 | |
| 212 | - if (strpos($className, $prefix . '\\') !== 0) { |
|
| 212 | + if (strpos($className, $prefix.'\\') !== 0) { |
|
| 213 | 213 | continue; |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | - $filename = $path . '/' . strtr(substr($className, strlen($prefix) + 1), '\\', $this->nsSeparator) . $this->fileExtension; |
|
| 216 | + $filename = $path.'/'.strtr(substr($className, strlen($prefix) + 1), '\\', $this->nsSeparator).$this->fileExtension; |
|
| 217 | 217 | if (is_file($filename)) { |
| 218 | 218 | return $filename; |
| 219 | 219 | } |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | - throw MappingException::mappingFileNotFound($className, substr($className, strrpos($className, '\\') + 1) . $this->fileExtension); |
|
| 222 | + throw MappingException::mappingFileNotFound($className, substr($className, strrpos($className, '\\') + 1).$this->fileExtension); |
|
| 223 | 223 | } |
| 224 | 224 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | return $this->classNames; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - if (! $this->paths) { |
|
| 75 | + if (!$this->paths) { |
|
| 76 | 76 | throw MappingException::pathRequired(); |
| 77 | 77 | } |
| 78 | 78 | |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | $includedFiles = []; |
| 81 | 81 | |
| 82 | 82 | foreach ($this->paths as $path) { |
| 83 | - if (! is_dir($path)) { |
|
| 83 | + if (!is_dir($path)) { |
|
| 84 | 84 | throw MappingException::fileMappingDriversRequireConfiguredDirectoryPath($path); |
| 85 | 85 | } |
| 86 | 86 | |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | foreach ($declared as $className) { |
| 106 | 106 | $rc = new ReflectionClass($className); |
| 107 | 107 | $sourceFile = $rc->getFileName(); |
| 108 | - if (! in_array($sourceFile, $includedFiles) || $this->isTransient($className)) { |
|
| 108 | + if (!in_array($sourceFile, $includedFiles) || $this->isTransient($className)) { |
|
| 109 | 109 | continue; |
| 110 | 110 | } |
| 111 | 111 | |
@@ -122,6 +122,6 @@ discard block |
||
| 122 | 122 | */ |
| 123 | 123 | public function isTransient(string $className) : bool |
| 124 | 124 | { |
| 125 | - return ! method_exists($className, 'loadMetadata'); |
|
| 125 | + return !method_exists($className, 'loadMetadata'); |
|
| 126 | 126 | } |
| 127 | 127 | } |
@@ -90,12 +90,12 @@ discard block |
||
| 90 | 90 | */ |
| 91 | 91 | public function findMappingFile(string $className) : string |
| 92 | 92 | { |
| 93 | - $fileName = str_replace('\\', '.', $className) . $this->fileExtension; |
|
| 93 | + $fileName = str_replace('\\', '.', $className).$this->fileExtension; |
|
| 94 | 94 | |
| 95 | 95 | // Check whether file exists |
| 96 | 96 | foreach ($this->paths as $path) { |
| 97 | - if (is_file($path . DIRECTORY_SEPARATOR . $fileName)) { |
|
| 98 | - return $path . DIRECTORY_SEPARATOR . $fileName; |
|
| 97 | + if (is_file($path.DIRECTORY_SEPARATOR.$fileName)) { |
|
| 98 | + return $path.DIRECTORY_SEPARATOR.$fileName; |
|
| 99 | 99 | } |
| 100 | 100 | } |
| 101 | 101 | |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | |
| 112 | 112 | if ($this->paths) { |
| 113 | 113 | foreach ($this->paths as $path) { |
| 114 | - if (! is_dir($path)) { |
|
| 114 | + if (!is_dir($path)) { |
|
| 115 | 115 | throw MappingException::fileMappingDriversRequireConfiguredDirectoryPath($path); |
| 116 | 116 | } |
| 117 | 117 | |
@@ -141,11 +141,11 @@ discard block |
||
| 141 | 141 | */ |
| 142 | 142 | public function fileExists(string $className) : bool |
| 143 | 143 | { |
| 144 | - $fileName = str_replace('\\', '.', $className) . $this->fileExtension; |
|
| 144 | + $fileName = str_replace('\\', '.', $className).$this->fileExtension; |
|
| 145 | 145 | |
| 146 | 146 | // Check whether file exists |
| 147 | 147 | foreach ((array) $this->paths as $path) { |
| 148 | - if (is_file($path . DIRECTORY_SEPARATOR . $fileName)) { |
|
| 148 | + if (is_file($path.DIRECTORY_SEPARATOR.$fileName)) { |
|
| 149 | 149 | return true; |
| 150 | 150 | } |
| 151 | 151 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | { |
| 81 | 81 | $this->reader = $reader; |
| 82 | 82 | |
| 83 | - if (! $paths) { |
|
| 83 | + if (!$paths) { |
|
| 84 | 84 | return; |
| 85 | 85 | } |
| 86 | 86 | |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | return $this->classNames; |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | - if (! $this->paths) { |
|
| 187 | + if (!$this->paths) { |
|
| 188 | 188 | throw MappingException::pathRequired(); |
| 189 | 189 | } |
| 190 | 190 | |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | $includedFiles = []; |
| 193 | 193 | |
| 194 | 194 | foreach ($this->paths as $path) { |
| 195 | - if (! is_dir($path)) { |
|
| 195 | + if (!is_dir($path)) { |
|
| 196 | 196 | throw MappingException::fileMappingDriversRequireConfiguredDirectoryPath($path); |
| 197 | 197 | } |
| 198 | 198 | |
@@ -201,14 +201,14 @@ discard block |
||
| 201 | 201 | new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS), |
| 202 | 202 | RecursiveIteratorIterator::LEAVES_ONLY |
| 203 | 203 | ), |
| 204 | - '/^.+' . preg_quote($this->fileExtension) . '$/i', |
|
| 204 | + '/^.+'.preg_quote($this->fileExtension).'$/i', |
|
| 205 | 205 | RecursiveRegexIterator::GET_MATCH |
| 206 | 206 | ); |
| 207 | 207 | |
| 208 | 208 | foreach ($iterator as $file) { |
| 209 | 209 | $sourceFile = $file[0]; |
| 210 | 210 | |
| 211 | - if (! preg_match('(^phar:)i', $sourceFile)) { |
|
| 211 | + if (!preg_match('(^phar:)i', $sourceFile)) { |
|
| 212 | 212 | $sourceFile = realpath($sourceFile); |
| 213 | 213 | } |
| 214 | 214 | |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | foreach ($declared as $className) { |
| 236 | 236 | $rc = new ReflectionClass($className); |
| 237 | 237 | $sourceFile = $rc->getFileName(); |
| 238 | - if (! in_array($sourceFile, $includedFiles) || $this->isTransient($className)) { |
|
| 238 | + if (!in_array($sourceFile, $includedFiles) || $this->isTransient($className)) { |
|
| 239 | 239 | continue; |
| 240 | 240 | } |
| 241 | 241 | |
@@ -26,18 +26,18 @@ |
||
| 26 | 26 | |
| 27 | 27 | public static function pathRequired() : self |
| 28 | 28 | { |
| 29 | - return new self('Specifying the paths to your entities is required ' . |
|
| 29 | + return new self('Specifying the paths to your entities is required '. |
|
| 30 | 30 | 'in the AnnotationDriver to retrieve all class names.'); |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | public static function fileMappingDriversRequireConfiguredDirectoryPath(?string $path = null) : self |
| 34 | 34 | { |
| 35 | - if (! empty($path)) { |
|
| 36 | - $path = '[' . $path . ']'; |
|
| 35 | + if (!empty($path)) { |
|
| 36 | + $path = '['.$path.']'; |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | return new self(sprintf( |
| 40 | - 'File mapping drivers must have a valid directory path, ' . |
|
| 40 | + 'File mapping drivers must have a valid directory path, '. |
|
| 41 | 41 | 'however the given path %s seems to be incorrect!', |
| 42 | 42 | $path |
| 43 | 43 | )); |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | public function getAllMetadata() : array |
| 77 | 77 | { |
| 78 | - if (! $this->initialized) { |
|
| 78 | + if (!$this->initialized) { |
|
| 79 | 79 | $this->initialize(); |
| 80 | 80 | } |
| 81 | 81 | |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | |
| 154 | 154 | try { |
| 155 | 155 | if ($this->cacheDriver) { |
| 156 | - $cached = $this->cacheDriver->fetch($realClassName . $this->cacheSalt); |
|
| 156 | + $cached = $this->cacheDriver->fetch($realClassName.$this->cacheSalt); |
|
| 157 | 157 | if ($cached instanceof ClassMetadata) { |
| 158 | 158 | $this->loadedMetadata[$realClassName] = $cached; |
| 159 | 159 | |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | } else { |
| 162 | 162 | foreach ($this->loadMetadata($realClassName) as $loadedClassName) { |
| 163 | 163 | $this->cacheDriver->save( |
| 164 | - $loadedClassName . $this->cacheSalt, |
|
| 164 | + $loadedClassName.$this->cacheSalt, |
|
| 165 | 165 | $this->loadedMetadata[$loadedClassName], |
| 166 | 166 | 0 |
| 167 | 167 | ); |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | } catch (MappingException $loadingException) { |
| 174 | 174 | $fallbackMetadataResponse = $this->onNotFoundMetadata($realClassName); |
| 175 | 175 | |
| 176 | - if (! $fallbackMetadataResponse) { |
|
| 176 | + if (!$fallbackMetadataResponse) { |
|
| 177 | 177 | throw $loadingException; |
| 178 | 178 | } |
| 179 | 179 | |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | */ |
| 248 | 248 | protected function loadMetadata($name) |
| 249 | 249 | { |
| 250 | - if (! $this->initialized) { |
|
| 250 | + if (!$this->initialized) { |
|
| 251 | 251 | $this->initialize(); |
| 252 | 252 | } |
| 253 | 253 | |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | */ |
| 335 | 335 | public function isTransient(string $class) : bool |
| 336 | 336 | { |
| 337 | - if (! $this->initialized) { |
|
| 337 | + if (!$this->initialized) { |
|
| 338 | 338 | $this->initialize(); |
| 339 | 339 | } |
| 340 | 340 | |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | */ |
| 375 | 375 | private function getRealClass(string $class) : string |
| 376 | 376 | { |
| 377 | - $pos = strrpos($class, '\\' . Proxy::MARKER . '\\'); |
|
| 377 | + $pos = strrpos($class, '\\'.Proxy::MARKER.'\\'); |
|
| 378 | 378 | |
| 379 | 379 | if ($pos === false) { |
| 380 | 380 | return $class; |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | $name = $this->defaultConnection; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - if (! isset($this->connections[$name])) { |
|
| 91 | + if (!isset($this->connections[$name])) { |
|
| 92 | 92 | throw new InvalidArgumentException(sprintf('Doctrine %s Connection named "%s" does not exist.', $this->name, $name)); |
| 93 | 93 | } |
| 94 | 94 | |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | $name = $this->defaultManager; |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | - if (! isset($this->managers[$name])) { |
|
| 146 | + if (!isset($this->managers[$name])) { |
|
| 147 | 147 | throw new InvalidArgumentException(sprintf('Doctrine %s Manager named "%s" does not exist.', $this->name, $name)); |
| 148 | 148 | } |
| 149 | 149 | |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | // Check for namespace alias |
| 162 | 162 | if (strpos($class, ':') !== false) { |
| 163 | 163 | [$namespaceAlias, $simpleClassName] = explode(':', $class, 2); |
| 164 | - $class = $this->getAliasNamespace($namespaceAlias) . '\\' . $simpleClassName; |
|
| 164 | + $class = $this->getAliasNamespace($namespaceAlias).'\\'.$simpleClassName; |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | $proxyClass = new ReflectionClass($class); |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | if ($proxyClass->implementsInterface($this->proxyInterfaceName)) { |
| 170 | 170 | $parentClass = $proxyClass->getParentClass(); |
| 171 | 171 | |
| 172 | - if (! $parentClass) { |
|
| 172 | + if (!$parentClass) { |
|
| 173 | 173 | return null; |
| 174 | 174 | } |
| 175 | 175 | |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | /** @var ObjectManager $manager */ |
| 181 | 181 | $manager = $this->getService($id); |
| 182 | 182 | |
| 183 | - if (! $manager->getMetadataFactory()->isTransient($class)) { |
|
| 183 | + if (!$manager->getMetadataFactory()->isTransient($class)) { |
|
| 184 | 184 | return $manager; |
| 185 | 185 | } |
| 186 | 186 | } |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | $name = $this->defaultManager; |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | - if (! isset($this->managers[$name])) { |
|
| 232 | + if (!isset($this->managers[$name])) { |
|
| 233 | 233 | throw new InvalidArgumentException(sprintf('Doctrine %s Manager named "%s" does not exist.', $this->name, $name)); |
| 234 | 234 | } |
| 235 | 235 | |
@@ -89,7 +89,7 @@ |
||
| 89 | 89 | */ |
| 90 | 90 | private function assertValidField(string $field) : void |
| 91 | 91 | { |
| 92 | - if (! isset($this->entityChangeSet[$field])) { |
|
| 92 | + if (!isset($this->entityChangeSet[$field])) { |
|
| 93 | 93 | throw new InvalidArgumentException(sprintf( |
| 94 | 94 | 'Field "%s" is not a valid field of the entity "%s" in PreUpdateEventArgs.', |
| 95 | 95 | $field, |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | public function testGetMetadataForAbsentClass() |
| 46 | 46 | { |
| 47 | 47 | $this->expectException(MappingException::class); |
| 48 | - $this->cmf->getMetadataFor(__NAMESPACE__ . '\AbsentClass'); |
|
| 48 | + $this->cmf->getMetadataFor(__NAMESPACE__.'\AbsentClass'); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | public function testGetParentMetadata() |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | { |
| 62 | 62 | $metadata = $this->createMock(ClassMetadata::class); |
| 63 | 63 | $cache = new ArrayCache(); |
| 64 | - $cache->save(ChildEntity::class . '$CLASSMETADATA', $metadata); |
|
| 64 | + $cache->save(ChildEntity::class.'$CLASSMETADATA', $metadata); |
|
| 65 | 65 | |
| 66 | 66 | $this->cmf->setCacheDriver($cache); |
| 67 | 67 | |
@@ -75,14 +75,14 @@ discard block |
||
| 75 | 75 | |
| 76 | 76 | $loadedMetadata = $this->cmf->getMetadataFor(ChildEntity::class); |
| 77 | 77 | |
| 78 | - self::assertSame($loadedMetadata, $cache->fetch(ChildEntity::class . '$CLASSMETADATA')); |
|
| 78 | + self::assertSame($loadedMetadata, $cache->fetch(ChildEntity::class.'$CLASSMETADATA')); |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | public function testGetAliasedMetadata() |
| 82 | 82 | { |
| 83 | 83 | $this->cmf->getMetadataFor('prefix:ChildEntity'); |
| 84 | 84 | |
| 85 | - self::assertTrue($this->cmf->hasMetadataFor(__NAMESPACE__ . '\ChildEntity')); |
|
| 85 | + self::assertTrue($this->cmf->hasMetadataFor(__NAMESPACE__.'\ChildEntity')); |
|
| 86 | 86 | self::assertTrue($this->cmf->hasMetadataFor('prefix:ChildEntity')); |
| 87 | 87 | } |
| 88 | 88 | |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | { |
| 112 | 112 | $classMetadata = $this->createMock(ClassMetadata::class); |
| 113 | 113 | |
| 114 | - $this->cmf->fallbackCallback = static function () use ($classMetadata) { |
|
| 114 | + $this->cmf->fallbackCallback = static function() use ($classMetadata) { |
|
| 115 | 115 | return $classMetadata; |
| 116 | 116 | }; |
| 117 | 117 | |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | |
| 123 | 123 | public function testWillFailOnFallbackFailureWithNotLoadedMetadata() |
| 124 | 124 | { |
| 125 | - $this->cmf->fallbackCallback = static function () { |
|
| 125 | + $this->cmf->fallbackCallback = static function() { |
|
| 126 | 126 | return null; |
| 127 | 127 | }; |
| 128 | 128 | |