@@ -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 | } |
@@ -69,6 +69,6 @@ |
||
69 | 69 | |
70 | 70 | public function setFormatOutput(bool $formatOutput) |
71 | 71 | { |
72 | - $this->formatOutput = (boolean)$formatOutput; |
|
72 | + $this->formatOutput = (boolean) $formatOutput; |
|
73 | 73 | } |
74 | 74 | } |
@@ -40,7 +40,7 @@ |
||
40 | 40 | |
41 | 41 | public function enableExternalEntities(bool $enable = true): self |
42 | 42 | { |
43 | - $this->disableExternalEntities = !$enable; |
|
43 | + $this->disableExternalEntities = ! $enable; |
|
44 | 44 | return $this; |
45 | 45 | } |
46 | 46 |
@@ -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 |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | public function startVisiting($object): void |
54 | 54 | { |
55 | - if (!\is_object($object)) { |
|
55 | + if ( ! \is_object($object)) { |
|
56 | 56 | return; |
57 | 57 | } |
58 | 58 | $this->visitingSet->attach($object); |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | |
62 | 62 | public function stopVisiting($object): void |
63 | 63 | { |
64 | - if (!\is_object($object)) { |
|
64 | + if ( ! \is_object($object)) { |
|
65 | 65 | return; |
66 | 66 | } |
67 | 67 | $this->visitingSet->detach($object); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | |
75 | 75 | public function isVisiting($object): bool |
76 | 76 | { |
77 | - if (!\is_object($object)) { |
|
77 | + if ( ! \is_object($object)) { |
|
78 | 78 | return false; |
79 | 79 | } |
80 | 80 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | $path[] = \get_class($obj); |
89 | 89 | } |
90 | 90 | |
91 | - if (!$path) { |
|
91 | + if ( ! $path) { |
|
92 | 92 | return null; |
93 | 93 | } |
94 | 94 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | |
108 | 108 | public function getObject() |
109 | 109 | { |
110 | - return !$this->visitingStack->isEmpty() ? $this->visitingStack->top() : null; |
|
110 | + return ! $this->visitingStack->isEmpty() ? $this->visitingStack->top() : null; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | public function getVisitingStack() |
@@ -95,8 +95,7 @@ |
||
95 | 95 | ExpressionEvaluatorInterface $expressionEvaluator = null, |
96 | 96 | SerializationContextFactoryInterface $serializationContextFactory = null, |
97 | 97 | DeserializationContextFactoryInterface $deserializationContextFactory = null |
98 | - ) |
|
99 | - { |
|
98 | + ) { |
|
100 | 99 | $this->factory = $factory; |
101 | 100 | $this->handlerRegistry = $handlerRegistry; |
102 | 101 | $this->objectConstructor = $objectConstructor; |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | $context = $this->serializationContextFactory->createSerializationContext(); |
163 | 163 | } |
164 | 164 | |
165 | - if (!isset($this->serializationVisitors[$format])) { |
|
165 | + if ( ! isset($this->serializationVisitors[$format])) { |
|
166 | 166 | throw new UnsupportedFormatException(sprintf('The format "%s" is not supported for serialization.', $format)); |
167 | 167 | } |
168 | 168 | |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | $context = $this->deserializationContextFactory->createDeserializationContext(); |
182 | 182 | } |
183 | 183 | |
184 | - if (!isset($this->deserializationVisitors[$format])) { |
|
184 | + if ( ! isset($this->deserializationVisitors[$format])) { |
|
185 | 185 | throw new UnsupportedFormatException(sprintf('The format "%s" is not supported for deserialization.', $format)); |
186 | 186 | } |
187 | 187 | |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | $context = $this->serializationContextFactory->createSerializationContext(); |
203 | 203 | } |
204 | 204 | |
205 | - if (!isset($this->serializationVisitors['json'])) { |
|
205 | + if ( ! isset($this->serializationVisitors['json'])) { |
|
206 | 206 | throw new UnsupportedFormatException(sprintf('The format "%s" is not supported for fromArray.', 'json')); |
207 | 207 | } |
208 | 208 | |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | $result = $this->visit($navigator, $visitor, $context, $data, 'json', $type); |
215 | 215 | $result = $this->convertArrayObjects($result); |
216 | 216 | |
217 | - if (!\is_array($result)) { |
|
217 | + if ( ! \is_array($result)) { |
|
218 | 218 | throw new RuntimeException(sprintf( |
219 | 219 | 'The input data of type "%s" did not convert to an array, but got a result of type "%s".', |
220 | 220 | \is_object($data) ? \get_class($data) : \gettype($data), |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | $context = $this->deserializationContextFactory->createDeserializationContext(); |
235 | 235 | } |
236 | 236 | |
237 | - if (!isset($this->deserializationVisitors['json'])) { |
|
237 | + if ( ! isset($this->deserializationVisitors['json'])) { |
|
238 | 238 | throw new UnsupportedFormatException(sprintf('The format "%s" is not supported for fromArray.', 'json')); |
239 | 239 | } |
240 | 240 | |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | private function convertArrayObjects($data) |
266 | 266 | { |
267 | 267 | if ($data instanceof \ArrayObject || $data instanceof \stdClass) { |
268 | - $data = (array)$data; |
|
268 | + $data = (array) $data; |
|
269 | 269 | } |
270 | 270 | if (\is_array($data)) { |
271 | 271 | foreach ($data as $k => $v) { |
@@ -41,7 +41,7 @@ |
||
41 | 41 | */ |
42 | 42 | public function translateName(PropertyMetadata $property):string |
43 | 43 | { |
44 | - $name = preg_replace('/[A-Z]+/', $this->separator . '\\0', $property->name); |
|
44 | + $name = preg_replace('/[A-Z]+/', $this->separator.'\\0', $property->name); |
|
45 | 45 | |
46 | 46 | if ($this->lowerCase) { |
47 | 47 | return strtolower($name); |
@@ -35,10 +35,10 @@ discard block |
||
35 | 35 | |
36 | 36 | switch ($direction) { |
37 | 37 | case GraphNavigatorInterface::DIRECTION_DESERIALIZATION: |
38 | - return 'deserialize' . $type . 'From' . $format; |
|
38 | + return 'deserialize'.$type.'From'.$format; |
|
39 | 39 | |
40 | 40 | case GraphNavigatorInterface::DIRECTION_SERIALIZATION: |
41 | - return 'serialize' . $type . 'To' . $format; |
|
41 | + return 'serialize'.$type.'To'.$format; |
|
42 | 42 | |
43 | 43 | default: |
44 | 44 | throw new LogicException(sprintf('The direction %s does not exist; see GraphNavigatorInterface::DIRECTION_??? constants.', json_encode($direction))); |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | public function registerSubscribingHandler(SubscribingHandlerInterface $handler):void |
54 | 54 | { |
55 | 55 | foreach ($handler->getSubscribingMethods() as $methodData) { |
56 | - if (!isset($methodData['type'], $methodData['format'])) { |
|
56 | + if ( ! isset($methodData['type'], $methodData['format'])) { |
|
57 | 57 | throw new RuntimeException(sprintf('For each subscribing method a "type" and "format" attribute must be given, but only got "%s" for %s.', implode('" and "', array_keys($methodData)), \get_class($handler))); |
58 | 58 | } |
59 | 59 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | |
81 | 81 | public function getHandler(int $direction, string $typeName, string $format) |
82 | 82 | { |
83 | - if (!isset($this->handlers[$direction][$typeName][$format])) { |
|
83 | + if ( ! isset($this->handlers[$direction][$typeName][$format])) { |
|
84 | 84 | return null; |
85 | 85 | } |
86 | 86 |
@@ -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 |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | 'type' => $type, |
56 | 56 | 'format' => $format, |
57 | 57 | 'direction' => GraphNavigatorInterface::DIRECTION_SERIALIZATION, |
58 | - 'method' => 'serialize' . $type, |
|
58 | + 'method' => 'serialize'.$type, |
|
59 | 59 | ]; |
60 | 60 | } |
61 | 61 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | private function isDataXmlNull($data) |
119 | 119 | { |
120 | 120 | $attributes = $data->attributes('xsi', true); |
121 | - return isset($attributes['nil'][0]) && (string)$attributes['nil'][0] === 'true'; |
|
121 | + return isset($attributes['nil'][0]) && (string) $attributes['nil'][0] === 'true'; |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | public function deserializeDateTimeFromXml(XmlDeserializationVisitor $visitor, $data, array $type) |
@@ -177,13 +177,13 @@ discard block |
||
177 | 177 | |
178 | 178 | private function parseDateTime($data, array $type, $immutable = false) |
179 | 179 | { |
180 | - $timezone = !empty($type['params'][1]) ? new \DateTimeZone($type['params'][1]) : $this->defaultTimezone; |
|
180 | + $timezone = ! empty($type['params'][1]) ? new \DateTimeZone($type['params'][1]) : $this->defaultTimezone; |
|
181 | 181 | $format = $this->getDeserializationFormat($type); |
182 | 182 | |
183 | 183 | if ($immutable) { |
184 | - $datetime = \DateTimeImmutable::createFromFormat($format, (string)$data, $timezone); |
|
184 | + $datetime = \DateTimeImmutable::createFromFormat($format, (string) $data, $timezone); |
|
185 | 185 | } else { |
186 | - $datetime = \DateTime::createFromFormat($format, (string)$data, $timezone); |
|
186 | + $datetime = \DateTime::createFromFormat($format, (string) $data, $timezone); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | if (false === $datetime) { |
@@ -242,15 +242,15 @@ discard block |
||
242 | 242 | $format = 'P'; |
243 | 243 | |
244 | 244 | if (0 < $dateInterval->y) { |
245 | - $format .= $dateInterval->y . 'Y'; |
|
245 | + $format .= $dateInterval->y.'Y'; |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | if (0 < $dateInterval->m) { |
249 | - $format .= $dateInterval->m . 'M'; |
|
249 | + $format .= $dateInterval->m.'M'; |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | if (0 < $dateInterval->d) { |
253 | - $format .= $dateInterval->d . 'D'; |
|
253 | + $format .= $dateInterval->d.'D'; |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | if (0 < $dateInterval->h || 0 < $dateInterval->i || 0 < $dateInterval->s) { |
@@ -258,15 +258,15 @@ discard block |
||
258 | 258 | } |
259 | 259 | |
260 | 260 | if (0 < $dateInterval->h) { |
261 | - $format .= $dateInterval->h . 'H'; |
|
261 | + $format .= $dateInterval->h.'H'; |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | if (0 < $dateInterval->i) { |
265 | - $format .= $dateInterval->i . 'M'; |
|
265 | + $format .= $dateInterval->i.'M'; |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | if (0 < $dateInterval->s) { |
269 | - $format .= $dateInterval->s . 'S'; |
|
269 | + $format .= $dateInterval->s.'S'; |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | if ($format === 'P') { |