@@ -22,7 +22,7 @@ |
||
| 22 | 22 | */ |
| 23 | 23 | public function getParentClasses(string $class) : array |
| 24 | 24 | { |
| 25 | - if (! class_exists($class)) { |
|
| 25 | + if (!class_exists($class)) { |
|
| 26 | 26 | throw MappingException::nonExistingClass($class); |
| 27 | 27 | } |
| 28 | 28 | |
@@ -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 | )); |
@@ -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, |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | protected function getFqcnFromAlias(string $namespaceAlias, string $simpleClassName) : string |
| 37 | 37 | { |
| 38 | - return __NAMESPACE__ . '\\' . $simpleClassName; |
|
| 38 | + return __NAMESPACE__.'\\'.$simpleClassName; |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | protected function initialize() : void |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | |
| 68 | 68 | protected function onNotFoundMetadata(string $className) : ?ClassMetadata |
| 69 | 69 | { |
| 70 | - if (! $this->fallbackCallback) { |
|
| 70 | + if (!$this->fallbackCallback) { |
|
| 71 | 71 | return null; |
| 72 | 72 | } |
| 73 | 73 | |
@@ -127,12 +127,12 @@ discard block |
||
| 127 | 127 | */ |
| 128 | 128 | public function fileExists(string $className) : bool |
| 129 | 129 | { |
| 130 | - $defaultFileName = str_replace('\\', $this->nsSeparator, $className) . $this->fileExtension; |
|
| 130 | + $defaultFileName = str_replace('\\', $this->nsSeparator, $className).$this->fileExtension; |
|
| 131 | 131 | |
| 132 | 132 | foreach ($this->paths as $path) { |
| 133 | - if (! isset($this->prefixes[$path])) { |
|
| 133 | + if (!isset($this->prefixes[$path])) { |
|
| 134 | 134 | // global namespace class |
| 135 | - if (is_file($path . DIRECTORY_SEPARATOR . $defaultFileName)) { |
|
| 135 | + if (is_file($path.DIRECTORY_SEPARATOR.$defaultFileName)) { |
|
| 136 | 136 | return true; |
| 137 | 137 | } |
| 138 | 138 | |
@@ -141,11 +141,11 @@ discard block |
||
| 141 | 141 | |
| 142 | 142 | $prefix = $this->prefixes[$path]; |
| 143 | 143 | |
| 144 | - if (strpos($className, $prefix . '\\') !== 0) { |
|
| 144 | + if (strpos($className, $prefix.'\\') !== 0) { |
|
| 145 | 145 | continue; |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | - $filename = $path . '/' . strtr(substr($className, strlen($prefix) + 1), '\\', $this->nsSeparator) . $this->fileExtension; |
|
| 148 | + $filename = $path.'/'.strtr(substr($className, strlen($prefix) + 1), '\\', $this->nsSeparator).$this->fileExtension; |
|
| 149 | 149 | |
| 150 | 150 | if (is_file($filename)) { |
| 151 | 151 | return true; |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | |
| 165 | 165 | if ($this->paths) { |
| 166 | 166 | foreach ((array) $this->paths as $path) { |
| 167 | - if (! is_dir($path)) { |
|
| 167 | + if (!is_dir($path)) { |
|
| 168 | 168 | throw MappingException::fileMappingDriversRequireConfiguredDirectoryPath($path); |
| 169 | 169 | } |
| 170 | 170 | |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | '\\' |
| 190 | 190 | ); |
| 191 | 191 | |
| 192 | - $classes[] = $this->prefixes[$path] . str_replace(DIRECTORY_SEPARATOR, '\\', $nsSuffix) . '\\' . str_replace($this->nsSeparator, '\\', $fileName); |
|
| 192 | + $classes[] = $this->prefixes[$path].str_replace(DIRECTORY_SEPARATOR, '\\', $nsSuffix).'\\'.str_replace($this->nsSeparator, '\\', $fileName); |
|
| 193 | 193 | } else { |
| 194 | 194 | /** @var string $className */ |
| 195 | 195 | $className = str_replace($this->nsSeparator, '\\', $fileName); |
@@ -208,11 +208,11 @@ discard block |
||
| 208 | 208 | */ |
| 209 | 209 | public function findMappingFile(string $className) : string |
| 210 | 210 | { |
| 211 | - $defaultFileName = str_replace('\\', $this->nsSeparator, $className) . $this->fileExtension; |
|
| 211 | + $defaultFileName = str_replace('\\', $this->nsSeparator, $className).$this->fileExtension; |
|
| 212 | 212 | foreach ($this->paths as $path) { |
| 213 | - if (! isset($this->prefixes[$path])) { |
|
| 214 | - if (is_file($path . DIRECTORY_SEPARATOR . $defaultFileName)) { |
|
| 215 | - return $path . DIRECTORY_SEPARATOR . $defaultFileName; |
|
| 213 | + if (!isset($this->prefixes[$path])) { |
|
| 214 | + if (is_file($path.DIRECTORY_SEPARATOR.$defaultFileName)) { |
|
| 215 | + return $path.DIRECTORY_SEPARATOR.$defaultFileName; |
|
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | continue; |
@@ -220,11 +220,11 @@ discard block |
||
| 220 | 220 | |
| 221 | 221 | $prefix = $this->prefixes[$path]; |
| 222 | 222 | |
| 223 | - if (strpos($className, $prefix . '\\') !== 0) { |
|
| 223 | + if (strpos($className, $prefix.'\\') !== 0) { |
|
| 224 | 224 | continue; |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | - $filename = $path . '/' . strtr(substr($className, strlen($prefix) + 1), '\\', $this->nsSeparator) . $this->fileExtension; |
|
| 227 | + $filename = $path.'/'.strtr(substr($className, strlen($prefix) + 1), '\\', $this->nsSeparator).$this->fileExtension; |
|
| 228 | 228 | if (is_file($filename)) { |
| 229 | 229 | return $filename; |
| 230 | 230 | } |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | |
| 233 | 233 | throw MappingException::mappingFileNotFound( |
| 234 | 234 | $className, |
| 235 | - substr($className, strrpos($className, '\\') + 1) . $this->fileExtension |
|
| 235 | + substr($className, strrpos($className, '\\') + 1).$this->fileExtension |
|
| 236 | 236 | ); |
| 237 | 237 | } |
| 238 | 238 | |
@@ -80,10 +80,10 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | $result = $this->loadMappingFile($this->locator->findMappingFile($className)); |
| 82 | 82 | |
| 83 | - if (! isset($result[$className])) { |
|
| 83 | + if (!isset($result[$className])) { |
|
| 84 | 84 | throw MappingException::invalidMappingFile( |
| 85 | 85 | $className, |
| 86 | - str_replace('\\', '.', $className) . $this->locator->getFileExtension() |
|
| 86 | + str_replace('\\', '.', $className).$this->locator->getFileExtension() |
|
| 87 | 87 | ); |
| 88 | 88 | } |
| 89 | 89 | |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | return false; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - return ! $this->locator->fileExists($className); |
|
| 108 | + return !$this->locator->fileExists($className); |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | /** |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | $this->initialize(); |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - if (! $this->classCache) { |
|
| 120 | + if (!$this->classCache) { |
|
| 121 | 121 | return (array) $this->locator->getAllClassNames($this->globalBasename); |
| 122 | 122 | } |
| 123 | 123 | |
@@ -160,8 +160,8 @@ discard block |
||
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | foreach ($this->locator->getPaths() as $path) { |
| 163 | - $file = $path . '/' . $this->globalBasename . $this->locator->getFileExtension(); |
|
| 164 | - if (! is_file($file)) { |
|
| 163 | + $file = $path.'/'.$this->globalBasename.$this->locator->getFileExtension(); |
|
| 164 | + if (!is_file($file)) { |
|
| 165 | 165 | continue; |
| 166 | 166 | } |
| 167 | 167 | |