@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | public function injectObjectManager(ObjectManager $objectManager, ClassMetadata $classMetadata) : void |
| 72 | 72 | { |
| 73 | 73 | if ($objectManager !== self::$objectManager) { |
| 74 | - throw new \RuntimeException('Trying to use PersistentObject with different ObjectManager instances. ' . |
|
| 74 | + throw new \RuntimeException('Trying to use PersistentObject with different ObjectManager instances. '. |
|
| 75 | 75 | 'Was PersistentObject::setObjectManager() called?'); |
| 76 | 76 | } |
| 77 | 77 | |
@@ -89,17 +89,17 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | private function set(string $field, array $args) : void |
| 91 | 91 | { |
| 92 | - if ($this->cm->hasField($field) && ! $this->cm->isIdentifier($field)) { |
|
| 92 | + if ($this->cm->hasField($field) && !$this->cm->isIdentifier($field)) { |
|
| 93 | 93 | $this->$field = $args[0]; |
| 94 | 94 | } elseif ($this->cm->hasAssociation($field) && $this->cm->isSingleValuedAssociation($field)) { |
| 95 | 95 | $targetClass = $this->cm->getAssociationTargetClass($field); |
| 96 | - if (! ($args[0] instanceof $targetClass) && $args[0] !== null) { |
|
| 97 | - throw new \InvalidArgumentException("Expected persistent object of type '" . $targetClass . "'"); |
|
| 96 | + if (!($args[0] instanceof $targetClass) && $args[0] !== null) { |
|
| 97 | + throw new \InvalidArgumentException("Expected persistent object of type '".$targetClass."'"); |
|
| 98 | 98 | } |
| 99 | 99 | $this->$field = $args[0]; |
| 100 | 100 | $this->completeOwningSide($field, $targetClass, $args[0]); |
| 101 | 101 | } else { |
| 102 | - throw new \BadMethodCallException("no field with name '" . $field . "' exists on '" . $this->cm->getName() . "'"); |
|
| 102 | + throw new \BadMethodCallException("no field with name '".$field."' exists on '".$this->cm->getName()."'"); |
|
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | return $this->$field; |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - throw new \BadMethodCallException("no field with name '" . $field . "' exists on '" . $this->cm->getName() . "'"); |
|
| 120 | + throw new \BadMethodCallException("no field with name '".$field."' exists on '".$this->cm->getName()."'"); |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | /** |
@@ -130,14 +130,14 @@ discard block |
||
| 130 | 130 | { |
| 131 | 131 | // add this object on the owning side as well, for obvious infinite recursion |
| 132 | 132 | // reasons this is only done when called on the inverse side. |
| 133 | - if (! $this->cm->isAssociationInverseSide($field)) { |
|
| 133 | + if (!$this->cm->isAssociationInverseSide($field)) { |
|
| 134 | 134 | return; |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | $mappedByField = $this->cm->getAssociationMappedByTargetField($field); |
| 138 | 138 | $targetMetadata = self::$objectManager->getClassMetadata($targetClass); |
| 139 | 139 | |
| 140 | - $setter = ($targetMetadata->isCollectionValuedAssociation($mappedByField) ? 'add' : 'set') . $mappedByField; |
|
| 140 | + $setter = ($targetMetadata->isCollectionValuedAssociation($mappedByField) ? 'add' : 'set').$mappedByField; |
|
| 141 | 141 | $targetObject->$setter($this); |
| 142 | 142 | } |
| 143 | 143 | |
@@ -152,15 +152,15 @@ discard block |
||
| 152 | 152 | */ |
| 153 | 153 | private function add(string $field, array $args) : void |
| 154 | 154 | { |
| 155 | - if (! $this->cm->hasAssociation($field) || ! $this->cm->isCollectionValuedAssociation($field)) { |
|
| 156 | - throw new \BadMethodCallException('There is no method add' . $field . '() on ' . $this->cm->getName()); |
|
| 155 | + if (!$this->cm->hasAssociation($field) || !$this->cm->isCollectionValuedAssociation($field)) { |
|
| 156 | + throw new \BadMethodCallException('There is no method add'.$field.'() on '.$this->cm->getName()); |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | $targetClass = $this->cm->getAssociationTargetClass($field); |
| 160 | - if (! ($args[0] instanceof $targetClass)) { |
|
| 161 | - throw new \InvalidArgumentException("Expected persistent object of type '" . $targetClass . "'"); |
|
| 160 | + if (!($args[0] instanceof $targetClass)) { |
|
| 161 | + throw new \InvalidArgumentException("Expected persistent object of type '".$targetClass."'"); |
|
| 162 | 162 | } |
| 163 | - if (! ($this->$field instanceof Collection)) { |
|
| 163 | + if (!($this->$field instanceof Collection)) { |
|
| 164 | 164 | $this->$field = new ArrayCollection($this->$field ?: []); |
| 165 | 165 | } |
| 166 | 166 | $this->$field->add($args[0]); |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | return; |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | - if (! self::$objectManager) { |
|
| 182 | + if (!self::$objectManager) { |
|
| 183 | 183 | throw new \RuntimeException('No runtime object manager set. Call PersistentObject#setObjectManager().'); |
| 184 | 184 | } |
| 185 | 185 | |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | } elseif ($command === 'add') { |
| 209 | 209 | $this->add($field, $args); |
| 210 | 210 | } else { |
| 211 | - throw new \BadMethodCallException('There is no method ' . $method . ' on ' . $this->cm->getName()); |
|
| 211 | + throw new \BadMethodCallException('There is no method '.$method.' on '.$this->cm->getName()); |
|
| 212 | 212 | } |
| 213 | 213 | } |
| 214 | 214 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | $name = $this->defaultConnection; |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - if (! isset($this->connections[$name])) { |
|
| 94 | + if (!isset($this->connections[$name])) { |
|
| 95 | 95 | throw new InvalidArgumentException(sprintf( |
| 96 | 96 | 'Doctrine %s Connection named "%s" does not exist.', |
| 97 | 97 | $this->name, |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | $name = $this->defaultManager; |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - if (! isset($this->managers[$name])) { |
|
| 153 | + if (!isset($this->managers[$name])) { |
|
| 154 | 154 | throw new InvalidArgumentException(sprintf('Doctrine %s Manager named "%s" does not exist.', $this->name, $name)); |
| 155 | 155 | } |
| 156 | 156 | |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | // Check for namespace alias |
| 166 | 166 | if (strpos($class, ':') !== false) { |
| 167 | 167 | list($namespaceAlias, $simpleClassName) = explode(':', $class, 2); |
| 168 | - $class = $this->getAliasNamespace($namespaceAlias) . '\\' . $simpleClassName; |
|
| 168 | + $class = $this->getAliasNamespace($namespaceAlias).'\\'.$simpleClassName; |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | $proxyClass = new ReflectionClass($class); |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | if ($proxyClass->implementsInterface($this->proxyInterfaceName)) { |
| 174 | 174 | $parentClass = $proxyClass->getParentClass(); |
| 175 | 175 | |
| 176 | - if (! $parentClass instanceof ClassMetadata) { |
|
| 176 | + if (!$parentClass instanceof ClassMetadata) { |
|
| 177 | 177 | return null; |
| 178 | 178 | } |
| 179 | 179 | |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | foreach ($this->managers as $id) { |
| 184 | 184 | $manager = $this->getService($id); |
| 185 | 185 | |
| 186 | - if (! $manager->getMetadataFactory()->isTransient($class)) { |
|
| 186 | + if (!$manager->getMetadataFactory()->isTransient($class)) { |
|
| 187 | 187 | return $manager; |
| 188 | 188 | } |
| 189 | 189 | } |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | $name = $this->defaultManager; |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | - if (! isset($this->managers[$name])) { |
|
| 233 | + if (!isset($this->managers[$name])) { |
|
| 234 | 234 | throw new \InvalidArgumentException(sprintf('Doctrine %s Manager named "%s" does not exist.', $this->name, $name)); |
| 235 | 235 | } |
| 236 | 236 | |
@@ -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, |
@@ -82,8 +82,8 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | $result = $this->loadMappingFile($this->locator->findMappingFile($className)); |
| 84 | 84 | |
| 85 | - if (! isset($result[$className])) { |
|
| 86 | - throw MappingException::invalidMappingFile($className, str_replace('\\', '.', $className) . $this->locator->getFileExtension()); |
|
| 85 | + if (!isset($result[$className])) { |
|
| 86 | + throw MappingException::invalidMappingFile($className, str_replace('\\', '.', $className).$this->locator->getFileExtension()); |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | $this->classCache[$className] = $result[$className]; |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | return false; |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - return ! $this->locator->fileExists($className); |
|
| 107 | + return !$this->locator->fileExists($className); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | /** |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | $this->initialize(); |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - if (! $this->classCache) { |
|
| 119 | + if (!$this->classCache) { |
|
| 120 | 120 | return (array) $this->locator->getAllClassNames($this->globalBasename); |
| 121 | 121 | } |
| 122 | 122 | |
@@ -154,8 +154,8 @@ discard block |
||
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | foreach ($this->locator->getPaths() as $path) { |
| 157 | - $file = $path . '/' . $this->globalBasename . $this->locator->getFileExtension(); |
|
| 158 | - if (! is_file($file)) { |
|
| 157 | + $file = $path.'/'.$this->globalBasename.$this->locator->getFileExtension(); |
|
| 158 | + if (!is_file($file)) { |
|
| 159 | 159 | continue; |
| 160 | 160 | } |
| 161 | 161 | |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | { |
| 77 | 77 | $this->reader = $reader; |
| 78 | 78 | |
| 79 | - if (! $paths) { |
|
| 79 | + if (!$paths) { |
|
| 80 | 80 | return; |
| 81 | 81 | } |
| 82 | 82 | |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | return $this->classNames; |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | - if (! $this->paths) { |
|
| 180 | + if (!$this->paths) { |
|
| 181 | 181 | throw MappingException::pathRequired(); |
| 182 | 182 | } |
| 183 | 183 | |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | $includedFiles = []; |
| 186 | 186 | |
| 187 | 187 | foreach ($this->paths as $path) { |
| 188 | - if (! is_dir($path)) { |
|
| 188 | + if (!is_dir($path)) { |
|
| 189 | 189 | throw MappingException::fileMappingDriversRequireConfiguredDirectoryPath($path); |
| 190 | 190 | } |
| 191 | 191 | |
@@ -194,14 +194,14 @@ discard block |
||
| 194 | 194 | new \RecursiveDirectoryIterator($path, \FilesystemIterator::SKIP_DOTS), |
| 195 | 195 | \RecursiveIteratorIterator::LEAVES_ONLY |
| 196 | 196 | ), |
| 197 | - '/^.+' . preg_quote($this->fileExtension) . '$/i', |
|
| 197 | + '/^.+'.preg_quote($this->fileExtension).'$/i', |
|
| 198 | 198 | \RecursiveRegexIterator::GET_MATCH |
| 199 | 199 | ); |
| 200 | 200 | |
| 201 | 201 | foreach ($iterator as $file) { |
| 202 | 202 | $sourceFile = $file[0]; |
| 203 | 203 | |
| 204 | - if (! preg_match('(^phar:)i', $sourceFile)) { |
|
| 204 | + if (!preg_match('(^phar:)i', $sourceFile)) { |
|
| 205 | 205 | $sourceFile = realpath($sourceFile); |
| 206 | 206 | } |
| 207 | 207 | |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | foreach ($declared as $className) { |
| 226 | 226 | $rc = new \ReflectionClass($className); |
| 227 | 227 | $sourceFile = $rc->getFileName(); |
| 228 | - if (! in_array($sourceFile, $includedFiles) || $this->isTransient($className)) { |
|
| 228 | + if (!in_array($sourceFile, $includedFiles) || $this->isTransient($className)) { |
|
| 229 | 229 | continue; |
| 230 | 230 | } |
| 231 | 231 | |
@@ -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 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | return $this->classNames; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - if (! $this->paths) { |
|
| 73 | + if (!$this->paths) { |
|
| 74 | 74 | throw MappingException::pathRequired(); |
| 75 | 75 | } |
| 76 | 76 | |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | $includedFiles = []; |
| 79 | 79 | |
| 80 | 80 | foreach ($this->paths as $path) { |
| 81 | - if (! is_dir($path)) { |
|
| 81 | + if (!is_dir($path)) { |
|
| 82 | 82 | throw MappingException::fileMappingDriversRequireConfiguredDirectoryPath($path); |
| 83 | 83 | } |
| 84 | 84 | |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | foreach ($declared as $className) { |
| 104 | 104 | $rc = new \ReflectionClass($className); |
| 105 | 105 | $sourceFile = $rc->getFileName(); |
| 106 | - if (! in_array($sourceFile, $includedFiles) || $this->isTransient($className)) { |
|
| 106 | + if (!in_array($sourceFile, $includedFiles) || $this->isTransient($className)) { |
|
| 107 | 107 | continue; |
| 108 | 108 | } |
| 109 | 109 | |
@@ -120,6 +120,6 @@ discard block |
||
| 120 | 120 | */ |
| 121 | 121 | public function isTransient(string $className) : bool |
| 122 | 122 | { |
| 123 | - return ! method_exists($className, 'loadMetadata'); |
|
| 123 | + return !method_exists($className, 'loadMetadata'); |
|
| 124 | 124 | } |
| 125 | 125 | } |
@@ -93,7 +93,7 @@ |
||
| 93 | 93 | foreach ($this->drivers as $namespace => $driver) { |
| 94 | 94 | $oid = spl_object_hash($driver); |
| 95 | 95 | |
| 96 | - if (! isset($driverClasses[$oid])) { |
|
| 96 | + if (!isset($driverClasses[$oid])) { |
|
| 97 | 97 | $driverClasses[$oid] = $driver->getAllClassNames(); |
| 98 | 98 | } |
| 99 | 99 | |
@@ -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 | } |