@@ -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 | } |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | FileFinderBuilder::SORT_BY_NAME) |
| 62 | 62 | ->addOption('listFilesOnly', null, InputOption::VALUE_NONE, |
| 63 | 63 | 'Only list matched files and do not run analysis.') |
| 64 | - ->addArgument('filters', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Filter', ['name:*.php']); |
|
| 64 | + ->addArgument('filters', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Filter', [ 'name:*.php' ]); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /** |
@@ -133,16 +133,16 @@ discard block |
||
| 133 | 133 | $highestRequirement->getAnalysisTargetId())); |
| 134 | 134 | |
| 135 | 135 | if ($highestRequirement->count() !== 0) { |
| 136 | - $tableData = []; |
|
| 136 | + $tableData = [ ]; |
|
| 137 | 137 | // order by version->descending. Might want to implement ordering by line later. |
| 138 | 138 | foreach (array_reverse($highestRequirement->getRequirements()) as $version => $reasons) { |
| 139 | 139 | foreach ($reasons as $reason) { |
| 140 | - $tableData[] = [$reason['version'], $reason['msg'], $reason['line']]; |
|
| 140 | + $tableData[ ] = [ $reason[ 'version' ], $reason[ 'msg' ], $reason[ 'line' ] ]; |
|
| 141 | 141 | } |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | (new Table($out)) |
| 145 | - ->setHeaders(['Version', 'Message', 'Line']) |
|
| 145 | + ->setHeaders([ 'Version', 'Message', 'Line' ]) |
|
| 146 | 146 | ->setRows($tableData) |
| 147 | 147 | ->render(); |
| 148 | 148 | } else { |
@@ -171,14 +171,14 @@ discard block |
||
| 171 | 171 | ' for the following reasons:', |
| 172 | 172 | PHP_EOL, |
| 173 | 173 | ]); |
| 174 | - $tableData = []; |
|
| 174 | + $tableData = [ ]; |
|
| 175 | 175 | /** @var $reason Reasoning */ |
| 176 | 176 | foreach ($result->getRequirementIterator() as $reason) { |
| 177 | - $tableData[] = [$reason['version'], $reason['msg'], $reason['line']]; |
|
| 177 | + $tableData[ ] = [ $reason[ 'version' ], $reason[ 'msg' ], $reason[ 'line' ] ]; |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | (new Table($out)) |
| 181 | - ->setHeaders(['Version', 'Message', 'Line']) |
|
| 181 | + ->setHeaders([ 'Version', 'Message', 'Line' ]) |
|
| 182 | 182 | ->setRows($tableData) |
| 183 | 183 | ->render(); |
| 184 | 184 | } |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | ]); |
| 214 | 214 | $out->writeln(''); |
| 215 | 215 | |
| 216 | - $usedVersions = []; |
|
| 216 | + $usedVersions = [ ]; |
|
| 217 | 217 | /** @var AnalysisResult $result */ |
| 218 | 218 | foreach ($results as $result) { |
| 219 | 219 | $versions = array_keys($result->getRequirements()); |
@@ -222,12 +222,12 @@ discard block |
||
| 222 | 222 | } |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | - usort($usedVersions, function ($a, $b) { |
|
| 225 | + usort($usedVersions, function($a, $b) { |
|
| 226 | 226 | return version_compare($b, $a); |
| 227 | 227 | }); |
| 228 | 228 | |
| 229 | 229 | $table = new Table($out); |
| 230 | - $table->setHeaders(['Version', 'Message', 'Position']); |
|
| 230 | + $table->setHeaders([ 'Version', 'Message', 'Position' ]); |
|
| 231 | 231 | |
| 232 | 232 | foreach ($usedVersions as $index => $version) { |
| 233 | 233 | /** @var AnalysisResult $result */ |
@@ -237,8 +237,8 @@ discard block |
||
| 237 | 237 | foreach ($selectedResults as $reason) { |
| 238 | 238 | $table->addRow([ |
| 239 | 239 | $version, |
| 240 | - $reason['msg'], |
|
| 241 | - $this->formatOutputPath($reason['targetId']) . ':' . $reason['line'], |
|
| 240 | + $reason[ 'msg' ], |
|
| 241 | + $this->formatOutputPath($reason[ 'targetId' ]) . ':' . $reason[ 'line' ], |
|
| 242 | 242 | ]); |
| 243 | 243 | } |
| 244 | 244 | } |