@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | { |
31 | 31 | protected function setDiscriminator(DoctrineClassMetadata $doctrineMetadata, ClassMetadata $classMetadata) |
32 | 32 | { |
33 | - if (empty($classMetadata->discriminatorMap) && !$classMetadata->discriminatorDisabled |
|
34 | - && !empty($doctrineMetadata->discriminatorMap) && $doctrineMetadata->isRootEntity() |
|
33 | + if (empty($classMetadata->discriminatorMap) && ! $classMetadata->discriminatorDisabled |
|
34 | + && ! empty($doctrineMetadata->discriminatorMap) && $doctrineMetadata->isRootEntity() |
|
35 | 35 | ) { |
36 | 36 | $classMetadata->setDiscriminator( |
37 | 37 | $doctrineMetadata->discriminatorColumn['name'], |
@@ -55,11 +55,11 @@ discard block |
||
55 | 55 | // For inheritance schemes, we cannot add any type as we would only add the super-type of the hierarchy. |
56 | 56 | // On serialization, this would lead to only the supertype being serialized, and properties of subtypes |
57 | 57 | // being ignored. |
58 | - if ($targetMetadata instanceof DoctrineClassMetadata && !$targetMetadata->isInheritanceTypeNone()) { |
|
58 | + if ($targetMetadata instanceof DoctrineClassMetadata && ! $targetMetadata->isInheritanceTypeNone()) { |
|
59 | 59 | return; |
60 | 60 | } |
61 | 61 | |
62 | - if (!$doctrineMetadata->isSingleValuedAssociation($propertyName)) { |
|
62 | + if ( ! $doctrineMetadata->isSingleValuedAssociation($propertyName)) { |
|
63 | 63 | $targetEntity = "ArrayCollection<{$targetEntity}>"; |
64 | 64 | } |
65 | 65 |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | |
42 | 42 | public function __construct($skipVirtualTypeInit = false, $initializeExcluded = true) |
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 | if ($exclusionStrategy !== null && $exclusionStrategy->shouldSkipClass($context->getMetadataFactory()->getMetadataForClass(get_parent_class($object)), $context)) { |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | |
84 | 84 | $object->__load(); |
85 | 85 | |
86 | - if (!$virtualType) { |
|
86 | + if ( ! $virtualType) { |
|
87 | 87 | $event->setType(get_parent_class($object), $type['params']); |
88 | 88 | } |
89 | 89 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | { |
93 | 93 | $type = $event->getType(); |
94 | 94 | // is a virtual type? then there is no need to change the event name |
95 | - if (!class_exists($type['name'], false)) { |
|
95 | + if ( ! class_exists($type['name'], false)) { |
|
96 | 96 | return; |
97 | 97 | } |
98 | 98 |
@@ -49,7 +49,7 @@ |
||
49 | 49 | |
50 | 50 | $validator = $this->validator; |
51 | 51 | $context->attributes->get('validation_groups')->map( |
52 | - function (array $groups) use ($event, $validator) { |
|
52 | + function(array $groups) use ($event, $validator) { |
|
53 | 53 | $list = $validator->validate($event->getObject(), $groups); |
54 | 54 | |
55 | 55 | if ($list->count() > 0) { |
@@ -37,11 +37,11 @@ |
||
37 | 37 | $listeners = parent::initializeListeners($eventName, $loweredClass, $format); |
38 | 38 | |
39 | 39 | foreach ($listeners as &$listener) { |
40 | - if (!is_array($listener) || !is_string($listener[0])) { |
|
40 | + if ( ! is_array($listener) || ! is_string($listener[0])) { |
|
41 | 41 | continue; |
42 | 42 | } |
43 | 43 | |
44 | - if (!$this->container->has($listener[0])) { |
|
44 | + if ( ! $this->container->has($listener[0])) { |
|
45 | 45 | continue; |
46 | 46 | } |
47 | 47 |
@@ -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,26 +72,26 @@ 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 | 79 | $loweredClass = strtolower($class); |
80 | - if (!isset($this->classListeners[$eventName][$loweredClass][$format])) { |
|
80 | + if ( ! isset($this->classListeners[$eventName][$loweredClass][$format])) { |
|
81 | 81 | $this->classListeners[$eventName][$loweredClass][$format] = $this->initializeListeners($eventName, $loweredClass, $format); |
82 | 82 | } |
83 | 83 | |
84 | - return !!$this->classListeners[$eventName][$loweredClass][$format]; |
|
84 | + return ! ! $this->classListeners[$eventName][$loweredClass][$format]; |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | public function dispatch($eventName, $class, $format, Event $event) |
88 | 88 | { |
89 | - if (!isset($this->listeners[$eventName])) { |
|
89 | + if ( ! isset($this->listeners[$eventName])) { |
|
90 | 90 | return; |
91 | 91 | } |
92 | 92 | |
93 | 93 | $loweredClass = strtolower($class); |
94 | - if (!isset($this->classListeners[$eventName][$loweredClass][$format])) { |
|
94 | + if ( ! isset($this->classListeners[$eventName][$loweredClass][$format])) { |
|
95 | 95 | $this->classListeners[$eventName][$loweredClass][$format] = $this->initializeListeners($eventName, $loweredClass, $format); |
96 | 96 | } |
97 | 97 |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | /x', |
51 | 51 | array(self::T_NAME => 'T_NAME', self::T_STRING => 'T_STRING', self::T_OPEN_BRACKET => 'T_OPEN_BRACKET', |
52 | 52 | self::T_CLOSE_BRACKET => 'T_CLOSE_BRACKET', self::T_COMMA => 'T_COMMA', self::T_NONE => 'T_NONE'), |
53 | - function ($value) { |
|
53 | + function($value) { |
|
54 | 54 | switch ($value[0]) { |
55 | 55 | case '"': |
56 | 56 | case "'": |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | protected function parseInternal() |
83 | 83 | { |
84 | 84 | $typeName = $this->match(self::T_NAME); |
85 | - if (!$this->lexer->isNext(self::T_OPEN_BRACKET)) { |
|
85 | + if ( ! $this->lexer->isNext(self::T_OPEN_BRACKET)) { |
|
86 | 86 | return array('name' => $typeName, 'params' => array()); |
87 | 87 | } |
88 | 88 |
@@ -124,24 +124,24 @@ discard block |
||
124 | 124 | |
125 | 125 | if (null === $this->document) { |
126 | 126 | $this->document = $this->createDocument(null, null, true); |
127 | - $this->currentNode->appendChild($doCData ? $this->document->createCDATASection($data) : $this->document->createTextNode((string)$data)); |
|
127 | + $this->currentNode->appendChild($doCData ? $this->document->createCDATASection($data) : $this->document->createTextNode((string) $data)); |
|
128 | 128 | |
129 | 129 | return; |
130 | 130 | } |
131 | 131 | |
132 | - return $doCData ? $this->document->createCDATASection($data) : $this->document->createTextNode((string)$data); |
|
132 | + return $doCData ? $this->document->createCDATASection($data) : $this->document->createTextNode((string) $data); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | public function visitSimpleString($data, array $type, Context $context) |
136 | 136 | { |
137 | 137 | if (null === $this->document) { |
138 | 138 | $this->document = $this->createDocument(null, null, true); |
139 | - $this->currentNode->appendChild($this->document->createTextNode((string)$data)); |
|
139 | + $this->currentNode->appendChild($this->document->createTextNode((string) $data)); |
|
140 | 140 | |
141 | 141 | return; |
142 | 142 | } |
143 | 143 | |
144 | - return $this->document->createTextNode((string)$data); |
|
144 | + return $this->document->createTextNode((string) $data); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | public function visitBoolean($data, array $type, Context $context) |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | $this->setCurrentNode($entryNode); |
190 | 190 | |
191 | 191 | if (null !== $keyAttributeName) { |
192 | - $entryNode->setAttribute($keyAttributeName, (string)$k); |
|
192 | + $entryNode->setAttribute($keyAttributeName, (string) $k); |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | if (null !== $node = $this->navigator->accept($v, $this->getElementType($type), $context)) { |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | $node = $this->navigator->accept($v, $metadata->type, $context); |
242 | 242 | $this->revertCurrentMetadata(); |
243 | 243 | |
244 | - if (!$node instanceof \DOMCharacterData) { |
|
244 | + if ( ! $node instanceof \DOMCharacterData) { |
|
245 | 245 | throw new RuntimeException(sprintf('Unsupported value for XML attribute for %s. Expected character data, but got %s.', $metadata->name, json_encode($v))); |
246 | 246 | } |
247 | 247 | $attributeName = $this->namingStrategy->translateName($metadata); |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | } |
252 | 252 | |
253 | 253 | if (($metadata->xmlValue && $this->currentNode->childNodes->length > 0) |
254 | - || (!$metadata->xmlValue && $this->hasValue) |
|
254 | + || ( ! $metadata->xmlValue && $this->hasValue) |
|
255 | 255 | ) { |
256 | 256 | throw new RuntimeException(sprintf('If you make use of @XmlValue, all other properties in the class must have the @XmlAttribute annotation. Invalid usage detected in class %s.', $metadata->class)); |
257 | 257 | } |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | $node = $this->navigator->accept($v, $metadata->type, $context); |
264 | 264 | $this->revertCurrentMetadata(); |
265 | 265 | |
266 | - if (!$node instanceof \DOMCharacterData) { |
|
266 | + if ( ! $node instanceof \DOMCharacterData) { |
|
267 | 267 | throw new RuntimeException(sprintf('Unsupported value for property %s::$%s. Expected character data, but got %s.', $metadata->reflection->class, $metadata->reflection->name, is_object($node) ? get_class($node) : gettype($node))); |
268 | 268 | } |
269 | 269 | |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | } |
274 | 274 | |
275 | 275 | if ($metadata->xmlAttributeMap) { |
276 | - if (!is_array($v)) { |
|
276 | + if ( ! is_array($v)) { |
|
277 | 277 | throw new RuntimeException(sprintf('Unsupported value type for XML attribute map. Expected array but got %s.', gettype($v))); |
278 | 278 | } |
279 | 279 | |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | $node = $this->navigator->accept($value, null, $context); |
283 | 283 | $this->revertCurrentMetadata(); |
284 | 284 | |
285 | - if (!$node instanceof \DOMCharacterData) { |
|
285 | + if ( ! $node instanceof \DOMCharacterData) { |
|
286 | 286 | throw new RuntimeException(sprintf('Unsupported value for a XML attribute map value. Expected character data, but got %s.', json_encode($v))); |
287 | 287 | } |
288 | 288 | |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | return; |
293 | 293 | } |
294 | 294 | |
295 | - if ($addEnclosingElement = !$this->isInLineCollection($metadata) && !$metadata->inline) { |
|
295 | + if ($addEnclosingElement = ! $this->isInLineCollection($metadata) && ! $metadata->inline) { |
|
296 | 296 | $elementName = $this->namingStrategy->translateName($metadata); |
297 | 297 | |
298 | 298 | $namespace = null !== $metadata->xmlNamespace |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | |
336 | 336 | private function isSkippableEmptyObject($node, PropertyMetadata $metadata) |
337 | 337 | { |
338 | - return $node === null && !$metadata->xmlCollection && $metadata->skipWhenEmpty; |
|
338 | + return $node === null && ! $metadata->xmlCollection && $metadata->skipWhenEmpty; |
|
339 | 339 | } |
340 | 340 | |
341 | 341 | private function isSkippableCollection(PropertyMetadata $metadata) |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | |
346 | 346 | private function isElementEmpty(\DOMElement $element) |
347 | 347 | { |
348 | - return !$element->hasChildNodes() && !$element->hasAttributes(); |
|
348 | + return ! $element->hasChildNodes() && ! $element->hasAttributes(); |
|
349 | 349 | } |
350 | 350 | |
351 | 351 | public function endVisitingObject(ClassMetadata $metadata, $data, array $type, Context $context) |
@@ -424,12 +424,12 @@ discard block |
||
424 | 424 | { |
425 | 425 | if (null === $this->document) { |
426 | 426 | $this->document = $this->createDocument(null, null, true); |
427 | - $this->currentNode->appendChild($textNode = $this->document->createTextNode((string)$data)); |
|
427 | + $this->currentNode->appendChild($textNode = $this->document->createTextNode((string) $data)); |
|
428 | 428 | |
429 | 429 | return $textNode; |
430 | 430 | } |
431 | 431 | |
432 | - return $this->document->createTextNode((string)$data); |
|
432 | + return $this->document->createTextNode((string) $data); |
|
433 | 433 | } |
434 | 434 | |
435 | 435 | /** |
@@ -446,7 +446,7 @@ discard block |
||
446 | 446 | |
447 | 447 | private function attachNullNamespace() |
448 | 448 | { |
449 | - if (!$this->nullWasVisited) { |
|
449 | + if ( ! $this->nullWasVisited) { |
|
450 | 450 | $this->document->documentElement->setAttributeNS( |
451 | 451 | 'http://www.w3.org/2000/xmlns/', |
452 | 452 | 'xmlns:xsi', |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | foreach ($metadata->xmlNamespaces as $prefix => $uri) { |
468 | 468 | $attribute = 'xmlns'; |
469 | 469 | if ($prefix !== '') { |
470 | - $attribute .= ':' . $prefix; |
|
470 | + $attribute .= ':'.$prefix; |
|
471 | 471 | } elseif ($element->namespaceURI === $uri) { |
472 | 472 | continue; |
473 | 473 | } |
@@ -483,19 +483,19 @@ discard block |
||
483 | 483 | if ($this->currentNode->isDefaultNamespace($namespace)) { |
484 | 484 | return $this->document->createElementNS($namespace, $tagName); |
485 | 485 | } |
486 | - if (!($prefix = $this->currentNode->lookupPrefix($namespace)) && !($prefix = $this->document->lookupPrefix($namespace))) { |
|
487 | - $prefix = 'ns-' . substr(sha1($namespace), 0, 8); |
|
486 | + if ( ! ($prefix = $this->currentNode->lookupPrefix($namespace)) && ! ($prefix = $this->document->lookupPrefix($namespace))) { |
|
487 | + $prefix = 'ns-'.substr(sha1($namespace), 0, 8); |
|
488 | 488 | } |
489 | - return $this->document->createElementNS($namespace, $prefix . ':' . $tagName); |
|
489 | + return $this->document->createElementNS($namespace, $prefix.':'.$tagName); |
|
490 | 490 | } |
491 | 491 | |
492 | 492 | private function setAttributeOnNode(\DOMElement $node, $name, $value, $namespace = null) |
493 | 493 | { |
494 | 494 | if (null !== $namespace) { |
495 | - if (!$prefix = $node->lookupPrefix($namespace)) { |
|
496 | - $prefix = 'ns-' . substr(sha1($namespace), 0, 8); |
|
495 | + if ( ! $prefix = $node->lookupPrefix($namespace)) { |
|
496 | + $prefix = 'ns-'.substr(sha1($namespace), 0, 8); |
|
497 | 497 | } |
498 | - $node->setAttributeNS($namespace, $prefix . ':' . $name, $value); |
|
498 | + $node->setAttributeNS($namespace, $prefix.':'.$name, $value); |
|
499 | 499 | } else { |
500 | 500 | $node->setAttribute($name, $value); |
501 | 501 | } |
@@ -519,6 +519,6 @@ discard block |
||
519 | 519 | */ |
520 | 520 | public function setFormatOutput($formatOutput) |
521 | 521 | { |
522 | - $this->formatOutput = (boolean)$formatOutput; |
|
522 | + $this->formatOutput = (boolean) $formatOutput; |
|
523 | 523 | } |
524 | 524 | } |
@@ -13,7 +13,7 @@ |
||
13 | 13 | { |
14 | 14 | public function createDriver(array $metadataDirs, Reader $annotationReader) |
15 | 15 | { |
16 | - if (!empty($metadataDirs)) { |
|
16 | + if ( ! empty($metadataDirs)) { |
|
17 | 17 | $fileLocator = new FileLocator($metadataDirs); |
18 | 18 | |
19 | 19 | return new DriverChain(array( |
@@ -20,7 +20,7 @@ |
||
20 | 20 | public function createDriver(array $metadataDirs, Reader $reader) |
21 | 21 | { |
22 | 22 | $driver = call_user_func($this->callback, $metadataDirs, $reader); |
23 | - if (!$driver instanceof DriverInterface) { |
|
23 | + if ( ! $driver instanceof DriverInterface) { |
|
24 | 24 | throw new \LogicException('The callback must return an instance of DriverInterface.'); |
25 | 25 | } |
26 | 26 |