@@ -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) { |
@@ -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 |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | $this->root = $data; |
59 | 59 | } |
60 | 60 | |
61 | - return (string)$data; |
|
61 | + return (string) $data; |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | public function visitBoolean($data, array $type, Context $context) |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | $this->root = $data; |
68 | 68 | } |
69 | 69 | |
70 | - return (boolean)$data; |
|
70 | + return (boolean) $data; |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | public function visitInteger($data, array $type, Context $context) |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $this->root = $data; |
77 | 77 | } |
78 | 78 | |
79 | - return (int)$data; |
|
79 | + return (int) $data; |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | public function visitDouble($data, array $type, Context $context) |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | $this->root = $data; |
86 | 86 | } |
87 | 87 | |
88 | - return (float)$data; |
|
88 | + return (float) $data; |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | /** |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | $rs = $isHash ? new \ArrayObject() : array(); |
106 | 106 | } |
107 | 107 | |
108 | - $isList = isset($type['params'][0]) && !isset($type['params'][1]); |
|
108 | + $isList = isset($type['params'][0]) && ! isset($type['params'][1]); |
|
109 | 109 | |
110 | 110 | foreach ($data as $k => $v) { |
111 | 111 | $v = $this->navigator->accept($v, $this->getElementType($type), $context); |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | |
111 | 111 | protected function getAccessorStrategy() |
112 | 112 | { |
113 | - if (!$this->accessorStrategy) { |
|
113 | + if ( ! $this->accessorStrategy) { |
|
114 | 114 | $this->accessorStrategy = new DefaultAccessorStrategy(); |
115 | 115 | |
116 | 116 | if ($this->expressionEvaluator) { |
@@ -134,17 +134,17 @@ discard block |
||
134 | 134 | |
135 | 135 | public function setDebug($bool) |
136 | 136 | { |
137 | - $this->debug = (boolean)$bool; |
|
137 | + $this->debug = (boolean) $bool; |
|
138 | 138 | |
139 | 139 | return $this; |
140 | 140 | } |
141 | 141 | |
142 | 142 | public function setCacheDir($dir) |
143 | 143 | { |
144 | - if (!is_dir($dir)) { |
|
144 | + if ( ! is_dir($dir)) { |
|
145 | 145 | $this->createDir($dir); |
146 | 146 | } |
147 | - if (!is_writable($dir)) { |
|
147 | + if ( ! is_writable($dir)) { |
|
148 | 148 | throw new InvalidArgumentException(sprintf('The cache directory "%s" is not writable.', $dir)); |
149 | 149 | } |
150 | 150 | |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | */ |
252 | 252 | public function includeInterfaceMetadata($include) |
253 | 253 | { |
254 | - $this->includeInterfaceMetadata = (Boolean)$include; |
|
254 | + $this->includeInterfaceMetadata = (Boolean) $include; |
|
255 | 255 | |
256 | 256 | return $this; |
257 | 257 | } |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | public function setMetadataDirs(array $namespacePrefixToDirMap) |
271 | 271 | { |
272 | 272 | foreach ($namespacePrefixToDirMap as $dir) { |
273 | - if (!is_dir($dir)) { |
|
273 | + if ( ! is_dir($dir)) { |
|
274 | 274 | throw new InvalidArgumentException(sprintf('The directory "%s" does not exist.', $dir)); |
275 | 275 | } |
276 | 276 | } |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | */ |
309 | 309 | public function addMetadataDir($dir, $namespacePrefix = '') |
310 | 310 | { |
311 | - if (!is_dir($dir)) { |
|
311 | + if ( ! is_dir($dir)) { |
|
312 | 312 | throw new InvalidArgumentException(sprintf('The directory "%s" does not exist.', $dir)); |
313 | 313 | } |
314 | 314 | |
@@ -350,11 +350,11 @@ discard block |
||
350 | 350 | */ |
351 | 351 | public function replaceMetadataDir($dir, $namespacePrefix = '') |
352 | 352 | { |
353 | - if (!is_dir($dir)) { |
|
353 | + if ( ! is_dir($dir)) { |
|
354 | 354 | throw new InvalidArgumentException(sprintf('The directory "%s" does not exist.', $dir)); |
355 | 355 | } |
356 | 356 | |
357 | - if (!isset($this->metadataDirs[$namespacePrefix])) { |
|
357 | + if ( ! isset($this->metadataDirs[$namespacePrefix])) { |
|
358 | 358 | throw new InvalidArgumentException(sprintf('There is no directory configured for namespace prefix "%s". Please use addMetadataDir() for adding new directories.', $namespacePrefix)); |
359 | 359 | } |
360 | 360 | |
@@ -417,8 +417,8 @@ discard block |
||
417 | 417 | $annotationReader = new AnnotationReader(); |
418 | 418 | |
419 | 419 | if (null !== $this->cacheDir) { |
420 | - $this->createDir($this->cacheDir . '/annotations'); |
|
421 | - $annotationsCache = new FilesystemCache($this->cacheDir . '/annotations'); |
|
420 | + $this->createDir($this->cacheDir.'/annotations'); |
|
421 | + $annotationsCache = new FilesystemCache($this->cacheDir.'/annotations'); |
|
422 | 422 | $annotationReader = new CachedReader($annotationReader, $annotationsCache, $this->debug); |
423 | 423 | } |
424 | 424 | } |
@@ -429,19 +429,19 @@ discard block |
||
429 | 429 | $metadataFactory->setIncludeInterfaces($this->includeInterfaceMetadata); |
430 | 430 | |
431 | 431 | if (null !== $this->cacheDir) { |
432 | - $this->createDir($this->cacheDir . '/metadata'); |
|
433 | - $metadataFactory->setCache(new FileCache($this->cacheDir . '/metadata')); |
|
432 | + $this->createDir($this->cacheDir.'/metadata'); |
|
433 | + $metadataFactory->setCache(new FileCache($this->cacheDir.'/metadata')); |
|
434 | 434 | } |
435 | 435 | |
436 | - if (!$this->handlersConfigured) { |
|
436 | + if ( ! $this->handlersConfigured) { |
|
437 | 437 | $this->addDefaultHandlers(); |
438 | 438 | } |
439 | 439 | |
440 | - if (!$this->listenersConfigured) { |
|
440 | + if ( ! $this->listenersConfigured) { |
|
441 | 441 | $this->addDefaultListeners(); |
442 | 442 | } |
443 | 443 | |
444 | - if (!$this->visitorsAdded) { |
|
444 | + if ( ! $this->visitorsAdded) { |
|
445 | 445 | $this->addDefaultSerializationVisitors(); |
446 | 446 | $this->addDefaultDeserializationVisitors(); |
447 | 447 | } |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | { |
53 | 53 | $groups = $this->getGroupsFor($navigatorContext); |
54 | 54 | |
55 | - if (!$property->groups) { |
|
56 | - return !in_array(self::DEFAULT_GROUP, $groups); |
|
55 | + if ( ! $property->groups) { |
|
56 | + return ! in_array(self::DEFAULT_GROUP, $groups); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | return $this->shouldSkipUsingGroups($property, $groups); |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | |
77 | 77 | $groups = $this->groups; |
78 | 78 | foreach ($paths as $index => $path) { |
79 | - if (!array_key_exists($path, $groups)) { |
|
79 | + if ( ! array_key_exists($path, $groups)) { |
|
80 | 80 | if ($index > 0) { |
81 | 81 | $groups = array(self::DEFAULT_GROUP); |
82 | 82 | } |
@@ -41,7 +41,7 @@ |
||
41 | 41 | */ |
42 | 42 | public function __construct($delegates) |
43 | 43 | { |
44 | - if (!$delegates instanceof SequenceInterface) { |
|
44 | + if ( ! $delegates instanceof SequenceInterface) { |
|
45 | 45 | $delegates = new Sequence($delegates); |
46 | 46 | } |
47 | 47 |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | $this->root = $data; |
58 | 58 | } |
59 | 59 | |
60 | - return (string)$data; |
|
60 | + return (string) $data; |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | public function visitBoolean($data, array $type, Context $context) |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $this->root = $data; |
67 | 67 | } |
68 | 68 | |
69 | - return (boolean)$data; |
|
69 | + return (boolean) $data; |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | public function visitInteger($data, array $type, Context $context) |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | $this->root = $data; |
76 | 76 | } |
77 | 77 | |
78 | - return (int)$data; |
|
78 | + return (int) $data; |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | public function visitDouble($data, array $type, Context $context) |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | $this->root = $data; |
85 | 85 | } |
86 | 86 | |
87 | - return (float)$data; |
|
87 | + return (float) $data; |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | $rs = $isHash ? new \ArrayObject() : array(); |
107 | 107 | } |
108 | 108 | |
109 | - $isList = isset($type['params'][0]) && !isset($type['params'][1]); |
|
109 | + $isList = isset($type['params'][0]) && ! isset($type['params'][1]); |
|
110 | 110 | |
111 | 111 | foreach ($data as $k => $v) { |
112 | 112 | $v = $this->navigator->accept($v, $this->getElementType($type), $context); |
@@ -251,6 +251,6 @@ discard block |
||
251 | 251 | |
252 | 252 | public function setOptions($options) |
253 | 253 | { |
254 | - $this->options = (integer)$options; |
|
254 | + $this->options = (integer) $options; |
|
255 | 255 | } |
256 | 256 | } |