@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | $locator->expects($this->once()) |
| 38 | 38 | ->method('findMappingFile') |
| 39 | 39 | ->with($this->equalTo('stdClass')) |
| 40 | - ->will($this->returnValue(__DIR__ . '/_files/stdClass.yml')); |
|
| 40 | + ->will($this->returnValue(__DIR__.'/_files/stdClass.yml')); |
|
| 41 | 41 | |
| 42 | 42 | $driver = $this->createTestFileDriver($locator); |
| 43 | 43 | |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | $locator->expects($this->once()) |
| 53 | 53 | ->method('findMappingFile') |
| 54 | 54 | ->with($this->equalTo('stdClass')) |
| 55 | - ->will($this->returnValue(__DIR__ . '/_files/stdClass.yml')); |
|
| 55 | + ->will($this->returnValue(__DIR__.'/_files/stdClass.yml')); |
|
| 56 | 56 | |
| 57 | 57 | $driver = $this->createTestFileDriver($locator); |
| 58 | 58 | |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | |
| 136 | 136 | public function testNonLocatorFallback() |
| 137 | 137 | { |
| 138 | - $driver = $this->createTestFileDriver(__DIR__ . '/_files', '.yml'); |
|
| 138 | + $driver = $this->createTestFileDriver(__DIR__.'/_files', '.yml'); |
|
| 139 | 139 | self::assertTrue($driver->isTransient('stdClass2')); |
| 140 | 140 | self::assertFalse($driver->isTransient('stdClass')); |
| 141 | 141 | } |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | { |
| 145 | 145 | $locator = $this->createMock(FileLocator::class); |
| 146 | 146 | $locator->expects($this->any())->method('getFileExtension')->will($this->returnValue('.yml')); |
| 147 | - $locator->expects($this->any())->method('getPaths')->will($this->returnValue([__DIR__ . '/_files'])); |
|
| 147 | + $locator->expects($this->any())->method('getPaths')->will($this->returnValue([__DIR__.'/_files'])); |
|
| 148 | 148 | |
| 149 | 149 | return $locator; |
| 150 | 150 | } |
@@ -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, |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | { |
| 15 | 15 | public function testGetPaths() |
| 16 | 16 | { |
| 17 | - $path = __DIR__ . '/_files'; |
|
| 17 | + $path = __DIR__.'/_files'; |
|
| 18 | 18 | $prefix = 'Foo'; |
| 19 | 19 | |
| 20 | 20 | $locator = new SymfonyFileLocator([$path => $prefix]); |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | public function testGetPrefixes() |
| 28 | 28 | { |
| 29 | - $path = __DIR__ . '/_files'; |
|
| 29 | + $path = __DIR__.'/_files'; |
|
| 30 | 30 | $prefix = 'Foo'; |
| 31 | 31 | |
| 32 | 32 | $locator = new SymfonyFileLocator([$path => $prefix]); |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | public function testFileExists() |
| 45 | 45 | { |
| 46 | - $path = __DIR__ . '/_files'; |
|
| 46 | + $path = __DIR__.'/_files'; |
|
| 47 | 47 | $prefix = 'Foo'; |
| 48 | 48 | |
| 49 | 49 | $locator = new SymfonyFileLocator([$path => $prefix], '.yml'); |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | public function testGetAllClassNames() |
| 58 | 58 | { |
| 59 | - $path = __DIR__ . '/_files'; |
|
| 59 | + $path = __DIR__.'/_files'; |
|
| 60 | 60 | $prefix = 'Foo'; |
| 61 | 61 | |
| 62 | 62 | $locator = new SymfonyFileLocator([$path => $prefix], '.yml'); |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | |
| 78 | 78 | public function testInvalidCustomNamespaceSeparator() |
| 79 | 79 | { |
| 80 | - $path = __DIR__ . '/_files'; |
|
| 80 | + $path = __DIR__.'/_files'; |
|
| 81 | 81 | $prefix = 'Foo'; |
| 82 | 82 | |
| 83 | 83 | $this->expectException(InvalidArgumentException::class); |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | */ |
| 105 | 105 | public function testGetClassNamesWithCustomNsSeparator($separator, $dir) |
| 106 | 106 | { |
| 107 | - $path = __DIR__ . $dir; |
|
| 107 | + $path = __DIR__.$dir; |
|
| 108 | 108 | $prefix = 'Foo'; |
| 109 | 109 | |
| 110 | 110 | $locator = new SymfonyFileLocator([$path => $prefix], '.yml', $separator); |
@@ -149,29 +149,29 @@ discard block |
||
| 149 | 149 | */ |
| 150 | 150 | public function testFindMappingFileWithCustomNsSeparator($separator, $dir, $files) |
| 151 | 151 | { |
| 152 | - $path = __DIR__ . $dir; |
|
| 152 | + $path = __DIR__.$dir; |
|
| 153 | 153 | $prefix = 'Foo'; |
| 154 | 154 | |
| 155 | 155 | $locator = new SymfonyFileLocator([$path => $prefix], '.yml', $separator); |
| 156 | 156 | |
| 157 | 157 | foreach ($files as $filePath => $className) { |
| 158 | - self::assertSame(realpath($path . '/' . $filePath), realpath($locator->findMappingFile($className))); |
|
| 158 | + self::assertSame(realpath($path.'/'.$filePath), realpath($locator->findMappingFile($className))); |
|
| 159 | 159 | } |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | public function testFindMappingFile() |
| 163 | 163 | { |
| 164 | - $path = __DIR__ . '/_files'; |
|
| 164 | + $path = __DIR__.'/_files'; |
|
| 165 | 165 | $prefix = 'Foo'; |
| 166 | 166 | |
| 167 | 167 | $locator = new SymfonyFileLocator([$path => $prefix], '.yml'); |
| 168 | 168 | |
| 169 | - self::assertSame(__DIR__ . '/_files/stdClass.yml', $locator->findMappingFile('Foo\\stdClass')); |
|
| 169 | + self::assertSame(__DIR__.'/_files/stdClass.yml', $locator->findMappingFile('Foo\\stdClass')); |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | public function testFindMappingFileNotFound() |
| 173 | 173 | { |
| 174 | - $path = __DIR__ . '/_files'; |
|
| 174 | + $path = __DIR__.'/_files'; |
|
| 175 | 175 | $prefix = 'Foo'; |
| 176 | 176 | |
| 177 | 177 | $locator = new SymfonyFileLocator([$path => $prefix], '.yml'); |
@@ -185,13 +185,13 @@ discard block |
||
| 185 | 185 | { |
| 186 | 186 | // Low -> High |
| 187 | 187 | $prefixes = []; |
| 188 | - $prefixes[__DIR__ . '/_match_ns'] = 'Foo'; |
|
| 189 | - $prefixes[__DIR__ . '/_match_ns/Bar'] = 'Foo\\Bar'; |
|
| 188 | + $prefixes[__DIR__.'/_match_ns'] = 'Foo'; |
|
| 189 | + $prefixes[__DIR__.'/_match_ns/Bar'] = 'Foo\\Bar'; |
|
| 190 | 190 | |
| 191 | 191 | $locator = new SymfonyFileLocator($prefixes, '.yml'); |
| 192 | 192 | |
| 193 | 193 | self::assertSame( |
| 194 | - __DIR__ . '/_match_ns/Bar/barEntity.yml', |
|
| 194 | + __DIR__.'/_match_ns/Bar/barEntity.yml', |
|
| 195 | 195 | $locator->findMappingFile("Foo\\Bar\\barEntity") |
| 196 | 196 | ); |
| 197 | 197 | } |
@@ -199,13 +199,13 @@ discard block |
||
| 199 | 199 | public function testFindMappingFileMostSpecificNamespaceFirst() |
| 200 | 200 | { |
| 201 | 201 | $prefixes = []; |
| 202 | - $prefixes[__DIR__ . '/_match_ns/Bar'] = 'Foo\\Bar'; |
|
| 203 | - $prefixes[__DIR__ . '/_match_ns'] = 'Foo'; |
|
| 202 | + $prefixes[__DIR__.'/_match_ns/Bar'] = 'Foo\\Bar'; |
|
| 203 | + $prefixes[__DIR__.'/_match_ns'] = 'Foo'; |
|
| 204 | 204 | |
| 205 | 205 | $locator = new SymfonyFileLocator($prefixes, '.yml'); |
| 206 | 206 | |
| 207 | 207 | self::assertSame( |
| 208 | - __DIR__ . '/_match_ns/Bar/barEntity.yml', |
|
| 208 | + __DIR__.'/_match_ns/Bar/barEntity.yml', |
|
| 209 | 209 | $locator->findMappingFile("Foo\\Bar\\barEntity") |
| 210 | 210 | ); |
| 211 | 211 | } |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | |
| 167 | 167 | private function getManagerFactory() |
| 168 | 168 | { |
| 169 | - return function (string $name) { |
|
| 169 | + return function(string $name) { |
|
| 170 | 170 | $mock = $this->createMock(ObjectManager::class); |
| 171 | 171 | |
| 172 | 172 | $driver = $this->createMock(MappingDriver::class); |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | |
| 213 | 213 | protected function getService(string $name) : object |
| 214 | 214 | { |
| 215 | - if (! isset($this->services[$name])) { |
|
| 215 | + if (!isset($this->services[$name])) { |
|
| 216 | 216 | $this->services[$name] = call_user_func($this->managerFactory, $name); |
| 217 | 217 | } |
| 218 | 218 | |