@@ -59,22 +59,22 @@ |
||
| 59 | 59 | $class = $this->reflection->getDeclaringClass(); |
| 60 | 60 | |
| 61 | 61 | if (empty($getter)) { |
| 62 | - if ($class->hasMethod('get' . $this->name) && $class->getMethod('get' . $this->name)->isPublic()) { |
|
| 63 | - $getter = 'get' . $this->name; |
|
| 64 | - } elseif ($class->hasMethod('is' . $this->name) && $class->getMethod('is' . $this->name)->isPublic()) { |
|
| 65 | - $getter = 'is' . $this->name; |
|
| 66 | - } elseif ($class->hasMethod('has' . $this->name) && $class->getMethod('has' . $this->name)->isPublic()) { |
|
| 67 | - $getter = 'has' . $this->name; |
|
| 62 | + if ($class->hasMethod('get'.$this->name) && $class->getMethod('get'.$this->name)->isPublic()) { |
|
| 63 | + $getter = 'get'.$this->name; |
|
| 64 | + } elseif ($class->hasMethod('is'.$this->name) && $class->getMethod('is'.$this->name)->isPublic()) { |
|
| 65 | + $getter = 'is'.$this->name; |
|
| 66 | + } elseif ($class->hasMethod('has'.$this->name) && $class->getMethod('has'.$this->name)->isPublic()) { |
|
| 67 | + $getter = 'has'.$this->name; |
|
| 68 | 68 | } else { |
| 69 | - throw new RuntimeException(sprintf('There is neither a public %s method, nor a public %s method, nor a public %s method in class %s. Please specify which public method should be used for retrieving the value of the property %s.', 'get' . ucfirst($this->name), 'is' . ucfirst($this->name), 'has' . ucfirst($this->name), $this->class, $this->name)); |
|
| 69 | + throw new RuntimeException(sprintf('There is neither a public %s method, nor a public %s method, nor a public %s method in class %s. Please specify which public method should be used for retrieving the value of the property %s.', 'get'.ucfirst($this->name), 'is'.ucfirst($this->name), 'has'.ucfirst($this->name), $this->class, $this->name)); |
|
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - if (empty($setter) && !$this->readOnly) { |
|
| 74 | - if ($class->hasMethod('set' . $this->name) && $class->getMethod('set' . $this->name)->isPublic()) { |
|
| 75 | - $setter = 'set' . $this->name; |
|
| 73 | + if (empty($setter) && ! $this->readOnly) { |
|
| 74 | + if ($class->hasMethod('set'.$this->name) && $class->getMethod('set'.$this->name)->isPublic()) { |
|
| 75 | + $setter = 'set'.$this->name; |
|
| 76 | 76 | } else { |
| 77 | - throw new RuntimeException(sprintf('There is no public %s method in class %s. Please specify which public method should be used for setting the value of the property %s.', 'set' . ucfirst($this->name), $this->class, $this->name)); |
|
| 77 | + throw new RuntimeException(sprintf('There is no public %s method in class %s. Please specify which public method should be used for setting the value of the property %s.', 'set'.ucfirst($this->name), $this->class, $this->name)); |
|
| 78 | 78 | } |
| 79 | 79 | } |
| 80 | 80 | } |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | $classMetadata = $this->delegate->loadMetadataForClass($class); |
| 84 | 84 | |
| 85 | 85 | // Abort if the given class is not a mapped entity |
| 86 | - if (!$doctrineMetadata = $this->tryLoadingDoctrineMetadata($class->name)) { |
|
| 86 | + if ( ! $doctrineMetadata = $this->tryLoadingDoctrineMetadata($class->name)) { |
|
| 87 | 87 | return $classMetadata; |
| 88 | 88 | } |
| 89 | 89 | |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | */ |
| 149 | 149 | protected function tryLoadingDoctrineMetadata($className) |
| 150 | 150 | { |
| 151 | - if (!$manager = $this->registry->getManagerForClass($className)) { |
|
| 151 | + if ( ! $manager = $this->registry->getManagerForClass($className)) { |
|
| 152 | 152 | return null; |
| 153 | 153 | } |
| 154 | 154 | |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | */ |
| 165 | 165 | protected function normalizeFieldType($type) |
| 166 | 166 | { |
| 167 | - if (!isset($this->fieldMapping[$type])) { |
|
| 167 | + if ( ! isset($this->fieldMapping[$type])) { |
|
| 168 | 168 | return; |
| 169 | 169 | } |
| 170 | 170 | |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | $propertyName = $propertyMetadata->name; |
| 44 | 44 | if ($doctrineMetadata->hasField($propertyName) && $fieldType = $this->normalizeFieldType($doctrineMetadata->getTypeOfField($propertyName))) { |
| 45 | 45 | $field = $doctrineMetadata->getFieldMapping($propertyName); |
| 46 | - if (!empty($field['multivalue'])) { |
|
| 46 | + if ( ! empty($field['multivalue'])) { |
|
| 47 | 47 | $fieldType = 'array'; |
| 48 | 48 | } |
| 49 | 49 | |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | return; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - if (!$doctrineMetadata->isSingleValuedAssociation($propertyName)) { |
|
| 62 | + if ( ! $doctrineMetadata->isSingleValuedAssociation($propertyName)) { |
|
| 63 | 63 | $targetEntity = "ArrayCollection<{$targetEntity}>"; |
| 64 | 64 | } |
| 65 | 65 | |
@@ -30,8 +30,8 @@ discard block |
||
| 30 | 30 | { |
| 31 | 31 | protected function setDiscriminator(DoctrineClassMetadata $doctrineMetadata, ClassMetadata $classMetadata) |
| 32 | 32 | { |
| 33 | - if (empty($classMetadata->discriminatorMap) && !$classMetadata->discriminatorDisabled |
|
| 34 | - && !empty($doctrineMetadata->discriminatorMap) && $doctrineMetadata->isRootEntity() |
|
| 33 | + if (empty($classMetadata->discriminatorMap) && ! $classMetadata->discriminatorDisabled |
|
| 34 | + && ! empty($doctrineMetadata->discriminatorMap) && $doctrineMetadata->isRootEntity() |
|
| 35 | 35 | ) { |
| 36 | 36 | $classMetadata->setDiscriminator( |
| 37 | 37 | $doctrineMetadata->discriminatorColumn['name'], |
@@ -55,11 +55,11 @@ discard block |
||
| 55 | 55 | // For inheritance schemes, we cannot add any type as we would only add the super-type of the hierarchy. |
| 56 | 56 | // On serialization, this would lead to only the supertype being serialized, and properties of subtypes |
| 57 | 57 | // being ignored. |
| 58 | - if ($targetMetadata instanceof DoctrineClassMetadata && !$targetMetadata->isInheritanceTypeNone()) { |
|
| 58 | + if ($targetMetadata instanceof DoctrineClassMetadata && ! $targetMetadata->isInheritanceTypeNone()) { |
|
| 59 | 59 | return; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - if (!$doctrineMetadata->isSingleValuedAssociation($propertyName)) { |
|
| 62 | + if ( ! $doctrineMetadata->isSingleValuedAssociation($propertyName)) { |
|
| 63 | 63 | $targetEntity = "ArrayCollection<{$targetEntity}>"; |
| 64 | 64 | } |
| 65 | 65 | |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | |
| 31 | 31 | public function __construct(array $values) |
| 32 | 32 | { |
| 33 | - if (!isset($values['value']) || !\is_string($values['value'])) { |
|
| 33 | + if ( ! isset($values['value']) || ! \is_string($values['value'])) { |
|
| 34 | 34 | throw new RuntimeException(sprintf('"value" must be a string.')); |
| 35 | 35 | } |
| 36 | 36 | |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | |
| 34 | 34 | public function __construct(array $values) |
| 35 | 35 | { |
| 36 | - if (!\is_string($values['value'])) { |
|
| 36 | + if ( ! \is_string($values['value'])) { |
|
| 37 | 37 | throw new RuntimeException('"value" must be a string.'); |
| 38 | 38 | } |
| 39 | 39 | |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | foreach ($data as $key => $value) { |
| 43 | - if (!property_exists(__CLASS__, $key)) { |
|
| 43 | + if ( ! property_exists(__CLASS__, $key)) { |
|
| 44 | 44 | throw new InvalidArgumentException(sprintf('Unknown property "%s" on annotation "%s".', $key, __CLASS__)); |
| 45 | 45 | } |
| 46 | 46 | $this->{$key} = $value; |
@@ -53,7 +53,7 @@ |
||
| 53 | 53 | $validator = $this->validator; |
| 54 | 54 | $groups = $context->hasAttribute('validation_groups') ? $context->getAttribute('validation_groups') : null; |
| 55 | 55 | |
| 56 | - if (!$groups) { |
|
| 56 | + if ( ! $groups) { |
|
| 57 | 57 | return; |
| 58 | 58 | } |
| 59 | 59 | |
@@ -41,8 +41,8 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | public function __construct($skipVirtualTypeInit = true, $initializeExcluded = false) |
| 43 | 43 | { |
| 44 | - $this->skipVirtualTypeInit = (bool)$skipVirtualTypeInit; |
|
| 45 | - $this->initializeExcluded = (bool)$initializeExcluded; |
|
| 44 | + $this->skipVirtualTypeInit = (bool) $skipVirtualTypeInit; |
|
| 45 | + $this->initializeExcluded = (bool) $initializeExcluded; |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | public function onPreSerialize(PreSerializeEvent $event) |
@@ -53,13 +53,13 @@ discard block |
||
| 53 | 53 | // If the set type name is not an actual class, but a faked type for which a custom handler exists, we do not |
| 54 | 54 | // modify it with this subscriber. Also, we forgo autoloading here as an instance of this type is already created, |
| 55 | 55 | // so it must be loaded if its a real class. |
| 56 | - $virtualType = !class_exists($type['name'], false); |
|
| 56 | + $virtualType = ! class_exists($type['name'], false); |
|
| 57 | 57 | |
| 58 | 58 | if ($object instanceof PersistentCollection |
| 59 | 59 | || $object instanceof MongoDBPersistentCollection |
| 60 | 60 | || $object instanceof PHPCRPersistentCollection |
| 61 | 61 | ) { |
| 62 | - if (!$virtualType) { |
|
| 62 | + if ( ! $virtualType) { |
|
| 63 | 63 | $event->setType('ArrayCollection'); |
| 64 | 64 | } |
| 65 | 65 | |
@@ -67,13 +67,13 @@ discard block |
||
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | if (($this->skipVirtualTypeInit && $virtualType) || |
| 70 | - (!$object instanceof Proxy && !$object instanceof ORMProxy) |
|
| 70 | + ( ! $object instanceof Proxy && ! $object instanceof ORMProxy) |
|
| 71 | 71 | ) { |
| 72 | 72 | return; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | // do not initialize the proxy if is going to be excluded by-class by some exclusion strategy |
| 76 | - if ($this->initializeExcluded === false && !$virtualType) { |
|
| 76 | + if ($this->initializeExcluded === false && ! $virtualType) { |
|
| 77 | 77 | $context = $event->getContext(); |
| 78 | 78 | $exclusionStrategy = $context->getExclusionStrategy(); |
| 79 | 79 | $metadata = $context->getMetadataFactory()->getMetadataForClass(get_parent_class($object)); |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | $object->__load(); |
| 86 | 86 | |
| 87 | - if (!$virtualType) { |
|
| 87 | + if ( ! $virtualType) { |
|
| 88 | 88 | $event->setType(get_parent_class($object), $type['params']); |
| 89 | 89 | } |
| 90 | 90 | } |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | { |
| 94 | 94 | $type = $event->getType(); |
| 95 | 95 | // is a virtual type? then there is no need to change the event name |
| 96 | - if (!class_exists($type['name'], false)) { |
|
| 96 | + if ( ! class_exists($type['name'], false)) { |
|
| 97 | 97 | return; |
| 98 | 98 | } |
| 99 | 99 | |