@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | |
36 | 36 | public static function getDefaultMethodName($eventName) |
37 | 37 | { |
38 | - return 'on' . str_replace(array('_', '.'), '', $eventName); |
|
38 | + return 'on'.str_replace(array('_', '.'), '', $eventName); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | public function addSubscriber(EventSubscriberInterface $subscriber) |
59 | 59 | { |
60 | 60 | foreach ($subscriber->getSubscribedEvents() as $eventData) { |
61 | - if (!isset($eventData['event'])) { |
|
61 | + if ( ! isset($eventData['event'])) { |
|
62 | 62 | throw new InvalidArgumentException(sprintf('Each event must have a "event" key.')); |
63 | 63 | } |
64 | 64 | |
@@ -72,24 +72,24 @@ discard block |
||
72 | 72 | |
73 | 73 | public function hasListeners($eventName, $class, $format) |
74 | 74 | { |
75 | - if (!isset($this->listeners[$eventName])) { |
|
75 | + if ( ! isset($this->listeners[$eventName])) { |
|
76 | 76 | return false; |
77 | 77 | } |
78 | 78 | |
79 | - if (!isset($this->classListeners[$eventName][$class][$format])) { |
|
79 | + if ( ! isset($this->classListeners[$eventName][$class][$format])) { |
|
80 | 80 | $this->classListeners[$eventName][$class][$format] = $this->initializeListeners($eventName, $class, $format); |
81 | 81 | } |
82 | 82 | |
83 | - return !!$this->classListeners[$eventName][$class][$format]; |
|
83 | + return ! ! $this->classListeners[$eventName][$class][$format]; |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | public function dispatch($eventName, $class, $format, Event $event) |
87 | 87 | { |
88 | - if (!isset($this->listeners[$eventName])) { |
|
88 | + if ( ! isset($this->listeners[$eventName])) { |
|
89 | 89 | return; |
90 | 90 | } |
91 | 91 | |
92 | - if (!isset($this->classListeners[$eventName][$class][$format])) { |
|
92 | + if ( ! isset($this->classListeners[$eventName][$class][$format])) { |
|
93 | 93 | $this->classListeners[$eventName][$class][$format] = $this->initializeListeners($eventName, $class, $format); |
94 | 94 | } |
95 | 95 |
@@ -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; |
@@ -64,13 +64,13 @@ |
||
64 | 64 | */ |
65 | 65 | public function evaluate($expression, array $data = array()) |
66 | 66 | { |
67 | - if (!\is_string($expression)) { |
|
67 | + if ( ! \is_string($expression)) { |
|
68 | 68 | return $expression; |
69 | 69 | } |
70 | 70 | |
71 | 71 | $context = $data + $this->context; |
72 | 72 | |
73 | - if (!array_key_exists($expression, $this->cache)) { |
|
73 | + if ( ! array_key_exists($expression, $this->cache)) { |
|
74 | 74 | $this->cache[$expression] = $this->expressionLanguage->parse($expression, array_keys($context)); |
75 | 75 | } |
76 | 76 |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | // Locate possible ObjectManager |
64 | 64 | $objectManager = $this->managerRegistry->getManagerForClass($metadata->name); |
65 | 65 | |
66 | - if (!$objectManager) { |
|
66 | + if ( ! $objectManager) { |
|
67 | 67 | // No ObjectManager found, proceed with normal deserialization |
68 | 68 | return $this->fallbackConstructor->construct($visitor, $metadata, $data, $type, $context); |
69 | 69 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | } |
78 | 78 | |
79 | 79 | // Managed entity, check for proxy load |
80 | - if (!\is_array($data)) { |
|
80 | + if ( ! \is_array($data)) { |
|
81 | 81 | // Single identifier, load proxy |
82 | 82 | return $objectManager->getReference($metadata->name, $data); |
83 | 83 | } |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $identifierList = array(); |
88 | 88 | |
89 | 89 | foreach ($classMetadata->getIdentifierFieldNames() as $name) { |
90 | - if (!array_key_exists($name, $data)) { |
|
90 | + if ( ! array_key_exists($name, $data)) { |
|
91 | 91 | return $this->fallbackConstructor->construct($visitor, $metadata, $data, $type, $context); |
92 | 92 | } |
93 | 93 |
@@ -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 |
@@ -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 |
@@ -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); |