@@ -35,13 +35,13 @@ |
||
| 35 | 35 | public function testGetParentClasses() |
| 36 | 36 | { |
| 37 | 37 | $classes = $this->reflectionService->getParentClasses(__CLASS__); |
| 38 | - self::assertTrue(count($classes) >= 1, "The test class " . __CLASS__ . " should have at least one parent."); |
|
| 38 | + self::assertTrue(count($classes) >= 1, "The test class ".__CLASS__." should have at least one parent."); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | public function testGetParentClassesForAbsentClass() |
| 42 | 42 | { |
| 43 | 43 | $this->expectException(MappingException::class); |
| 44 | - $this->reflectionService->getParentClasses(__NAMESPACE__ . '\AbsentClass'); |
|
| 44 | + $this->reflectionService->getParentClasses(__NAMESPACE__.'\AbsentClass'); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | public function testGetReflectionClass() |
@@ -108,7 +108,7 @@ |
||
| 108 | 108 | */ |
| 109 | 109 | private function assertValidField($field) |
| 110 | 110 | { |
| 111 | - if ( ! isset($this->entityChangeSet[$field])) { |
|
| 111 | + if (!isset($this->entityChangeSet[$field])) { |
|
| 112 | 112 | throw new \InvalidArgumentException(sprintf( |
| 113 | 113 | 'Field "%s" is not a valid field of the entity "%s" in PreUpdateEventArgs.', |
| 114 | 114 | $field, |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | public function injectObjectManager(ObjectManager $objectManager, ClassMetadata $classMetadata) |
| 82 | 82 | { |
| 83 | 83 | if ($objectManager !== self::$objectManager) { |
| 84 | - throw new \RuntimeException("Trying to use PersistentObject with different ObjectManager instances. " . |
|
| 84 | + throw new \RuntimeException("Trying to use PersistentObject with different ObjectManager instances. ". |
|
| 85 | 85 | "Was PersistentObject::setObjectManager() called?"); |
| 86 | 86 | } |
| 87 | 87 | |
@@ -101,17 +101,17 @@ discard block |
||
| 101 | 101 | */ |
| 102 | 102 | private function set($field, $args) |
| 103 | 103 | { |
| 104 | - if ($this->cm->hasField($field) && ! $this->cm->isIdentifier($field)) { |
|
| 104 | + if ($this->cm->hasField($field) && !$this->cm->isIdentifier($field)) { |
|
| 105 | 105 | $this->$field = $args[0]; |
| 106 | 106 | } elseif ($this->cm->hasAssociation($field) && $this->cm->isSingleValuedAssociation($field)) { |
| 107 | 107 | $targetClass = $this->cm->getAssociationTargetClass($field); |
| 108 | - if ( ! ($args[0] instanceof $targetClass) && $args[0] !== null) { |
|
| 109 | - throw new \InvalidArgumentException("Expected persistent object of type '" . $targetClass . "'"); |
|
| 108 | + if (!($args[0] instanceof $targetClass) && $args[0] !== null) { |
|
| 109 | + throw new \InvalidArgumentException("Expected persistent object of type '".$targetClass."'"); |
|
| 110 | 110 | } |
| 111 | 111 | $this->$field = $args[0]; |
| 112 | 112 | $this->completeOwningSide($field, $targetClass, $args[0]); |
| 113 | 113 | } else { |
| 114 | - throw new \BadMethodCallException("no field with name '" . $field . "' exists on '" . $this->cm->getName() . "'"); |
|
| 114 | + throw new \BadMethodCallException("no field with name '".$field."' exists on '".$this->cm->getName()."'"); |
|
| 115 | 115 | } |
| 116 | 116 | } |
| 117 | 117 | |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | return $this->$field; |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - throw new \BadMethodCallException("no field with name '" . $field . "' exists on '" . $this->cm->getName() . "'"); |
|
| 133 | + throw new \BadMethodCallException("no field with name '".$field."' exists on '".$this->cm->getName()."'"); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | /** |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | $mappedByField = $this->cm->getAssociationMappedByTargetField($field); |
| 151 | 151 | $targetMetadata = self::$objectManager->getClassMetadata($targetClass); |
| 152 | 152 | |
| 153 | - $setter = ($targetMetadata->isCollectionValuedAssociation($mappedByField) ? "add" : "set") . $mappedByField; |
|
| 153 | + $setter = ($targetMetadata->isCollectionValuedAssociation($mappedByField) ? "add" : "set").$mappedByField; |
|
| 154 | 154 | $targetObject->$setter($this); |
| 155 | 155 | } |
| 156 | 156 | } |
@@ -170,16 +170,16 @@ discard block |
||
| 170 | 170 | { |
| 171 | 171 | if ($this->cm->hasAssociation($field) && $this->cm->isCollectionValuedAssociation($field)) { |
| 172 | 172 | $targetClass = $this->cm->getAssociationTargetClass($field); |
| 173 | - if ( ! ($args[0] instanceof $targetClass)) { |
|
| 174 | - throw new \InvalidArgumentException("Expected persistent object of type '" . $targetClass . "'"); |
|
| 173 | + if (!($args[0] instanceof $targetClass)) { |
|
| 174 | + throw new \InvalidArgumentException("Expected persistent object of type '".$targetClass."'"); |
|
| 175 | 175 | } |
| 176 | - if ( ! ($this->$field instanceof Collection)) { |
|
| 176 | + if (!($this->$field instanceof Collection)) { |
|
| 177 | 177 | $this->$field = new ArrayCollection($this->$field ?: []); |
| 178 | 178 | } |
| 179 | 179 | $this->$field->add($args[0]); |
| 180 | 180 | $this->completeOwningSide($field, $targetClass, $args[0]); |
| 181 | 181 | } else { |
| 182 | - throw new \BadMethodCallException("There is no method add" . $field . "() on " . $this->cm->getName()); |
|
| 182 | + throw new \BadMethodCallException("There is no method add".$field."() on ".$this->cm->getName()); |
|
| 183 | 183 | } |
| 184 | 184 | } |
| 185 | 185 | |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | return; |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | - if ( ! self::$objectManager) { |
|
| 199 | + if (!self::$objectManager) { |
|
| 200 | 200 | throw new \RuntimeException("No runtime object manager set. Call PersistentObject#setObjectManager()."); |
| 201 | 201 | } |
| 202 | 202 | |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | } elseif ($command == "add") { |
| 227 | 227 | $this->add($field, $args); |
| 228 | 228 | } else { |
| 229 | - throw new \BadMethodCallException("There is no method " . $method . " on " . $this->cm->getName()); |
|
| 229 | + throw new \BadMethodCallException("There is no method ".$method." on ".$this->cm->getName()); |
|
| 230 | 230 | } |
| 231 | 231 | } |
| 232 | 232 | } |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | $name = $this->defaultConnection; |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - if ( ! isset($this->connections[$name])) { |
|
| 106 | + if (!isset($this->connections[$name])) { |
|
| 107 | 107 | throw new \InvalidArgumentException(sprintf('Doctrine %s Connection named "%s" does not exist.', $this->name, $name)); |
| 108 | 108 | } |
| 109 | 109 | |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | $name = $this->defaultManager; |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | - if ( ! isset($this->managers[$name])) { |
|
| 161 | + if (!isset($this->managers[$name])) { |
|
| 162 | 162 | throw new \InvalidArgumentException(sprintf('Doctrine %s Manager named "%s" does not exist.', $this->name, $name)); |
| 163 | 163 | } |
| 164 | 164 | |
@@ -173,13 +173,13 @@ discard block |
||
| 173 | 173 | // Check for namespace alias |
| 174 | 174 | if (strpos($class, ':') !== false) { |
| 175 | 175 | list($namespaceAlias, $simpleClassName) = explode(':', $class, 2); |
| 176 | - $class = $this->getAliasNamespace($namespaceAlias) . '\\' . $simpleClassName; |
|
| 176 | + $class = $this->getAliasNamespace($namespaceAlias).'\\'.$simpleClassName; |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | $proxyClass = new \ReflectionClass($class); |
| 180 | 180 | |
| 181 | 181 | if ($proxyClass->implementsInterface($this->proxyInterfaceName)) { |
| 182 | - if ( ! $parentClass = $proxyClass->getParentClass()) { |
|
| 182 | + if (!$parentClass = $proxyClass->getParentClass()) { |
|
| 183 | 183 | return null; |
| 184 | 184 | } |
| 185 | 185 | |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | foreach ($this->managers as $id) { |
| 190 | 190 | $manager = $this->getService($id); |
| 191 | 191 | |
| 192 | - if ( ! $manager->getMetadataFactory()->isTransient($class)) { |
|
| 192 | + if (!$manager->getMetadataFactory()->isTransient($class)) { |
|
| 193 | 193 | return $manager; |
| 194 | 194 | } |
| 195 | 195 | } |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | $name = $this->defaultManager; |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | - if ( ! isset($this->managers[$name])) { |
|
| 236 | + if (!isset($this->managers[$name])) { |
|
| 237 | 237 | throw new \InvalidArgumentException(sprintf('Doctrine %s Manager named "%s" does not exist.', $this->name, $name)); |
| 238 | 238 | } |
| 239 | 239 | |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | public function getParentClasses($class) |
| 21 | 21 | { |
| 22 | - if ( ! class_exists($class)) { |
|
| 22 | + if (!class_exists($class)) { |
|
| 23 | 23 | throw MappingException::nonExistingClass($class); |
| 24 | 24 | } |
| 25 | 25 | |
@@ -16,8 +16,8 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | public static function classNotFoundInNamespaces($className, $namespaces) |
| 18 | 18 | { |
| 19 | - return new self("The class '" . $className . "' was not found in the " . |
|
| 20 | - "chain configured namespaces " . implode(", ", $namespaces)); |
|
| 19 | + return new self("The class '".$className."' was not found in the ". |
|
| 20 | + "chain configured namespaces ".implode(", ", $namespaces)); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /** |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | public static function pathRequired() |
| 27 | 27 | { |
| 28 | - return new self("Specifying the paths to your entities is required " . |
|
| 28 | + return new self("Specifying the paths to your entities is required ". |
|
| 29 | 29 | "in the AnnotationDriver to retrieve all class names."); |
| 30 | 30 | } |
| 31 | 31 | |
@@ -36,13 +36,13 @@ discard block |
||
| 36 | 36 | */ |
| 37 | 37 | public static function fileMappingDriversRequireConfiguredDirectoryPath($path = null) |
| 38 | 38 | { |
| 39 | - if ( ! empty($path)) { |
|
| 40 | - $path = '[' . $path . ']'; |
|
| 39 | + if (!empty($path)) { |
|
| 40 | + $path = '['.$path.']'; |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | return new self( |
| 44 | - 'File mapping drivers must have a valid directory path, ' . |
|
| 45 | - 'however the given path ' . $path . ' seems to be incorrect!' |
|
| 44 | + 'File mapping drivers must have a valid directory path, '. |
|
| 45 | + 'however the given path '.$path.' seems to be incorrect!' |
|
| 46 | 46 | ); |
| 47 | 47 | } |
| 48 | 48 | |
@@ -90,12 +90,12 @@ discard block |
||
| 90 | 90 | */ |
| 91 | 91 | public function findMappingFile($className) |
| 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($className) |
| 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 | } |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | return $this->classNames; |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | - if ( ! $this->paths) { |
|
| 181 | + if (!$this->paths) { |
|
| 182 | 182 | throw MappingException::pathRequired(); |
| 183 | 183 | } |
| 184 | 184 | |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | $includedFiles = []; |
| 187 | 187 | |
| 188 | 188 | foreach ($this->paths as $path) { |
| 189 | - if ( ! is_dir($path)) { |
|
| 189 | + if (!is_dir($path)) { |
|
| 190 | 190 | throw MappingException::fileMappingDriversRequireConfiguredDirectoryPath($path); |
| 191 | 191 | } |
| 192 | 192 | |
@@ -195,14 +195,14 @@ discard block |
||
| 195 | 195 | new \RecursiveDirectoryIterator($path, \FilesystemIterator::SKIP_DOTS), |
| 196 | 196 | \RecursiveIteratorIterator::LEAVES_ONLY |
| 197 | 197 | ), |
| 198 | - '/^.+' . preg_quote($this->fileExtension) . '$/i', |
|
| 198 | + '/^.+'.preg_quote($this->fileExtension).'$/i', |
|
| 199 | 199 | \RecursiveRegexIterator::GET_MATCH |
| 200 | 200 | ); |
| 201 | 201 | |
| 202 | 202 | foreach ($iterator as $file) { |
| 203 | 203 | $sourceFile = $file[0]; |
| 204 | 204 | |
| 205 | - if ( ! preg_match('(^phar:)i', $sourceFile)) { |
|
| 205 | + if (!preg_match('(^phar:)i', $sourceFile)) { |
|
| 206 | 206 | $sourceFile = realpath($sourceFile); |
| 207 | 207 | } |
| 208 | 208 | |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | foreach ($declared as $className) { |
| 227 | 227 | $rc = new \ReflectionClass($className); |
| 228 | 228 | $sourceFile = $rc->getFileName(); |
| 229 | - if (in_array($sourceFile, $includedFiles) && ! $this->isTransient($className)) { |
|
| 229 | + if (in_array($sourceFile, $includedFiles) && !$this->isTransient($className)) { |
|
| 230 | 230 | $classes[] = $className; |
| 231 | 231 | } |
| 232 | 232 | } |
@@ -106,7 +106,7 @@ |
||
| 106 | 106 | foreach ($this->drivers as $namespace => $driver) { |
| 107 | 107 | $oid = spl_object_hash($driver); |
| 108 | 108 | |
| 109 | - if ( ! isset($driverClasses[$oid])) { |
|
| 109 | + if (!isset($driverClasses[$oid])) { |
|
| 110 | 110 | $driverClasses[$oid] = $driver->getAllClassNames(); |
| 111 | 111 | } |
| 112 | 112 | |