@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | { |
17 | 17 | public function testGetPaths() : void |
18 | 18 | { |
19 | - $path = __DIR__ . '/_files'; |
|
19 | + $path = __DIR__.'/_files'; |
|
20 | 20 | $prefix = 'Foo'; |
21 | 21 | |
22 | 22 | $locator = new SymfonyFileLocator([$path => $prefix]); |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | |
29 | 29 | public function testGetPrefixes() : void |
30 | 30 | { |
31 | - $path = __DIR__ . '/_files'; |
|
31 | + $path = __DIR__.'/_files'; |
|
32 | 32 | $prefix = 'Foo'; |
33 | 33 | |
34 | 34 | $locator = new SymfonyFileLocator([$path => $prefix]); |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | |
46 | 46 | public function testFileExists() : void |
47 | 47 | { |
48 | - $path = __DIR__ . '/_files'; |
|
48 | + $path = __DIR__.'/_files'; |
|
49 | 49 | $prefix = 'Foo'; |
50 | 50 | |
51 | 51 | $locator = new SymfonyFileLocator([$path => $prefix], '.yml'); |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | |
59 | 59 | public function testGetAllClassNames() : void |
60 | 60 | { |
61 | - $path = __DIR__ . '/_files'; |
|
61 | + $path = __DIR__.'/_files'; |
|
62 | 62 | $prefix = 'Foo'; |
63 | 63 | |
64 | 64 | $locator = new SymfonyFileLocator([$path => $prefix], '.yml'); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | |
80 | 80 | public function testInvalidCustomNamespaceSeparator() : void |
81 | 81 | { |
82 | - $path = __DIR__ . '/_files'; |
|
82 | + $path = __DIR__.'/_files'; |
|
83 | 83 | $prefix = 'Foo'; |
84 | 84 | |
85 | 85 | $this->expectException(InvalidArgumentException::class); |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | */ |
110 | 110 | public function testGetClassNamesWithCustomNsSeparator(string $separator, string $dir) : void |
111 | 111 | { |
112 | - $path = __DIR__ . $dir; |
|
112 | + $path = __DIR__.$dir; |
|
113 | 113 | $prefix = 'Foo'; |
114 | 114 | |
115 | 115 | $locator = new SymfonyFileLocator([$path => $prefix], '.yml', $separator); |
@@ -157,29 +157,29 @@ discard block |
||
157 | 157 | */ |
158 | 158 | public function testFindMappingFileWithCustomNsSeparator(string $separator, string $dir, array $files) : void |
159 | 159 | { |
160 | - $path = __DIR__ . $dir; |
|
160 | + $path = __DIR__.$dir; |
|
161 | 161 | $prefix = 'Foo'; |
162 | 162 | |
163 | 163 | $locator = new SymfonyFileLocator([$path => $prefix], '.yml', $separator); |
164 | 164 | |
165 | 165 | foreach ($files as $filePath => $className) { |
166 | - self::assertSame(realpath($path . '/' . $filePath), realpath($locator->findMappingFile($className))); |
|
166 | + self::assertSame(realpath($path.'/'.$filePath), realpath($locator->findMappingFile($className))); |
|
167 | 167 | } |
168 | 168 | } |
169 | 169 | |
170 | 170 | public function testFindMappingFile() : void |
171 | 171 | { |
172 | - $path = __DIR__ . '/_files'; |
|
172 | + $path = __DIR__.'/_files'; |
|
173 | 173 | $prefix = 'Foo'; |
174 | 174 | |
175 | 175 | $locator = new SymfonyFileLocator([$path => $prefix], '.yml'); |
176 | 176 | |
177 | - self::assertSame(__DIR__ . '/_files/stdClass.yml', $locator->findMappingFile('Foo\\stdClass')); |
|
177 | + self::assertSame(__DIR__.'/_files/stdClass.yml', $locator->findMappingFile('Foo\\stdClass')); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | public function testFindMappingFileNotFound() : void |
181 | 181 | { |
182 | - $path = __DIR__ . '/_files'; |
|
182 | + $path = __DIR__.'/_files'; |
|
183 | 183 | $prefix = 'Foo'; |
184 | 184 | |
185 | 185 | $locator = new SymfonyFileLocator([$path => $prefix], '.yml'); |
@@ -193,13 +193,13 @@ discard block |
||
193 | 193 | { |
194 | 194 | // Low -> High |
195 | 195 | $prefixes = []; |
196 | - $prefixes[__DIR__ . '/_match_ns'] = 'Foo'; |
|
197 | - $prefixes[__DIR__ . '/_match_ns/Bar'] = 'Foo\\Bar'; |
|
196 | + $prefixes[__DIR__.'/_match_ns'] = 'Foo'; |
|
197 | + $prefixes[__DIR__.'/_match_ns/Bar'] = 'Foo\\Bar'; |
|
198 | 198 | |
199 | 199 | $locator = new SymfonyFileLocator($prefixes, '.yml'); |
200 | 200 | |
201 | 201 | self::assertSame( |
202 | - __DIR__ . '/_match_ns/Bar/barEntity.yml', |
|
202 | + __DIR__.'/_match_ns/Bar/barEntity.yml', |
|
203 | 203 | $locator->findMappingFile("Foo\\Bar\\barEntity") |
204 | 204 | ); |
205 | 205 | } |
@@ -207,13 +207,13 @@ discard block |
||
207 | 207 | public function testFindMappingFileMostSpecificNamespaceFirst() : void |
208 | 208 | { |
209 | 209 | $prefixes = []; |
210 | - $prefixes[__DIR__ . '/_match_ns/Bar'] = 'Foo\\Bar'; |
|
211 | - $prefixes[__DIR__ . '/_match_ns'] = 'Foo'; |
|
210 | + $prefixes[__DIR__.'/_match_ns/Bar'] = 'Foo\\Bar'; |
|
211 | + $prefixes[__DIR__.'/_match_ns'] = 'Foo'; |
|
212 | 212 | |
213 | 213 | $locator = new SymfonyFileLocator($prefixes, '.yml'); |
214 | 214 | |
215 | 215 | self::assertSame( |
216 | - __DIR__ . '/_match_ns/Bar/barEntity.yml', |
|
216 | + __DIR__.'/_match_ns/Bar/barEntity.yml', |
|
217 | 217 | $locator->findMappingFile("Foo\\Bar\\barEntity") |
218 | 218 | ); |
219 | 219 | } |
@@ -39,7 +39,7 @@ |
||
39 | 39 | |
40 | 40 | protected function getFqcnFromAlias(string $namespaceAlias, string $simpleClassName) : string |
41 | 41 | { |
42 | - return __NAMESPACE__ . '\\' . $simpleClassName; |
|
42 | + return __NAMESPACE__.'\\'.$simpleClassName; |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | protected function initialize() : void |
@@ -17,7 +17,7 @@ |
||
17 | 17 | $metadata = $this->createMock(ClassMetadata::class); |
18 | 18 | $metadata->expects(self::once())->method('getFieldNames'); |
19 | 19 | |
20 | - $driver = new PHPDriver([__DIR__ . '/_files']); |
|
20 | + $driver = new PHPDriver([__DIR__.'/_files']); |
|
21 | 21 | $driver->loadMetadataForClass('TestEntity', $metadata); |
22 | 22 | } |
23 | 23 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $locator->expects(self::once()) |
41 | 41 | ->method('findMappingFile') |
42 | 42 | ->with(self::equalTo('stdClass')) |
43 | - ->will(self::returnValue(__DIR__ . '/_files/stdClass.yml')); |
|
43 | + ->will(self::returnValue(__DIR__.'/_files/stdClass.yml')); |
|
44 | 44 | |
45 | 45 | $driver = $this->createTestFileDriver($locator); |
46 | 46 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $locator->expects(self::once()) |
56 | 56 | ->method('findMappingFile') |
57 | 57 | ->with(self::equalTo('stdClass')) |
58 | - ->will(self::returnValue(__DIR__ . '/_files/stdClass.yml')); |
|
58 | + ->will(self::returnValue(__DIR__.'/_files/stdClass.yml')); |
|
59 | 59 | |
60 | 60 | $driver = $this->createTestFileDriver($locator); |
61 | 61 | |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | |
139 | 139 | public function testNonLocatorFallback() : void |
140 | 140 | { |
141 | - $driver = $this->createTestFileDriver(__DIR__ . '/_files', '.yml'); |
|
141 | + $driver = $this->createTestFileDriver(__DIR__.'/_files', '.yml'); |
|
142 | 142 | self::assertTrue($driver->isTransient('stdClass2')); |
143 | 143 | self::assertFalse($driver->isTransient('stdClass')); |
144 | 144 | } |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | { |
151 | 151 | $locator = $this->createMock(FileLocator::class); |
152 | 152 | $locator->expects(self::any())->method('getFileExtension')->will(self::returnValue('.yml')); |
153 | - $locator->expects(self::any())->method('getPaths')->will(self::returnValue([__DIR__ . '/_files'])); |
|
153 | + $locator->expects(self::any())->method('getPaths')->will(self::returnValue([__DIR__.'/_files'])); |
|
154 | 154 | |
155 | 155 | return $locator; |
156 | 156 | } |
@@ -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 |