@@ -171,11 +171,11 @@ discard block |
||
171 | 171 | $metadata = $this->metadataFactory->getMetadataForClass($type['name']); |
172 | 172 | \assert($metadata instanceof ClassMetadata); |
173 | 173 | |
174 | - if ($metadata->usingExpression && !$this->expressionExclusionStrategy) { |
|
174 | + if ($metadata->usingExpression && ! $this->expressionExclusionStrategy) { |
|
175 | 175 | throw new ExpressionLanguageRequiredException(sprintf('To use conditional exclude/expose in %s you must configure the expression language.', $metadata->name)); |
176 | 176 | } |
177 | 177 | |
178 | - if (!empty($metadata->discriminatorMap) && $type['name'] === $metadata->discriminatorBaseClass) { |
|
178 | + if ( ! empty($metadata->discriminatorMap) && $type['name'] === $metadata->discriminatorBaseClass) { |
|
179 | 179 | $metadata = $this->resolveMetadata($data, $metadata); |
180 | 180 | } |
181 | 181 | |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | { |
235 | 235 | $typeValue = $this->visitor->visitDiscriminatorMapProperty($data, $metadata); |
236 | 236 | |
237 | - if (!isset($metadata->discriminatorMap[$typeValue])) { |
|
237 | + if ( ! isset($metadata->discriminatorMap[$typeValue])) { |
|
238 | 238 | throw new LogicException(sprintf( |
239 | 239 | 'The type value "%s" does not exist in the discriminator map of class "%s". Available types: %s', |
240 | 240 | $typeValue, |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | && ($fieldType = $this->normalizeFieldType($typeOfFiled)) |
30 | 30 | ) { |
31 | 31 | $field = $doctrineMetadata->getFieldMapping($propertyName); |
32 | - if (!empty($field['multivalue'])) { |
|
32 | + if ( ! empty($field['multivalue'])) { |
|
33 | 33 | $fieldType = 'array'; |
34 | 34 | } |
35 | 35 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | return; |
46 | 46 | } |
47 | 47 | |
48 | - if (!$doctrineMetadata->isSingleValuedAssociation($propertyName)) { |
|
48 | + if ( ! $doctrineMetadata->isSingleValuedAssociation($propertyName)) { |
|
49 | 49 | $targetEntity = sprintf('ArrayCollection<%s>', $targetEntity); |
50 | 50 | } |
51 | 51 |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | \assert($classMetadata instanceof ClassMetadata); |
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 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | |
130 | 130 | protected function tryLoadingDoctrineMetadata(string $className): ?DoctrineClassMetadata |
131 | 131 | { |
132 | - if (!$manager = $this->registry->getManagerForClass($className)) { |
|
132 | + if ( ! $manager = $this->registry->getManagerForClass($className)) { |
|
133 | 133 | return null; |
134 | 134 | } |
135 | 135 | |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | |
143 | 143 | protected function normalizeFieldType(string $type): ?string |
144 | 144 | { |
145 | - if (!isset($this->fieldMapping[$type])) { |
|
145 | + if ( ! isset($this->fieldMapping[$type])) { |
|
146 | 146 | return null; |
147 | 147 | } |
148 | 148 |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | */ |
65 | 65 | public function startVisiting($object): void |
66 | 66 | { |
67 | - if (!\is_object($object)) { |
|
67 | + if ( ! \is_object($object)) { |
|
68 | 68 | return; |
69 | 69 | } |
70 | 70 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | */ |
78 | 78 | public function stopVisiting($object): void |
79 | 79 | { |
80 | - if (!\is_object($object)) { |
|
80 | + if ( ! \is_object($object)) { |
|
81 | 81 | return; |
82 | 82 | } |
83 | 83 | |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function isVisiting($object): bool |
96 | 96 | { |
97 | - if (!\is_object($object)) { |
|
97 | + if ( ! \is_object($object)) { |
|
98 | 98 | return false; |
99 | 99 | } |
100 | 100 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | $path[] = \get_class($obj); |
109 | 109 | } |
110 | 110 | |
111 | - if (!$path) { |
|
111 | + if ( ! $path) { |
|
112 | 112 | return null; |
113 | 113 | } |
114 | 114 | |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | |
128 | 128 | public function getObject(): ?object |
129 | 129 | { |
130 | - return !$this->visitingStack->isEmpty() ? $this->visitingStack->top() : null; |
|
130 | + return ! $this->visitingStack->isEmpty() ? $this->visitingStack->top() : null; |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | public function getVisitingStack(): \SplStack |
@@ -31,7 +31,7 @@ |
||
31 | 31 | |
32 | 32 | public function translateName(PropertyMetadata $property): string |
33 | 33 | { |
34 | - $name = preg_replace('/[A-Z]+/', $this->separator . '\\0', $property->name); |
|
34 | + $name = preg_replace('/[A-Z]+/', $this->separator.'\\0', $property->name); |
|
35 | 35 | |
36 | 36 | if ($this->lowerCase) { |
37 | 37 | return strtolower($name); |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | public static function getDefaultMethodName(string $eventName): string |
32 | 32 | { |
33 | - return 'on' . str_replace(['_', '.'], '', $eventName); |
|
33 | + return 'on'.str_replace(['_', '.'], '', $eventName); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | public function addSubscriber(EventSubscriberInterface $subscriber): void |
57 | 57 | { |
58 | 58 | foreach ($subscriber->getSubscribedEvents() as $eventData) { |
59 | - if (!isset($eventData['event'])) { |
|
59 | + if ( ! isset($eventData['event'])) { |
|
60 | 60 | throw new InvalidArgumentException(sprintf('Each event must have a "event" key.')); |
61 | 61 | } |
62 | 62 | |
@@ -71,33 +71,33 @@ discard block |
||
71 | 71 | |
72 | 72 | public function hasListeners(string $eventName, string $class, string $format): bool |
73 | 73 | { |
74 | - if (!isset($this->listeners[$eventName])) { |
|
74 | + if ( ! isset($this->listeners[$eventName])) { |
|
75 | 75 | return false; |
76 | 76 | } |
77 | 77 | |
78 | - if (!isset($this->classListeners[$eventName][$class][$format])) { |
|
78 | + if ( ! isset($this->classListeners[$eventName][$class][$format])) { |
|
79 | 79 | $this->classListeners[$eventName][$class][$format] = $this->initializeListeners($eventName, $class, $format); |
80 | 80 | } |
81 | 81 | |
82 | - return !!$this->classListeners[$eventName][$class][$format]; |
|
82 | + return ! ! $this->classListeners[$eventName][$class][$format]; |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | public function dispatch(string $eventName, string $class, string $format, Event $event): void |
86 | 86 | { |
87 | - if (!isset($this->listeners[$eventName])) { |
|
87 | + if ( ! isset($this->listeners[$eventName])) { |
|
88 | 88 | return; |
89 | 89 | } |
90 | 90 | |
91 | 91 | $object = $event instanceof ObjectEvent ? $event->getObject() : null; |
92 | 92 | $realClass = is_object($object) ? get_class($object) : ''; |
93 | - $objectClass = $realClass !== $class ? $realClass . $class : $class; |
|
93 | + $objectClass = $realClass !== $class ? $realClass.$class : $class; |
|
94 | 94 | |
95 | - if (!isset($this->classListeners[$eventName][$objectClass][$format])) { |
|
95 | + if ( ! isset($this->classListeners[$eventName][$objectClass][$format])) { |
|
96 | 96 | $this->classListeners[$eventName][$objectClass][$format] = $this->initializeListeners($eventName, $class, $format); |
97 | 97 | } |
98 | 98 | |
99 | 99 | foreach ($this->classListeners[$eventName][$objectClass][$format] as $listener) { |
100 | - if (!empty($listener[3]) && !($object instanceof $listener[3])) { |
|
100 | + if ( ! empty($listener[3]) && ! ($object instanceof $listener[3])) { |
|
101 | 101 | continue; |
102 | 102 | } |
103 | 103 |
@@ -40,14 +40,14 @@ discard block |
||
40 | 40 | // If the set type name is not an actual class, but a faked type for which a custom handler exists, we do not |
41 | 41 | // modify it with this subscriber. Also, we forgo autoloading here as an instance of this type is already created, |
42 | 42 | // so it must be loaded if its a real class. |
43 | - $virtualType = !class_exists($type['name'], false); |
|
43 | + $virtualType = ! class_exists($type['name'], false); |
|
44 | 44 | |
45 | 45 | if ( |
46 | 46 | $object instanceof PersistentCollection |
47 | 47 | || $object instanceof MongoDBPersistentCollection |
48 | 48 | || $object instanceof PHPCRPersistentCollection |
49 | 49 | ) { |
50 | - if (!$virtualType) { |
|
50 | + if ( ! $virtualType) { |
|
51 | 51 | $event->setType('ArrayCollection'); |
52 | 52 | } |
53 | 53 | |
@@ -56,13 +56,13 @@ discard block |
||
56 | 56 | |
57 | 57 | if ( |
58 | 58 | ($this->skipVirtualTypeInit && $virtualType) || |
59 | - (!$object instanceof Proxy && !$object instanceof LazyLoadingInterface) |
|
59 | + ( ! $object instanceof Proxy && ! $object instanceof LazyLoadingInterface) |
|
60 | 60 | ) { |
61 | 61 | return; |
62 | 62 | } |
63 | 63 | |
64 | 64 | // do not initialize the proxy if is going to be excluded by-class by some exclusion strategy |
65 | - if (false === $this->initializeExcluded && !$virtualType) { |
|
65 | + if (false === $this->initializeExcluded && ! $virtualType) { |
|
66 | 66 | $context = $event->getContext(); |
67 | 67 | $exclusionStrategy = $context->getExclusionStrategy(); |
68 | 68 | $metadata = $context->getMetadataFactory()->getMetadataForClass(get_parent_class($object)); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $object->__load(); |
78 | 78 | } |
79 | 79 | |
80 | - if (!$virtualType) { |
|
80 | + if ( ! $virtualType) { |
|
81 | 81 | $event->setType(get_parent_class($object), $type['params']); |
82 | 82 | } |
83 | 83 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | { |
87 | 87 | $type = $event->getType(); |
88 | 88 | // is a virtual type? then there is no need to change the event name |
89 | - if (!class_exists($type['name'], false)) { |
|
89 | + if ( ! class_exists($type['name'], false)) { |
|
90 | 90 | return; |
91 | 91 | } |
92 | 92 |
@@ -54,14 +54,14 @@ discard block |
||
54 | 54 | if ($this->nestedGroups) { |
55 | 55 | $groups = $this->getGroupsFor($navigatorContext); |
56 | 56 | |
57 | - if (!$property->groups) { |
|
58 | - return !in_array(self::DEFAULT_GROUP, $groups); |
|
57 | + if ( ! $property->groups) { |
|
58 | + return ! in_array(self::DEFAULT_GROUP, $groups); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | return $this->shouldSkipUsingGroups($property, $groups); |
62 | 62 | } else { |
63 | - if (!$property->groups) { |
|
64 | - return !isset($this->groups[self::DEFAULT_GROUP]); |
|
63 | + if ( ! $property->groups) { |
|
64 | + return ! isset($this->groups[self::DEFAULT_GROUP]); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | foreach ($property->groups as $group) { |
@@ -87,14 +87,14 @@ discard block |
||
87 | 87 | |
88 | 88 | public function getGroupsFor(Context $navigatorContext): array |
89 | 89 | { |
90 | - if (!$this->nestedGroups) { |
|
90 | + if ( ! $this->nestedGroups) { |
|
91 | 91 | return array_keys($this->groups); |
92 | 92 | } |
93 | 93 | |
94 | 94 | $paths = $navigatorContext->getCurrentPath(); |
95 | 95 | $groups = $this->groups; |
96 | 96 | foreach ($paths as $index => $path) { |
97 | - if (!array_key_exists($path, $groups)) { |
|
97 | + if ( ! array_key_exists($path, $groups)) { |
|
98 | 98 | if ($index > 0) { |
99 | 99 | $groups = [self::DEFAULT_GROUP]; |
100 | 100 | } else { |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | } |
106 | 106 | |
107 | 107 | $groups = $groups[$path]; |
108 | - if (!array_filter($groups, 'is_string')) { |
|
108 | + if ( ! array_filter($groups, 'is_string')) { |
|
109 | 109 | $groups += [self::DEFAULT_GROUP]; |
110 | 110 | } |
111 | 111 | } |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | |
140 | 140 | switch ($type['name']) { |
141 | 141 | case 'NULL': |
142 | - if (!$this->shouldSerializeNull && !$this->isRootNullAllowed()) { |
|
142 | + if ( ! $this->shouldSerializeNull && ! $this->isRootNullAllowed()) { |
|
143 | 143 | throw new NotAcceptableException(); |
144 | 144 | } |
145 | 145 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | case 'resource': |
170 | 170 | $msg = 'Resources are not supported in serialized data.'; |
171 | 171 | if (null !== $path = $this->context->getPath()) { |
172 | - $msg .= ' Path: ' . $path; |
|
172 | + $msg .= ' Path: '.$path; |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | throw new RuntimeException($msg); |
@@ -235,8 +235,8 @@ discard block |
||
235 | 235 | throw new ExcludedClassException(); |
236 | 236 | } |
237 | 237 | |
238 | - if (!is_object($data)) { |
|
239 | - throw new InvalidArgumentException('Value at ' . $this->context->getPath() . ' is expected to be an object of class ' . $type['name'] . ' but is of type ' . gettype($data)); |
|
238 | + if ( ! is_object($data)) { |
|
239 | + throw new InvalidArgumentException('Value at '.$this->context->getPath().' is expected to be an object of class '.$type['name'].' but is of type '.gettype($data)); |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | $this->context->pushClassMetadata($metadata); |