@@ -142,21 +142,21 @@ |
||
142 | 142 | |
143 | 143 | $currentFilterElements = explode(':', $currentFilter, 2); |
144 | 144 | |
145 | - switch (trim($currentFilterElements[0])) { |
|
145 | + switch (trim($currentFilterElements[ 0 ])) { |
|
146 | 146 | case 'exclude': |
147 | - $this->finder->exclude($currentFilterElements[1]); |
|
147 | + $this->finder->exclude($currentFilterElements[ 1 ]); |
|
148 | 148 | break; |
149 | 149 | case 'name': |
150 | - $this->finder->name($currentFilterElements[1]); |
|
150 | + $this->finder->name($currentFilterElements[ 1 ]); |
|
151 | 151 | break; |
152 | 152 | case 'notName': |
153 | - $this->finder->notName($currentFilterElements[1]); |
|
153 | + $this->finder->notName($currentFilterElements[ 1 ]); |
|
154 | 154 | break; |
155 | 155 | case 'path': |
156 | - $this->finder->path($currentFilterElements[1]); |
|
156 | + $this->finder->path($currentFilterElements[ 1 ]); |
|
157 | 157 | break; |
158 | 158 | case 'size': |
159 | - $this->finder->size($currentFilterElements[1]); |
|
159 | + $this->finder->size($currentFilterElements[ 1 ]); |
|
160 | 160 | } |
161 | 161 | } |
162 | 162 | } |
@@ -30,15 +30,15 @@ discard block |
||
30 | 30 | /** |
31 | 31 | * @var callable[] |
32 | 32 | */ |
33 | - private $messageSearchers = []; |
|
33 | + private $messageSearchers = [ ]; |
|
34 | 34 | /** |
35 | 35 | * @var callable[] |
36 | 36 | */ |
37 | - private $missingMessageHandlers = []; |
|
37 | + private $missingMessageHandlers = [ ]; |
|
38 | 38 | /** |
39 | 39 | * @var array |
40 | 40 | */ |
41 | - private $fetchedMessages = []; |
|
41 | + private $fetchedMessages = [ ]; |
|
42 | 42 | |
43 | 43 | /** |
44 | 44 | * Append a function to handle missing messages. |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | |
89 | 89 | $msgInfo = $this->fetchMessage($messageId, false); |
90 | 90 | |
91 | - return $msgInfo !== null && $msgInfo !== false && !empty($msgInfo['content']); |
|
91 | + return $msgInfo !== null && $msgInfo !== false && !empty($msgInfo[ 'content' ]); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | /** |
@@ -122,14 +122,14 @@ discard block |
||
122 | 122 | } |
123 | 123 | $value = $searchCallback($messageId, $this); |
124 | 124 | if (!empty($value) && is_string($value)) { |
125 | - $messageInfo['id'] = $messageId; |
|
126 | - $messageInfo['content'] = $value; |
|
125 | + $messageInfo[ 'id' ] = $messageId; |
|
126 | + $messageInfo[ 'content' ] = $value; |
|
127 | 127 | break; |
128 | 128 | } |
129 | 129 | } |
130 | 130 | $this->markCallbackChainTerminated(); |
131 | 131 | |
132 | - if (empty($messageInfo['content'])) { |
|
132 | + if (empty($messageInfo[ 'content' ])) { |
|
133 | 133 | if ($runMissingMessageHandlers) { |
134 | 134 | $this->inCallbackChain(true); |
135 | 135 | /** @var callable $handler */ |
@@ -139,9 +139,9 @@ discard block |
||
139 | 139 | } |
140 | 140 | $value = $handler($messageId, $this); |
141 | 141 | if (!empty($value) && is_string($value)) { |
142 | - $messageInfo['id'] = $messageId; |
|
143 | - $messageInfo['content'] = $value; |
|
144 | - $messageInfo['fallbackHandler'] = true; |
|
142 | + $messageInfo[ 'id' ] = $messageId; |
|
143 | + $messageInfo[ 'content' ] = $value; |
|
144 | + $messageInfo[ 'fallbackHandler' ] = true; |
|
145 | 145 | break; |
146 | 146 | } |
147 | 147 | } |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | public function getMessage($messageId, $ignoreCachedEntries = false) |
165 | 165 | { |
166 | 166 | $info = $this->getMessageWithInfo($messageId, $ignoreCachedEntries); |
167 | - return is_array($info) && array_key_exists('content', $info) ? $info['content'] : $info; |
|
167 | + return is_array($info) && array_key_exists('content', $info) ? $info[ 'content' ] : $info; |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | /** |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | public static function fromArray($array) |
218 | 218 | { |
219 | 219 | $locator = new static(); |
220 | - $locator->addMessageSearcher(function ($msgId) use ($array) { |
|
220 | + $locator->addMessageSearcher(function($msgId) use ($array) { |
|
221 | 221 | if (isset($array[ $msgId ])) { |
222 | 222 | return $array[ $msgId ]; |
223 | 223 | } |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | */ |
250 | 250 | public function clearInstanceCache() |
251 | 251 | { |
252 | - $this->fetchedMessages = []; |
|
252 | + $this->fetchedMessages = [ ]; |
|
253 | 253 | } |
254 | 254 | |
255 | 255 |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | AnalysisResult $result, |
79 | 79 | $version = null, |
80 | 80 | $msg = null, |
81 | - $data = [] |
|
81 | + $data = [ ] |
|
82 | 82 | ) { |
83 | 83 | $this->reasonId = $reasonId; |
84 | 84 | $this->line = $line; |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | public function offsetExists($offset) |
158 | 158 | { |
159 | - return in_array($offset, ['data', 'reason', 'reasonName', 'line', 'msg', 'raw_msg', 'version', 'targetId']); |
|
159 | + return in_array($offset, [ 'data', 'reason', 'reasonName', 'line', 'msg', 'raw_msg', 'version', 'targetId' ]); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | /** |
@@ -30,7 +30,7 @@ |
||
30 | 30 | /** |
31 | 31 | * @param array $options |
32 | 32 | */ |
33 | - public function __construct(array $options = []); |
|
33 | + public function __construct(array $options = [ ]); |
|
34 | 34 | |
35 | 35 | /** |
36 | 36 | * Generate a string representation of a `Result\Collection` |
@@ -44,10 +44,10 @@ |
||
44 | 44 | * |
45 | 45 | * @param array $options |
46 | 46 | */ |
47 | - public function __construct(array $options = []) |
|
47 | + public function __construct(array $options = [ ]) |
|
48 | 48 | { |
49 | - $this->options = isset($options['options']) ? $options['options'] : 0; |
|
50 | - $this->depth = isset($options['depth']) ? $options['depth'] : 512; |
|
49 | + $this->options = isset($options[ 'options' ]) ? $options[ 'options' ] : 0; |
|
50 | + $this->depth = isset($options[ 'depth' ]) ? $options[ 'depth' ] : 512; |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | /** |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * |
33 | 33 | * @var \Pvra\AnalysisResult[] |
34 | 34 | */ |
35 | - private $results = []; |
|
35 | + private $results = [ ]; |
|
36 | 36 | /** |
37 | 37 | * The targetId of the currently highest demanding result |
38 | 38 | * |
@@ -190,11 +190,11 @@ discard block |
||
190 | 190 | */ |
191 | 191 | public function jsonSerialize() |
192 | 192 | { |
193 | - $results = []; |
|
193 | + $results = [ ]; |
|
194 | 194 | foreach ($this->getIterator() as $result) { |
195 | - $reasonings = []; |
|
195 | + $reasonings = [ ]; |
|
196 | 196 | foreach ($result->getIterator() as $reason) { |
197 | - $reasonings[] = $reason->toArray(); |
|
197 | + $reasonings[ ] = $reason->toArray(); |
|
198 | 198 | } |
199 | 199 | $results[ $result->getAnalysisTargetId() ] = $reasonings; |
200 | 200 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | /** |
47 | 47 | * @var array |
48 | 48 | */ |
49 | - private $messageFormatters = []; |
|
49 | + private $messageFormatters = [ ]; |
|
50 | 50 | |
51 | 51 | /** |
52 | 52 | * @param array|MessageLocator $locator |
@@ -72,14 +72,14 @@ discard block |
||
72 | 72 | } |
73 | 73 | |
74 | 74 | if ($addDefaultFormatter) { |
75 | - $this->addMessageFormatter(function ($id, $format) { |
|
75 | + $this->addMessageFormatter(function($id, $format) { |
|
76 | 76 | return sprintf('%s in :%s:::%s:', $format, MessageFormatter::FORMAT_KEY_TARGET_ID, |
77 | 77 | MessageFormatter::FORMAT_KEY_LINE); |
78 | 78 | }); |
79 | 79 | } |
80 | 80 | |
81 | 81 | if ($addDefaultExclusiveMissingMessageLocatorHandler) { |
82 | - $this->getLocator()->addMissingMessageHandler(function ($id, MessageLocator $locator) { |
|
82 | + $this->getLocator()->addMissingMessageHandler(function($id, MessageLocator $locator) { |
|
83 | 83 | $locator->terminateCallbackChain(); |
84 | 84 | $msg = 'Message for id "%s" %s could not be found.'; |
85 | 85 | $desc = ''; |
@@ -116,9 +116,9 @@ discard block |
||
116 | 116 | * @return mixed |
117 | 117 | * @throws \Exception |
118 | 118 | */ |
119 | - public function getFormattedMessageFromId($msgId, array $data = []) |
|
119 | + public function getFormattedMessageFromId($msgId, array $data = [ ]) |
|
120 | 120 | { |
121 | - return $this->format(['id' => $msgId, 'template' => $this->getMessageTemplate($msgId)], $data); |
|
121 | + return $this->format([ 'id' => $msgId, 'template' => $this->getMessageTemplate($msgId) ], $data); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | /** |
@@ -127,12 +127,12 @@ discard block |
||
127 | 127 | * @param bool $runUserFormatters |
128 | 128 | * @return mixed |
129 | 129 | */ |
130 | - public function format($messageInfo, array $data = [], $runUserFormatters = true) |
|
130 | + public function format($messageInfo, array $data = [ ], $runUserFormatters = true) |
|
131 | 131 | { |
132 | 132 | if (is_string($messageInfo)) { |
133 | - $messageInfo = ['template' => $messageInfo, 'id' => 'unknown_message_id']; |
|
133 | + $messageInfo = [ 'template' => $messageInfo, 'id' => 'unknown_message_id' ]; |
|
134 | 134 | } |
135 | - $data += ['id' => $messageInfo['id']]; |
|
135 | + $data += [ 'id' => $messageInfo[ 'id' ] ]; |
|
136 | 136 | if ($runUserFormatters) { |
137 | 137 | $this->inCallbackChain(true); |
138 | 138 | /** @var callable $formatter */ |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | if ($this->isCallbackChainToBeTerminated()) { |
141 | 141 | break; |
142 | 142 | } |
143 | - $messageInfo['template'] = $formatter($messageInfo['id'], $messageInfo['template'], $this, $data); |
|
143 | + $messageInfo[ 'template' ] = $formatter($messageInfo[ 'id' ], $messageInfo[ 'template' ], $this, $data); |
|
144 | 144 | } |
145 | 145 | $this->markCallbackChainTerminated(); |
146 | 146 | } |
@@ -148,10 +148,10 @@ discard block |
||
148 | 148 | foreach ($data as $name => $value) { |
149 | 149 | // str_replace(array, array) would be better |
150 | 150 | // but this appears to be faster than iterating over the $data array and manipulating the keys |
151 | - $messageInfo['template'] = str_replace(':' . $name . ':', $value, $messageInfo['template']); |
|
151 | + $messageInfo[ 'template' ] = str_replace(':' . $name . ':', $value, $messageInfo[ 'template' ]); |
|
152 | 152 | } |
153 | 153 | |
154 | - return $messageInfo['template']; |
|
154 | + return $messageInfo[ 'template' ]; |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | /** |
@@ -99,14 +99,14 @@ discard block |
||
99 | 99 | Reason::GOTO_KEYWORD, |
100 | 100 | $node->getLine(), |
101 | 101 | null, |
102 | - ['name' => $node->name] |
|
102 | + [ 'name' => $node->name ] |
|
103 | 103 | ); |
104 | 104 | } elseif ($node instanceof Node\Stmt\Label) { |
105 | 105 | $this->getResult()->addRequirement( |
106 | 106 | Reason::JUMP_LABEL, |
107 | 107 | $node->getLine(), |
108 | 108 | null, |
109 | - ['name' => $node->name] |
|
109 | + [ 'name' => $node->name ] |
|
110 | 110 | ); |
111 | 111 | } |
112 | 112 | } |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | Reason::NAMESPACE_DECLERATION, |
122 | 122 | $node->getLine(), |
123 | 123 | null, |
124 | - ['name' => isset($node->name) ? $node->name->toString() : '::global::'] |
|
124 | + [ 'name' => isset($node->name) ? $node->name->toString() : '::global::' ] |
|
125 | 125 | ); |
126 | 126 | } elseif ($node instanceof Node\Scalar\MagicConst\Namespace_) { |
127 | 127 | $this->getResult()->addRequirement(Reason::NAMESPACE_MAGIC_CONSTANT, $node->getLine()); |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | Reason::NAMESPACE_IMPORT, |
131 | 131 | $node->getLine(), |
132 | 132 | null, |
133 | - ['import_count' => count($node->uses)] |
|
133 | + [ 'import_count' => count($node->uses) ] |
|
134 | 134 | ); |
135 | 135 | } |
136 | 136 | } |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | Reason::CONST_KEYWORD_DOC_SYNTAX, |
182 | 182 | $const->value->getLine(), |
183 | 183 | null, |
184 | - ['name' => $const->name] |
|
184 | + [ 'name' => $const->name ] |
|
185 | 185 | ); |
186 | 186 | } |
187 | 187 | } |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | class Php70Features extends LanguageFeatureAnalyser implements AnalyserAwareInterface |
43 | 43 | { |
44 | 44 | // move both to be const once 5.6+ is mandatory |
45 | - private static $reservedNames = ['string', 'int', 'float', 'bool', 'null', 'false', 'true']; |
|
46 | - private static $softReservedNames = ['object', 'resource', 'mixed', 'numeric']; |
|
45 | + private static $reservedNames = [ 'string', 'int', 'float', 'bool', 'null', 'false', 'true' ]; |
|
46 | + private static $softReservedNames = [ 'object', 'resource', 'mixed', 'numeric' ]; |
|
47 | 47 | |
48 | 48 | /** |
49 | 49 | * @inheritdoc |
@@ -103,12 +103,12 @@ discard block |
||
103 | 103 | Reason::PHP4_CONSTRUCTOR, |
104 | 104 | $method->getLine(), |
105 | 105 | null, |
106 | - ['name' => $method->name], |
|
106 | + [ 'name' => $method->name ], |
|
107 | 107 | ]; |
108 | 108 | } |
109 | 109 | } |
110 | 110 | if ($possibleCtorInfo !== null) { |
111 | - call_user_func_array([$this->getResult(), 'addLimit'], $possibleCtorInfo); |
|
111 | + call_user_func_array([ $this->getResult(), 'addLimit' ], $possibleCtorInfo); |
|
112 | 112 | } |
113 | 113 | } |
114 | 114 | } |
@@ -136,9 +136,9 @@ discard block |
||
136 | 136 | { |
137 | 137 | if ($call->name instanceof Node\Name && strcasecmp('class_alias', $call->name->getLast()) === 0 |
138 | 138 | ) { |
139 | - if (isset($call->args[1]) && $call->args[1]->value instanceof Node\Scalar\String_) { |
|
140 | - $value = $call->args[1]->value->value; |
|
141 | - $this->handleClassName($value, $call->args[1]->value->getLine()); |
|
139 | + if (isset($call->args[ 1 ]) && $call->args[ 1 ]->value instanceof Node\Scalar\String_) { |
|
140 | + $value = $call->args[ 1 ]->value->value; |
|
141 | + $this->handleClassName($value, $call->args[ 1 ]->value->getLine()); |
|
142 | 142 | } |
143 | 143 | } |
144 | 144 | } |
@@ -182,10 +182,10 @@ discard block |
||
182 | 182 | $baseName = basename(str_replace('\\', '/', $name)); |
183 | 183 | if ($this->mode & self::MODE_DEPRECATION && $this->isNameSoftReserved($name)) { |
184 | 184 | $this->getResult()->addLimit(Reason::SOFT_RESERVED_NAME, $line, null, |
185 | - ['fqn' => $name, 'class' => $baseName]); |
|
185 | + [ 'fqn' => $name, 'class' => $baseName ]); |
|
186 | 186 | } elseif ($this->mode & self::MODE_REMOVAL && $this->isNameReserved($name)) { |
187 | 187 | $this->getResult()->addLimit(Reason::RESERVED_CLASS_NAME, $line, null, |
188 | - ['fqn' => $name, 'class' => $baseName]); |
|
188 | + [ 'fqn' => $name, 'class' => $baseName ]); |
|
189 | 189 | } |
190 | 190 | } |
191 | 191 | } |