@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | 'type' => $type, |
55 | 55 | 'format' => $format, |
56 | 56 | 'direction' => GraphNavigatorInterface::DIRECTION_SERIALIZATION, |
57 | - 'method' => 'serialize' . $type, |
|
57 | + 'method' => 'serialize'.$type, |
|
58 | 58 | ); |
59 | 59 | } |
60 | 60 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | private function isDataXmlNull($data) |
118 | 118 | { |
119 | 119 | $attributes = $data->attributes('xsi', true); |
120 | - return isset($attributes['nil'][0]) && (string)$attributes['nil'][0] === 'true'; |
|
120 | + return isset($attributes['nil'][0]) && (string) $attributes['nil'][0] === 'true'; |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | public function deserializeDateTimeFromXml(XmlDeserializationVisitor $visitor, $data, array $type) |
@@ -203,13 +203,13 @@ discard block |
||
203 | 203 | |
204 | 204 | private function parseDateTime($data, array $type, $immutable = false) |
205 | 205 | { |
206 | - $timezone = !empty($type['params'][1]) ? new \DateTimeZone($type['params'][1]) : $this->defaultTimezone; |
|
206 | + $timezone = ! empty($type['params'][1]) ? new \DateTimeZone($type['params'][1]) : $this->defaultTimezone; |
|
207 | 207 | $format = $this->getDeserializationFormat($type); |
208 | 208 | |
209 | 209 | if ($immutable) { |
210 | - $datetime = \DateTimeImmutable::createFromFormat($format, (string)$data, $timezone); |
|
210 | + $datetime = \DateTimeImmutable::createFromFormat($format, (string) $data, $timezone); |
|
211 | 211 | } else { |
212 | - $datetime = \DateTime::createFromFormat($format, (string)$data, $timezone); |
|
212 | + $datetime = \DateTime::createFromFormat($format, (string) $data, $timezone); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | if (false === $datetime) { |
@@ -268,15 +268,15 @@ discard block |
||
268 | 268 | $format = 'P'; |
269 | 269 | |
270 | 270 | if (0 < $dateInterval->y) { |
271 | - $format .= $dateInterval->y . 'Y'; |
|
271 | + $format .= $dateInterval->y.'Y'; |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | if (0 < $dateInterval->m) { |
275 | - $format .= $dateInterval->m . 'M'; |
|
275 | + $format .= $dateInterval->m.'M'; |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | if (0 < $dateInterval->d) { |
279 | - $format .= $dateInterval->d . 'D'; |
|
279 | + $format .= $dateInterval->d.'D'; |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | if (0 < $dateInterval->h || 0 < $dateInterval->i || 0 < $dateInterval->s) { |
@@ -284,15 +284,15 @@ discard block |
||
284 | 284 | } |
285 | 285 | |
286 | 286 | if (0 < $dateInterval->h) { |
287 | - $format .= $dateInterval->h . 'H'; |
|
287 | + $format .= $dateInterval->h.'H'; |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | if (0 < $dateInterval->i) { |
291 | - $format .= $dateInterval->i . 'M'; |
|
291 | + $format .= $dateInterval->i.'M'; |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | if (0 < $dateInterval->s) { |
295 | - $format .= $dateInterval->s . 'S'; |
|
295 | + $format .= $dateInterval->s.'S'; |
|
296 | 296 | } |
297 | 297 | |
298 | 298 | if ($format === 'P') { |
@@ -73,8 +73,7 @@ discard block |
||
73 | 73 | \DateTimeInterface $date, |
74 | 74 | array $type, |
75 | 75 | SerializationContext $context |
76 | - ) |
|
77 | - { |
|
76 | + ) { |
|
78 | 77 | if ($visitor instanceof XmlSerializationVisitor && false === $this->xmlCData) { |
79 | 78 | return $visitor->visitSimpleString($date->format($this->getFormat($type)), $type); |
80 | 79 | } |
@@ -97,8 +96,7 @@ discard block |
||
97 | 96 | \DateTimeImmutable $date, |
98 | 97 | array $type, |
99 | 98 | SerializationContext $context |
100 | - ) |
|
101 | - { |
|
99 | + ) { |
|
102 | 100 | return $this->serializeDateTimeInterface($visitor, $date, $type, $context); |
103 | 101 | } |
104 | 102 |
@@ -122,7 +122,7 @@ |
||
122 | 122 | private function getErrorMessage(FormError $error) |
123 | 123 | { |
124 | 124 | |
125 | - if ($this->translator === null){ |
|
125 | + if ($this->translator === null) { |
|
126 | 126 | return $error->getMessage(); |
127 | 127 | } |
128 | 128 |
@@ -122,7 +122,7 @@ |
||
122 | 122 | private function getErrorMessage(FormError $error) |
123 | 123 | { |
124 | 124 | |
125 | - if ($this->translator === null){ |
|
125 | + if ($this->translator === null) { |
|
126 | 126 | return $error->getMessage(); |
127 | 127 | } |
128 | 128 |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | 'direction' => GraphNavigatorInterface::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 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | public function serializeListToXml(XmlSerializationVisitor $visitor, ConstraintViolationList $list, array $type) |
52 | 52 | { |
53 | 53 | $currentNode = $visitor->getCurrentNode(); |
54 | - if (!$currentNode) { |
|
54 | + if ( ! $currentNode) { |
|
55 | 55 | $visitor->createRoot(); |
56 | 56 | } |
57 | 57 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | $violationNode = $visitor->getDocument()->createElement('violation'); |
76 | 76 | |
77 | 77 | $parent = $visitor->getCurrentNode(); |
78 | - if (!$parent) { |
|
78 | + if ( ! $parent) { |
|
79 | 79 | $visitor->setCurrentAndRootNode($violationNode); |
80 | 80 | } else { |
81 | 81 | $parent->appendChild($violationNode); |
@@ -21,7 +21,7 @@ |
||
21 | 21 | public function createDriver(array $metadataDirs, Reader $reader) |
22 | 22 | { |
23 | 23 | $driver = \call_user_func($this->callback, $metadataDirs, $reader); |
24 | - if (!$driver instanceof DriverInterface) { |
|
24 | + if ( ! $driver instanceof DriverInterface) { |
|
25 | 25 | throw new LogicException('The callback must return an instance of DriverInterface.'); |
26 | 26 | } |
27 | 27 |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | public function __construct($class, $name) |
60 | 60 | { |
61 | 61 | parent::__construct($class, $name); |
62 | - $this->closureAccessor = \Closure::bind(function ($o, $name) { |
|
62 | + $this->closureAccessor = \Closure::bind(function($o, $name) { |
|
63 | 63 | return $o->$name; |
64 | 64 | }, null, $class); |
65 | 65 | } |
@@ -69,22 +69,22 @@ discard block |
||
69 | 69 | $class = $this->reflection->getDeclaringClass(); |
70 | 70 | |
71 | 71 | if (empty($getter)) { |
72 | - if ($class->hasMethod('get' . $this->name) && $class->getMethod('get' . $this->name)->isPublic()) { |
|
73 | - $getter = 'get' . $this->name; |
|
74 | - } elseif ($class->hasMethod('is' . $this->name) && $class->getMethod('is' . $this->name)->isPublic()) { |
|
75 | - $getter = 'is' . $this->name; |
|
76 | - } elseif ($class->hasMethod('has' . $this->name) && $class->getMethod('has' . $this->name)->isPublic()) { |
|
77 | - $getter = 'has' . $this->name; |
|
72 | + if ($class->hasMethod('get'.$this->name) && $class->getMethod('get'.$this->name)->isPublic()) { |
|
73 | + $getter = 'get'.$this->name; |
|
74 | + } elseif ($class->hasMethod('is'.$this->name) && $class->getMethod('is'.$this->name)->isPublic()) { |
|
75 | + $getter = 'is'.$this->name; |
|
76 | + } elseif ($class->hasMethod('has'.$this->name) && $class->getMethod('has'.$this->name)->isPublic()) { |
|
77 | + $getter = 'has'.$this->name; |
|
78 | 78 | } else { |
79 | - 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)); |
|
79 | + 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)); |
|
80 | 80 | } |
81 | 81 | } |
82 | 82 | |
83 | - if (empty($setter) && !$this->readOnly) { |
|
84 | - if ($class->hasMethod('set' . $this->name) && $class->getMethod('set' . $this->name)->isPublic()) { |
|
85 | - $setter = 'set' . $this->name; |
|
83 | + if (empty($setter) && ! $this->readOnly) { |
|
84 | + if ($class->hasMethod('set'.$this->name) && $class->getMethod('set'.$this->name)->isPublic()) { |
|
85 | + $setter = 'set'.$this->name; |
|
86 | 86 | } else { |
87 | - 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)); |
|
87 | + 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)); |
|
88 | 88 | } |
89 | 89 | } |
90 | 90 | } |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | |
200 | 200 | parent::unserialize($parentStr); |
201 | 201 | |
202 | - $this->closureAccessor = \Closure::bind(function ($o, $name) { |
|
202 | + $this->closureAccessor = \Closure::bind(function($o, $name) { |
|
203 | 203 | return $o->$name; |
204 | 204 | }, null, $this->class); |
205 | 205 | } |
@@ -22,7 +22,7 @@ |
||
22 | 22 | |
23 | 23 | public function createDriver(array $metadataDirs, Reader $annotationReader) |
24 | 24 | { |
25 | - if (!empty($metadataDirs)) { |
|
25 | + if ( ! empty($metadataDirs)) { |
|
26 | 26 | $fileLocator = new FileLocator($metadataDirs); |
27 | 27 | |
28 | 28 | return new DriverChain(array( |
@@ -91,12 +91,12 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function setAccessorOrder($order, array $customOrder = array()) |
93 | 93 | { |
94 | - if (!in_array($order, array(self::ACCESSOR_ORDER_UNDEFINED, self::ACCESSOR_ORDER_ALPHABETICAL, self::ACCESSOR_ORDER_CUSTOM), true)) { |
|
94 | + if ( ! in_array($order, array(self::ACCESSOR_ORDER_UNDEFINED, self::ACCESSOR_ORDER_ALPHABETICAL, self::ACCESSOR_ORDER_CUSTOM), true)) { |
|
95 | 95 | throw new InvalidArgumentException(sprintf('The accessor order "%s" is invalid.', $order)); |
96 | 96 | } |
97 | 97 | |
98 | 98 | foreach ($customOrder as $name) { |
99 | - if (!\is_string($name)) { |
|
99 | + if ( ! \is_string($name)) { |
|
100 | 100 | throw new InvalidArgumentException(sprintf('$customOrder is expected to be a list of strings, but got element of value %s.', json_encode($name))); |
101 | 101 | } |
102 | 102 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | |
133 | 133 | public function merge(MergeableInterface $object) |
134 | 134 | { |
135 | - if (!$object instanceof ClassMetadata) { |
|
135 | + if ( ! $object instanceof ClassMetadata) { |
|
136 | 136 | throw new InvalidArgumentException('$object must be an instance of ClassMetadata.'); |
137 | 137 | } |
138 | 138 | parent::merge($object); |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | $this->discriminatorBaseClass, |
157 | 157 | $this->discriminatorBaseClass |
158 | 158 | )); |
159 | - } elseif (!$this->discriminatorFieldName && $object->discriminatorFieldName) { |
|
159 | + } elseif ( ! $this->discriminatorFieldName && $object->discriminatorFieldName) { |
|
160 | 160 | $this->discriminatorFieldName = $object->discriminatorFieldName; |
161 | 161 | $this->discriminatorMap = $object->discriminatorMap; |
162 | 162 | } |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | $this->discriminatorBaseClass = $object->discriminatorBaseClass; |
172 | 172 | } |
173 | 173 | |
174 | - if ($this->discriminatorMap && !$this->reflection->isAbstract()) { |
|
174 | + if ($this->discriminatorMap && ! $this->reflection->isAbstract()) { |
|
175 | 175 | if (false === $typeValue = array_search($this->name, $this->discriminatorMap, true)) { |
176 | 176 | throw new LogicException(sprintf( |
177 | 177 | 'The sub-class "%s" is not listed in the discriminator of the base class "%s".', |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | $this->discriminatorValue = $typeValue; |
184 | 184 | |
185 | 185 | if (isset($this->propertyMetadata[$this->discriminatorFieldName]) |
186 | - && !$this->propertyMetadata[$this->discriminatorFieldName] instanceof StaticPropertyMetadata |
|
186 | + && ! $this->propertyMetadata[$this->discriminatorFieldName] instanceof StaticPropertyMetadata |
|
187 | 187 | ) { |
188 | 188 | throw new LogicException(sprintf( |
189 | 189 | 'The discriminator field name "%s" of the base-class "%s" conflicts with a regular property of the sub-class "%s".', |
@@ -211,12 +211,12 @@ discard block |
||
211 | 211 | |
212 | 212 | public function registerNamespace($uri, $prefix = null) |
213 | 213 | { |
214 | - if (!\is_string($uri)) { |
|
214 | + if ( ! \is_string($uri)) { |
|
215 | 215 | throw new InvalidArgumentException(sprintf('$uri is expected to be a strings, but got value %s.', json_encode($uri))); |
216 | 216 | } |
217 | 217 | |
218 | 218 | if ($prefix !== null) { |
219 | - if (!\is_string($prefix)) { |
|
219 | + if ( ! \is_string($prefix)) { |
|
220 | 220 | throw new InvalidArgumentException(sprintf('$prefix is expected to be a strings, but got value %s.', json_encode($prefix))); |
221 | 221 | } |
222 | 222 | } else { |
@@ -309,19 +309,19 @@ discard block |
||
309 | 309 | case self::ACCESSOR_ORDER_CUSTOM: |
310 | 310 | $order = $this->customOrder; |
311 | 311 | $currentSorting = $this->propertyMetadata ? array_combine(array_keys($this->propertyMetadata), range(1, \count($this->propertyMetadata))) : []; |
312 | - uksort($this->propertyMetadata, function ($a, $b) use ($order, $currentSorting) { |
|
312 | + uksort($this->propertyMetadata, function($a, $b) use ($order, $currentSorting) { |
|
313 | 313 | $existsA = isset($order[$a]); |
314 | 314 | $existsB = isset($order[$b]); |
315 | 315 | |
316 | - if (!$existsA && !$existsB) { |
|
316 | + if ( ! $existsA && ! $existsB) { |
|
317 | 317 | return $currentSorting[$a] - $currentSorting[$b]; |
318 | 318 | } |
319 | 319 | |
320 | - if (!$existsA) { |
|
320 | + if ( ! $existsA) { |
|
321 | 321 | return 1; |
322 | 322 | } |
323 | 323 | |
324 | - if (!$existsB) { |
|
324 | + if ( ! $existsB) { |
|
325 | 325 | return -1; |
326 | 326 | } |
327 | 327 |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | |
30 | 30 | public function __construct($container, array $handlers = array()) |
31 | 31 | { |
32 | - if (!$container instanceof PsrContainerInterface && !$container instanceof ContainerInterface) { |
|
32 | + if ( ! $container instanceof PsrContainerInterface && ! $container instanceof ContainerInterface) { |
|
33 | 33 | throw new InvalidArgumentException(sprintf('The container must be an instance of %s or %s (%s given).', PsrContainerInterface::class, ContainerInterface::class, \is_object($container) ? \get_class($container) : \gettype($container))); |
34 | 34 | } |
35 | 35 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | return $this->initializedHandlers[$direction][$typeName][$format]; |
50 | 50 | } |
51 | 51 | |
52 | - if (!isset($this->handlers[$direction][$typeName][$format])) { |
|
52 | + if ( ! isset($this->handlers[$direction][$typeName][$format])) { |
|
53 | 53 | return null; |
54 | 54 | } |
55 | 55 |
@@ -42,7 +42,7 @@ |
||
42 | 42 | |
43 | 43 | public function setOptions(int $options): self |
44 | 44 | { |
45 | - $this->options = (integer)$options; |
|
45 | + $this->options = (integer) $options; |
|
46 | 46 | return $this; |
47 | 47 | } |
48 | 48 | } |