@@ -56,7 +56,7 @@ |
||
| 56 | 56 | ? null |
| 57 | 57 | : $context->attributes->get('validation_groups')->get(); |
| 58 | 58 | |
| 59 | - if (!$groups) { |
|
| 59 | + if ( ! $groups) { |
|
| 60 | 60 | return; |
| 61 | 61 | } |
| 62 | 62 | |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | foreach ($data as $key => $value) { |
| 41 | - if (!property_exists(__CLASS__, $key)) { |
|
| 41 | + if ( ! property_exists(__CLASS__, $key)) { |
|
| 42 | 42 | throw new \BadMethodCallException(sprintf('Unknown property "%s" on annotation "%s".', $key, __CLASS__)); |
| 43 | 43 | } |
| 44 | 44 | $this->{$key} = $value; |
@@ -50,7 +50,7 @@ |
||
| 50 | 50 | $classMetadata = $context->getMetadataFactory()->getMetadataForClass('stdClass'); |
| 51 | 51 | $visitor->startVisitingObject($classMetadata, $stdClass, array('name' => 'stdClass'), $context); |
| 52 | 52 | |
| 53 | - foreach ((array)$stdClass as $name => $value) { |
|
| 53 | + foreach ((array) $stdClass as $name => $value) { |
|
| 54 | 54 | $metadata = new StaticPropertyMetadata('stdClass', $name, $value); |
| 55 | 55 | $visitor->visitProperty($metadata, $value, $context); |
| 56 | 56 | } |
@@ -24,7 +24,6 @@ |
||
| 24 | 24 | use JMS\Serializer\Annotation\AccessType; |
| 25 | 25 | use JMS\Serializer\Annotation\Discriminator; |
| 26 | 26 | use JMS\Serializer\Annotation\Exclude; |
| 27 | -use JMS\Serializer\Annotation\ExcludeIf; |
|
| 28 | 27 | use JMS\Serializer\Annotation\ExclusionPolicy; |
| 29 | 28 | use JMS\Serializer\Annotation\Expose; |
| 30 | 29 | use JMS\Serializer\Annotation\Groups; |
@@ -112,9 +112,9 @@ discard block |
||
| 112 | 112 | $classMetadata->setDiscriminator($annot->field, $annot->map, $annot->groups); |
| 113 | 113 | } |
| 114 | 114 | } elseif ($annot instanceof XmlDiscriminator) { |
| 115 | - $classMetadata->xmlDiscriminatorAttribute = (bool)$annot->attribute; |
|
| 116 | - $classMetadata->xmlDiscriminatorCData = (bool)$annot->cdata; |
|
| 117 | - $classMetadata->xmlDiscriminatorNamespace = $annot->namespace ? (string)$annot->namespace : null; |
|
| 115 | + $classMetadata->xmlDiscriminatorAttribute = (bool) $annot->attribute; |
|
| 116 | + $classMetadata->xmlDiscriminatorCData = (bool) $annot->cdata; |
|
| 117 | + $classMetadata->xmlDiscriminatorNamespace = $annot->namespace ? (string) $annot->namespace : null; |
|
| 118 | 118 | } elseif ($annot instanceof VirtualProperty) { |
| 119 | 119 | $virtualPropertyMetadata = new ExpressionPropertyMetadata($name, $annot->name, $annot->exp); |
| 120 | 120 | $propertiesMetadata[] = $virtualPropertyMetadata; |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | } |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - if (!$excludeAll) { |
|
| 154 | + if ( ! $excludeAll) { |
|
| 155 | 155 | foreach ($class->getProperties() as $property) { |
| 156 | 156 | if ($property->class !== $name || (isset($property->info) && $property->info['class'] !== $name)) { |
| 157 | 157 | continue; |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | } elseif ($annot instanceof Expose) { |
| 185 | 185 | $isExpose = true; |
| 186 | 186 | if (null !== $annot->if) { |
| 187 | - $propertyMetadata->excludeIf = "!(" . $annot->if . ")"; |
|
| 187 | + $propertyMetadata->excludeIf = "!(".$annot->if.")"; |
|
| 188 | 188 | } |
| 189 | 189 | } elseif ($annot instanceof Exclude) { |
| 190 | 190 | if (null !== $annot->if) { |
@@ -229,12 +229,12 @@ discard block |
||
| 229 | 229 | $accessor = array($annot->getter, $annot->setter); |
| 230 | 230 | } elseif ($annot instanceof Groups) { |
| 231 | 231 | $propertyMetadata->groups = $annot->groups; |
| 232 | - foreach ((array)$propertyMetadata->groups as $groupName) { |
|
| 232 | + foreach ((array) $propertyMetadata->groups as $groupName) { |
|
| 233 | 233 | if (false !== strpos($groupName, ',')) { |
| 234 | 234 | throw new InvalidArgumentException(sprintf( |
| 235 | 235 | 'Invalid group name "%s" on "%s", did you mean to create multiple groups?', |
| 236 | 236 | implode(', ', $propertyMetadata->groups), |
| 237 | - $propertyMetadata->class . '->' . $propertyMetadata->name |
|
| 237 | + $propertyMetadata->class.'->'.$propertyMetadata->name |
|
| 238 | 238 | )); |
| 239 | 239 | } |
| 240 | 240 | } |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | |
| 251 | - if ((ExclusionPolicy::NONE === $exclusionPolicy && !$isExclude) |
|
| 251 | + if ((ExclusionPolicy::NONE === $exclusionPolicy && ! $isExclude) |
|
| 252 | 252 | || (ExclusionPolicy::ALL === $exclusionPolicy && $isExpose) |
| 253 | 253 | ) { |
| 254 | 254 | $propertyMetadata->setAccessor( |
@@ -41,14 +41,14 @@ |
||
| 41 | 41 | 'direction' => GraphNavigator::DIRECTION_SERIALIZATION, |
| 42 | 42 | 'type' => $type, |
| 43 | 43 | 'format' => $format, |
| 44 | - 'method' => 'serialize' . $shortName, |
|
| 44 | + 'method' => 'serialize'.$shortName, |
|
| 45 | 45 | ); |
| 46 | 46 | |
| 47 | 47 | $methods[] = array( |
| 48 | 48 | 'direction' => GraphNavigator::DIRECTION_DESERIALIZATION, |
| 49 | 49 | 'type' => $type, |
| 50 | 50 | 'format' => $format, |
| 51 | - 'method' => 'deserialize' . $shortName, |
|
| 51 | + 'method' => 'deserialize'.$shortName, |
|
| 52 | 52 | ); |
| 53 | 53 | } |
| 54 | 54 | } |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | 'direction' => GraphNavigator::DIRECTION_SERIALIZATION, |
| 41 | 41 | 'type' => $type, |
| 42 | 42 | 'format' => $format, |
| 43 | - 'method' => $method . 'To' . $format, |
|
| 43 | + 'method' => $method.'To'.$format, |
|
| 44 | 44 | ); |
| 45 | 45 | } |
| 46 | 46 | } |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | 'type' => $type, |
| 54 | 54 | 'format' => $format, |
| 55 | 55 | 'direction' => GraphNavigator::DIRECTION_SERIALIZATION, |
| 56 | - 'method' => 'serialize' . $type, |
|
| 56 | + 'method' => 'serialize'.$type, |
|
| 57 | 57 | ); |
| 58 | 58 | } |
| 59 | 59 | } |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | private function isDataXmlNull($data) |
| 117 | 117 | { |
| 118 | 118 | $attributes = $data->attributes('xsi', true); |
| 119 | - return isset($attributes['nil'][0]) && (string)$attributes['nil'][0] === 'true'; |
|
| 119 | + return isset($attributes['nil'][0]) && (string) $attributes['nil'][0] === 'true'; |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | public function deserializeDateTimeFromXml(XmlDeserializationVisitor $visitor, $data, array $type) |
@@ -175,13 +175,13 @@ discard block |
||
| 175 | 175 | |
| 176 | 176 | private function parseDateTime($data, array $type, $immutable = false) |
| 177 | 177 | { |
| 178 | - $timezone = !empty($type['params'][1]) ? new \DateTimeZone($type['params'][1]) : $this->defaultTimezone; |
|
| 178 | + $timezone = ! empty($type['params'][1]) ? new \DateTimeZone($type['params'][1]) : $this->defaultTimezone; |
|
| 179 | 179 | $format = $this->getDeserializationFormat($type); |
| 180 | 180 | |
| 181 | 181 | if ($immutable) { |
| 182 | - $datetime = \DateTimeImmutable::createFromFormat($format, (string)$data, $timezone); |
|
| 182 | + $datetime = \DateTimeImmutable::createFromFormat($format, (string) $data, $timezone); |
|
| 183 | 183 | } else { |
| 184 | - $datetime = \DateTime::createFromFormat($format, (string)$data, $timezone); |
|
| 184 | + $datetime = \DateTime::createFromFormat($format, (string) $data, $timezone); |
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | if (false === $datetime) { |
@@ -236,15 +236,15 @@ discard block |
||
| 236 | 236 | $format = 'P'; |
| 237 | 237 | |
| 238 | 238 | if (0 < $dateInterval->y) { |
| 239 | - $format .= $dateInterval->y . 'Y'; |
|
| 239 | + $format .= $dateInterval->y.'Y'; |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | if (0 < $dateInterval->m) { |
| 243 | - $format .= $dateInterval->m . 'M'; |
|
| 243 | + $format .= $dateInterval->m.'M'; |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | if (0 < $dateInterval->d) { |
| 247 | - $format .= $dateInterval->d . 'D'; |
|
| 247 | + $format .= $dateInterval->d.'D'; |
|
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | if (0 < $dateInterval->h || 0 < $dateInterval->i || 0 < $dateInterval->s) { |
@@ -252,15 +252,15 @@ discard block |
||
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | if (0 < $dateInterval->h) { |
| 255 | - $format .= $dateInterval->h . 'H'; |
|
| 255 | + $format .= $dateInterval->h.'H'; |
|
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | if (0 < $dateInterval->i) { |
| 259 | - $format .= $dateInterval->i . 'M'; |
|
| 259 | + $format .= $dateInterval->i.'M'; |
|
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | if (0 < $dateInterval->s) { |
| 263 | - $format .= $dateInterval->s . 'S'; |
|
| 263 | + $format .= $dateInterval->s.'S'; |
|
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | if ($format === 'P') { |
@@ -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 | |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | { |
| 29 | 29 | $metadata = require $file; |
| 30 | 30 | |
| 31 | - if (!$metadata instanceof ClassMetadata) { |
|
| 31 | + if ( ! $metadata instanceof ClassMetadata) { |
|
| 32 | 32 | throw new RuntimeException(sprintf('The file %s was expected to return an instance of ClassMetadata, but returned %s.', $file, json_encode($metadata))); |
| 33 | 33 | } |
| 34 | 34 | if ($metadata->name !== $class->name) { |