@@ -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 |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | |
133 | 133 | private function assertMutable(): void |
134 | 134 | { |
135 | - if (!$this->initialized) { |
|
135 | + if ( ! $this->initialized) { |
|
136 | 136 | return; |
137 | 137 | } |
138 | 138 | |
@@ -169,8 +169,8 @@ discard block |
||
169 | 169 | throw new LogicException('The groups must not be empty.'); |
170 | 170 | } |
171 | 171 | |
172 | - $this->attributes['groups'] = (array)$groups; |
|
173 | - $this->addExclusionStrategy(new GroupsExclusionStrategy((array)$groups)); |
|
172 | + $this->attributes['groups'] = (array) $groups; |
|
173 | + $this->addExclusionStrategy(new GroupsExclusionStrategy((array) $groups)); |
|
174 | 174 | |
175 | 175 | return $this; |
176 | 176 | } |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | { |
228 | 228 | $metadata = $this->metadataStack->pop(); |
229 | 229 | |
230 | - if (!$metadata instanceof PropertyMetadata) { |
|
230 | + if ( ! $metadata instanceof PropertyMetadata) { |
|
231 | 231 | throw new RuntimeException('Context metadataStack not working well'); |
232 | 232 | } |
233 | 233 | } |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | { |
237 | 237 | $metadata = $this->metadataStack->pop(); |
238 | 238 | |
239 | - if (!$metadata instanceof ClassMetadata) { |
|
239 | + if ( ! $metadata instanceof ClassMetadata) { |
|
240 | 240 | throw new RuntimeException('Context metadataStack not working well'); |
241 | 241 | } |
242 | 242 | } |
@@ -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 |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | private $namingStrategy; |
42 | 42 | |
43 | - public function __construct(FileLocatorInterface $locator, PropertyNamingStrategyInterface $namingStrategy, AbstractParser $typeParser = null) |
|
43 | + public function __construct(FileLocatorInterface $locator, PropertyNamingStrategyInterface $namingStrategy, AbstractParser $typeParser = null) |
|
44 | 44 | { |
45 | 45 | parent::__construct($locator); |
46 | 46 | $this->typeParser = $typeParser ?: new TypeParser(); |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | { |
52 | 52 | $config = Yaml::parse(file_get_contents($file)); |
53 | 53 | |
54 | - if (!isset($config[$name = $class->name])) { |
|
54 | + if ( ! isset($config[$name = $class->name])) { |
|
55 | 55 | throw new RuntimeException(sprintf('Expected metadata for class %s to be defined in %s.', $class->name, $file)); |
56 | 56 | } |
57 | 57 | |
@@ -60,9 +60,9 @@ discard block |
||
60 | 60 | $metadata->fileResources[] = $file; |
61 | 61 | $metadata->fileResources[] = $class->getFileName(); |
62 | 62 | $exclusionPolicy = isset($config['exclusion_policy']) ? strtoupper($config['exclusion_policy']) : 'NONE'; |
63 | - $excludeAll = isset($config['exclude']) ? (Boolean)$config['exclude'] : false; |
|
63 | + $excludeAll = isset($config['exclude']) ? (Boolean) $config['exclude'] : false; |
|
64 | 64 | $classAccessType = isset($config['access_type']) ? $config['access_type'] : PropertyMetadata::ACCESS_TYPE_PROPERTY; |
65 | - $readOnlyClass = isset($config['read_only']) ? (Boolean)$config['read_only'] : false; |
|
65 | + $readOnlyClass = isset($config['read_only']) ? (Boolean) $config['read_only'] : false; |
|
66 | 66 | $this->addClassProperties($metadata, $config); |
67 | 67 | |
68 | 68 | $propertiesMetadata = array(); |
@@ -74,20 +74,20 @@ discard block |
||
74 | 74 | |
75 | 75 | } else { |
76 | 76 | |
77 | - if (!$class->hasMethod($methodName)) { |
|
78 | - throw new RuntimeException('The method ' . $methodName . ' not found in class ' . $class->name); |
|
77 | + if ( ! $class->hasMethod($methodName)) { |
|
78 | + throw new RuntimeException('The method '.$methodName.' not found in class '.$class->name); |
|
79 | 79 | } |
80 | 80 | $virtualPropertyMetadata = new VirtualPropertyMetadata($name, $methodName); |
81 | 81 | } |
82 | 82 | |
83 | - $pName = !empty($propertySettings["name"]) ? $propertySettings["name"] : $virtualPropertyMetadata->name; |
|
83 | + $pName = ! empty($propertySettings["name"]) ? $propertySettings["name"] : $virtualPropertyMetadata->name; |
|
84 | 84 | |
85 | 85 | $propertiesMetadata[$pName] = $virtualPropertyMetadata; |
86 | 86 | $config['properties'][$pName] = $propertySettings; |
87 | 87 | } |
88 | 88 | } |
89 | 89 | |
90 | - if (!$excludeAll) { |
|
90 | + if ( ! $excludeAll) { |
|
91 | 91 | foreach ($class->getProperties() as $property) { |
92 | 92 | if ($property->class !== $name || (isset($property->info) && $property->info['class'] !== $name)) { |
93 | 93 | continue; |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | $pConfig = $config['properties'][$pName]; |
108 | 108 | |
109 | 109 | if (isset($pConfig['exclude'])) { |
110 | - $isExclude = (Boolean)$pConfig['exclude']; |
|
110 | + $isExclude = (Boolean) $pConfig['exclude']; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | if ($isExclude) { |
@@ -115,35 +115,35 @@ discard block |
||
115 | 115 | } |
116 | 116 | |
117 | 117 | if (isset($pConfig['expose'])) { |
118 | - $isExpose = (Boolean)$pConfig['expose']; |
|
118 | + $isExpose = (Boolean) $pConfig['expose']; |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | if (isset($pConfig['skip_when_empty'])) { |
122 | - $pMetadata->skipWhenEmpty = (Boolean)$pConfig['skip_when_empty']; |
|
122 | + $pMetadata->skipWhenEmpty = (Boolean) $pConfig['skip_when_empty']; |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | if (isset($pConfig['since_version'])) { |
126 | - $pMetadata->sinceVersion = (string)$pConfig['since_version']; |
|
126 | + $pMetadata->sinceVersion = (string) $pConfig['since_version']; |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | if (isset($pConfig['until_version'])) { |
130 | - $pMetadata->untilVersion = (string)$pConfig['until_version']; |
|
130 | + $pMetadata->untilVersion = (string) $pConfig['until_version']; |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | if (isset($pConfig['exclude_if'])) { |
134 | - $pMetadata->excludeIf = (string)$pConfig['exclude_if']; |
|
134 | + $pMetadata->excludeIf = (string) $pConfig['exclude_if']; |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | if (isset($pConfig['expose_if'])) { |
138 | - $pMetadata->excludeIf = "!(" . $pConfig['expose_if'] . ")"; |
|
138 | + $pMetadata->excludeIf = "!(".$pConfig['expose_if'].")"; |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | if (isset($pConfig['serialized_name'])) { |
142 | - $pMetadata->serializedName = (string)$pConfig['serialized_name']; |
|
142 | + $pMetadata->serializedName = (string) $pConfig['serialized_name']; |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | if (isset($pConfig['type'])) { |
146 | - $pMetadata->setType($this->typeParser->parse((string)$pConfig['type'])); |
|
146 | + $pMetadata->setType($this->typeParser->parse((string) $pConfig['type'])); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | if (isset($pConfig['groups'])) { |
@@ -155,21 +155,21 @@ discard block |
||
155 | 155 | |
156 | 156 | $colConfig = $pConfig['xml_list']; |
157 | 157 | if (isset($colConfig['inline'])) { |
158 | - $pMetadata->xmlCollectionInline = (Boolean)$colConfig['inline']; |
|
158 | + $pMetadata->xmlCollectionInline = (Boolean) $colConfig['inline']; |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | if (isset($colConfig['entry_name'])) { |
162 | - $pMetadata->xmlEntryName = (string)$colConfig['entry_name']; |
|
162 | + $pMetadata->xmlEntryName = (string) $colConfig['entry_name']; |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | if (isset($colConfig['skip_when_empty'])) { |
166 | - $pMetadata->xmlCollectionSkipWhenEmpty = (Boolean)$colConfig['skip_when_empty']; |
|
166 | + $pMetadata->xmlCollectionSkipWhenEmpty = (Boolean) $colConfig['skip_when_empty']; |
|
167 | 167 | } else { |
168 | 168 | $pMetadata->xmlCollectionSkipWhenEmpty = true; |
169 | 169 | } |
170 | 170 | |
171 | 171 | if (isset($colConfig['namespace'])) { |
172 | - $pMetadata->xmlEntryNamespace = (string)$colConfig['namespace']; |
|
172 | + $pMetadata->xmlEntryNamespace = (string) $colConfig['namespace']; |
|
173 | 173 | } |
174 | 174 | } |
175 | 175 | |
@@ -178,15 +178,15 @@ discard block |
||
178 | 178 | |
179 | 179 | $colConfig = $pConfig['xml_map']; |
180 | 180 | if (isset($colConfig['inline'])) { |
181 | - $pMetadata->xmlCollectionInline = (Boolean)$colConfig['inline']; |
|
181 | + $pMetadata->xmlCollectionInline = (Boolean) $colConfig['inline']; |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | if (isset($colConfig['entry_name'])) { |
185 | - $pMetadata->xmlEntryName = (string)$colConfig['entry_name']; |
|
185 | + $pMetadata->xmlEntryName = (string) $colConfig['entry_name']; |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | if (isset($colConfig['namespace'])) { |
189 | - $pMetadata->xmlEntryNamespace = (string)$colConfig['namespace']; |
|
189 | + $pMetadata->xmlEntryNamespace = (string) $colConfig['namespace']; |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | if (isset($colConfig['key_attribute_name'])) { |
@@ -198,33 +198,33 @@ discard block |
||
198 | 198 | if (isset($pConfig['xml_element'])) { |
199 | 199 | $colConfig = $pConfig['xml_element']; |
200 | 200 | if (isset($colConfig['cdata'])) { |
201 | - $pMetadata->xmlElementCData = (Boolean)$colConfig['cdata']; |
|
201 | + $pMetadata->xmlElementCData = (Boolean) $colConfig['cdata']; |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | if (isset($colConfig['namespace'])) { |
205 | - $pMetadata->xmlNamespace = (string)$colConfig['namespace']; |
|
205 | + $pMetadata->xmlNamespace = (string) $colConfig['namespace']; |
|
206 | 206 | } |
207 | 207 | } |
208 | 208 | |
209 | 209 | if (isset($pConfig['xml_attribute'])) { |
210 | - $pMetadata->xmlAttribute = (Boolean)$pConfig['xml_attribute']; |
|
210 | + $pMetadata->xmlAttribute = (Boolean) $pConfig['xml_attribute']; |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | if (isset($pConfig['xml_attribute_map'])) { |
214 | - $pMetadata->xmlAttributeMap = (Boolean)$pConfig['xml_attribute_map']; |
|
214 | + $pMetadata->xmlAttributeMap = (Boolean) $pConfig['xml_attribute_map']; |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | if (isset($pConfig['xml_value'])) { |
218 | - $pMetadata->xmlValue = (Boolean)$pConfig['xml_value']; |
|
218 | + $pMetadata->xmlValue = (Boolean) $pConfig['xml_value']; |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | if (isset($pConfig['xml_key_value_pairs'])) { |
222 | - $pMetadata->xmlKeyValuePairs = (Boolean)$pConfig['xml_key_value_pairs']; |
|
222 | + $pMetadata->xmlKeyValuePairs = (Boolean) $pConfig['xml_key_value_pairs']; |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | //we need read_only before setter and getter set, because that method depends on flag being set |
226 | 226 | if (isset($pConfig['read_only'])) { |
227 | - $pMetadata->readOnly = (Boolean)$pConfig['read_only']; |
|
227 | + $pMetadata->readOnly = (Boolean) $pConfig['read_only']; |
|
228 | 228 | } else { |
229 | 229 | $pMetadata->readOnly = $pMetadata->readOnly || $readOnlyClass; |
230 | 230 | } |
@@ -236,15 +236,15 @@ discard block |
||
236 | 236 | ); |
237 | 237 | |
238 | 238 | if (isset($pConfig['inline'])) { |
239 | - $pMetadata->inline = (Boolean)$pConfig['inline']; |
|
239 | + $pMetadata->inline = (Boolean) $pConfig['inline']; |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | if (isset($pConfig['max_depth'])) { |
243 | - $pMetadata->maxDepth = (int)$pConfig['max_depth']; |
|
243 | + $pMetadata->maxDepth = (int) $pConfig['max_depth']; |
|
244 | 244 | } |
245 | 245 | } |
246 | 246 | |
247 | - if (!$pMetadata->serializedName) { |
|
247 | + if ( ! $pMetadata->serializedName) { |
|
248 | 248 | $pMetadata->serializedName = $this->namingStrategy->translateName($pMetadata); |
249 | 249 | } |
250 | 250 | |
@@ -252,11 +252,11 @@ discard block |
||
252 | 252 | $pConfig = $config['properties'][$pName]; |
253 | 253 | |
254 | 254 | if (isset($pConfig['name'])) { |
255 | - $pMetadata->name = (string)$pConfig['name']; |
|
255 | + $pMetadata->name = (string) $pConfig['name']; |
|
256 | 256 | } |
257 | 257 | } |
258 | 258 | |
259 | - if ((ExclusionPolicy::NONE === $exclusionPolicy && !$isExclude) |
|
259 | + if ((ExclusionPolicy::NONE === $exclusionPolicy && ! $isExclude) |
|
260 | 260 | || (ExclusionPolicy::ALL === $exclusionPolicy && $isExpose) |
261 | 261 | ) { |
262 | 262 | $metadata->addPropertyMetadata($pMetadata); |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | |
289 | 289 | private function addClassProperties(ClassMetadata $metadata, array $config) |
290 | 290 | { |
291 | - if (isset($config['custom_accessor_order']) && !isset($config['accessor_order'])) { |
|
291 | + if (isset($config['custom_accessor_order']) && ! isset($config['accessor_order'])) { |
|
292 | 292 | $config['accessor_order'] = 'custom'; |
293 | 293 | } |
294 | 294 | |
@@ -297,11 +297,11 @@ discard block |
||
297 | 297 | } |
298 | 298 | |
299 | 299 | if (isset($config['xml_root_name'])) { |
300 | - $metadata->xmlRootName = (string)$config['xml_root_name']; |
|
300 | + $metadata->xmlRootName = (string) $config['xml_root_name']; |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | if (isset($config['xml_root_namespace'])) { |
304 | - $metadata->xmlRootNamespace = (string)$config['xml_root_namespace']; |
|
304 | + $metadata->xmlRootNamespace = (string) $config['xml_root_namespace']; |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | if (array_key_exists('xml_namespaces', $config)) { |
@@ -316,25 +316,25 @@ discard block |
||
316 | 316 | if (isset($config['discriminator']['disabled']) && true === $config['discriminator']['disabled']) { |
317 | 317 | $metadata->discriminatorDisabled = true; |
318 | 318 | } else { |
319 | - if (!isset($config['discriminator']['field_name'])) { |
|
319 | + if ( ! isset($config['discriminator']['field_name'])) { |
|
320 | 320 | throw new RuntimeException('The "field_name" attribute must be set for discriminators.'); |
321 | 321 | } |
322 | 322 | |
323 | - if (!isset($config['discriminator']['map']) || !\is_array($config['discriminator']['map'])) { |
|
323 | + if ( ! isset($config['discriminator']['map']) || ! \is_array($config['discriminator']['map'])) { |
|
324 | 324 | throw new RuntimeException('The "map" attribute must be set, and be an array for discriminators.'); |
325 | 325 | } |
326 | 326 | $groups = isset($config['discriminator']['groups']) ? $config['discriminator']['groups'] : array(); |
327 | 327 | $metadata->setDiscriminator($config['discriminator']['field_name'], $config['discriminator']['map'], $groups); |
328 | 328 | |
329 | 329 | if (isset($config['discriminator']['xml_attribute'])) { |
330 | - $metadata->xmlDiscriminatorAttribute = (bool)$config['discriminator']['xml_attribute']; |
|
330 | + $metadata->xmlDiscriminatorAttribute = (bool) $config['discriminator']['xml_attribute']; |
|
331 | 331 | } |
332 | 332 | if (isset($config['discriminator']['xml_element'])) { |
333 | 333 | if (isset($config['discriminator']['xml_element']['cdata'])) { |
334 | - $metadata->xmlDiscriminatorCData = (bool)$config['discriminator']['xml_element']['cdata']; |
|
334 | + $metadata->xmlDiscriminatorCData = (bool) $config['discriminator']['xml_element']['cdata']; |
|
335 | 335 | } |
336 | 336 | if (isset($config['discriminator']['xml_element']['namespace'])) { |
337 | - $metadata->xmlDiscriminatorNamespace = (string)$config['discriminator']['xml_element']['namespace']; |
|
337 | + $metadata->xmlDiscriminatorNamespace = (string) $config['discriminator']['xml_element']['namespace']; |
|
338 | 338 | } |
339 | 339 | } |
340 | 340 | |
@@ -346,13 +346,13 @@ discard block |
||
346 | 346 | { |
347 | 347 | if (\is_string($config)) { |
348 | 348 | $config = array($config); |
349 | - } elseif (!\is_array($config)) { |
|
349 | + } elseif ( ! \is_array($config)) { |
|
350 | 350 | throw new RuntimeException(sprintf('callback methods expects a string, or an array of strings that represent method names, but got %s.', json_encode($config['pre_serialize']))); |
351 | 351 | } |
352 | 352 | |
353 | 353 | $methods = array(); |
354 | 354 | foreach ($config as $name) { |
355 | - if (!$class->hasMethod($name)) { |
|
355 | + if ( ! $class->hasMethod($name)) { |
|
356 | 356 | throw new RuntimeException(sprintf('The method %s does not exist in class %s.', $name, $class->name)); |
357 | 357 | } |
358 | 358 |
@@ -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; |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | } |
149 | 149 | } |
150 | 150 | |
151 | - if (!$excludeAll) { |
|
151 | + if ( ! $excludeAll) { |
|
152 | 152 | foreach ($class->getProperties() as $property) { |
153 | 153 | if ($property->class !== $name || (isset($property->info) && $property->info['class'] !== $name)) { |
154 | 154 | continue; |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | } elseif ($annot instanceof Expose) { |
180 | 180 | $isExpose = true; |
181 | 181 | if (null !== $annot->if) { |
182 | - $propertyMetadata->excludeIf = "!(" . $annot->if . ")"; |
|
182 | + $propertyMetadata->excludeIf = "!(".$annot->if.")"; |
|
183 | 183 | } |
184 | 184 | } elseif ($annot instanceof Exclude) { |
185 | 185 | if (null !== $annot->if) { |
@@ -223,12 +223,12 @@ discard block |
||
223 | 223 | $accessor = array($annot->getter, $annot->setter); |
224 | 224 | } elseif ($annot instanceof Groups) { |
225 | 225 | $propertyMetadata->groups = $annot->groups; |
226 | - foreach ((array)$propertyMetadata->groups as $groupName) { |
|
226 | + foreach ((array) $propertyMetadata->groups as $groupName) { |
|
227 | 227 | if (false !== strpos($groupName, ',')) { |
228 | 228 | throw new InvalidArgumentException(sprintf( |
229 | 229 | 'Invalid group name "%s" on "%s", did you mean to create multiple groups?', |
230 | 230 | implode(', ', $propertyMetadata->groups), |
231 | - $propertyMetadata->class . '->' . $propertyMetadata->name |
|
231 | + $propertyMetadata->class.'->'.$propertyMetadata->name |
|
232 | 232 | )); |
233 | 233 | } |
234 | 234 | } |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | } |
242 | 242 | } |
243 | 243 | |
244 | - if (!$propertyMetadata->serializedName) { |
|
244 | + if ( ! $propertyMetadata->serializedName) { |
|
245 | 245 | $propertyMetadata->serializedName = $this->namingStrategy->translateName($propertyMetadata); |
246 | 246 | } |
247 | 247 | |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | } |
252 | 252 | } |
253 | 253 | |
254 | - if ((ExclusionPolicy::NONE === $exclusionPolicy && !$isExclude) |
|
254 | + if ((ExclusionPolicy::NONE === $exclusionPolicy && ! $isExclude) |
|
255 | 255 | || (ExclusionPolicy::ALL === $exclusionPolicy && $isExpose) |
256 | 256 | ) { |
257 | 257 | $propertyMetadata->setAccessor($accessType, $accessor[0], $accessor[1]); |