Completed
Pull Request — master (#844)
by Christian
03:19
created
src/JMS/Serializer/Metadata/Driver/DoctrinePHPCRTypeDriver.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
         $propertyName = $propertyMetadata->name;
44 44
         if ($doctrineMetadata->hasField($propertyName) && $fieldType = $this->normalizeFieldType($doctrineMetadata->getTypeOfField($propertyName))) {
45 45
             $field = $doctrineMetadata->getFieldMapping($propertyName);
46
-            if (!empty($field['multivalue'])) {
46
+            if ( ! empty($field['multivalue'])) {
47 47
                 $fieldType = 'array';
48 48
             }
49 49
 
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/JMS/Serializer/Metadata/Driver/PhpDriver.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
     {
29 29
         $metadata = require $file;
30 30
 
31
-        if (!$metadata instanceof ClassMetadata) {
31
+        if ( ! $metadata instanceof ClassMetadata) {
32 32
             throw new RuntimeException(sprintf('The file %s was expected to return an instance of ClassMetadata, but returned %s.', $file, json_encode($metadata)));
33 33
         }
34 34
         if ($metadata->name !== $class->name) {
Please login to merge, or discard this patch.
src/JMS/Serializer/Metadata/Driver/AbstractDoctrineTypeDriver.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
         $classMetadata = $this->delegate->loadMetadataForClass($class);
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
 
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
      */
149 149
     protected function tryLoadingDoctrineMetadata($className)
150 150
     {
151
-        if (!$manager = $this->registry->getManagerForClass($className)) {
151
+        if ( ! $manager = $this->registry->getManagerForClass($className)) {
152 152
             return null;
153 153
         }
154 154
 
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
      */
165 165
     protected function normalizeFieldType($type)
166 166
     {
167
-        if (!isset($this->fieldMapping[$type])) {
167
+        if ( ! isset($this->fieldMapping[$type])) {
168 168
             return;
169 169
         }
170 170
 
Please login to merge, or discard this patch.
src/JMS/Serializer/Metadata/Driver/DoctrineTypeDriver.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -30,8 +30,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/JMS/Serializer/EventDispatcher/Subscriber/DoctrineProxySubscriber.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
JMS/Serializer/EventDispatcher/Subscriber/SymfonyValidatorSubscriber.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
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) {
Please login to merge, or discard this patch.
src/JMS/Serializer/EventDispatcher/EventDispatcher.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/JMS/Serializer/TypeParser.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/JMS/Serializer/Builder/DefaultDriverFactory.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
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(
Please login to merge, or discard this patch.