@@ -29,7 +29,7 @@ |
||
| 29 | 29 | |
| 30 | 30 | public static function callMethod(\ReflectionMethod $method, array $params = null) { |
| 31 | 31 | if (null === $params) { |
| 32 | - $params = array_map(function ($p) { |
|
| 32 | + $params = array_map(function($p) { |
|
| 33 | 33 | return '$' . $p->name; |
| 34 | 34 | }, $method->getParameters()); |
| 35 | 35 | } |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | $filter |= \ReflectionMethod::IS_PROTECTED; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - return array_filter($class->getMethods($filter), function ($method) { |
|
| 35 | + return array_filter($class->getMethods($filter), function($method) { |
|
| 36 | 36 | return !$method->isFinal() && !$method->isStatic(); |
| 37 | 37 | }); |
| 38 | 38 | } |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | } |
| 82 | 82 | $tokenizer = new PhpTokenizer(); |
| 83 | 83 | $tokens = $tokenizer->tokenize($content); |
| 84 | - $tokens = $tokens->filter(function ($token) { |
|
| 84 | + $tokens = $tokens->filter(function($token) { |
|
| 85 | 85 | return $token->type !== T_WHITESPACE && $token->type !== T_COMMENT && $token->type !== T_DOC_COMMENT; |
| 86 | 86 | }); |
| 87 | 87 | $statements = []; |
@@ -92,7 +92,7 @@ |
||
| 92 | 92 | return $this->constants; |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - return array_map(function (PhpConstant $constant) { |
|
| 95 | + return array_map(function(PhpConstant $constant) { |
|
| 96 | 96 | return $constant->getValue(); |
| 97 | 97 | }, $this->constants); |
| 98 | 98 | } |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | private function getConstantSortFunc() { |
| 146 | - return $this->constantSortFunc ? : 'strcasecmp'; |
|
| 146 | + return $this->constantSortFunc ?: 'strcasecmp'; |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | private function getMethodSortFunc() { |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | if (empty(self::$defaultMethodSortFunc)) { |
| 155 | - self::$defaultMethodSortFunc = function ($a, $b) { |
|
| 155 | + self::$defaultMethodSortFunc = function($a, $b) { |
|
| 156 | 156 | if ($a->isStatic() !== $isStatic = $b->isStatic()) { |
| 157 | 157 | return $isStatic ? 1 : -1; |
| 158 | 158 | } |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | if (empty(self::$defaultPropertySortFunc)) { |
| 180 | - self::$defaultPropertySortFunc = function ($a, $b) { |
|
| 180 | + self::$defaultPropertySortFunc = function($a, $b) { |
|
| 181 | 181 | if (($aV = $a->getVisibility()) !== $bV = $b->getVisibility()) { |
| 182 | 182 | $aV = 'public' === $aV ? 3 : ('protected' === $aV ? 2 : 1); |
| 183 | 183 | $bV = 'public' === $bV ? 3 : ('protected' === $bV ? 2 : 1); |
@@ -343,14 +343,14 @@ |
||
| 343 | 343 | $defaultValue = $parameter->getDefaultValue(); |
| 344 | 344 | |
| 345 | 345 | switch (true) { |
| 346 | - case is_array($defaultValue) && empty($defaultValue): |
|
| 347 | - $this->writer->write('array()'); |
|
| 348 | - break; |
|
| 349 | - case ($defaultValue instanceof PhpConstant): |
|
| 350 | - $this->writer->write($defaultValue->getName()); |
|
| 351 | - break; |
|
| 352 | - default: |
|
| 353 | - $this->writer->write($this->getPhpExport($defaultValue)); |
|
| 346 | + case is_array($defaultValue) && empty($defaultValue): |
|
| 347 | + $this->writer->write('array()'); |
|
| 348 | + break; |
|
| 349 | + case ($defaultValue instanceof PhpConstant): |
|
| 350 | + $this->writer->write($defaultValue->getName()); |
|
| 351 | + break; |
|
| 352 | + default: |
|
| 353 | + $this->writer->write($this->getPhpExport($defaultValue)); |
|
| 354 | 354 | |
| 355 | 355 | } |
| 356 | 356 | } |
@@ -358,7 +358,7 @@ |
||
| 358 | 358 | } |
| 359 | 359 | |
| 360 | 360 | protected function writeFunctionReturnType($type) { |
| 361 | - if ($this->config->getGenerateReturnTypeHints() && $type != NULL && false === strpos($type, '|')) { |
|
| 361 | + if ($this->config->getGenerateReturnTypeHints() && $type != null && false === strpos($type, '|')) { |
|
| 362 | 362 | $this->writer->write(': ')->write($type); |
| 363 | 363 | } |
| 364 | 364 | } |
@@ -19,7 +19,6 @@ |
||
| 19 | 19 | use PhpParser\Node\Stmt\Property; |
| 20 | 20 | use PhpParser\Node\Stmt\TraitUse; |
| 21 | 21 | use PhpParser\Node\Stmt\UseUse; |
| 22 | -use PhpParser\NodeTraverser; |
|
| 23 | 22 | use PhpParser\NodeVisitorAbstract; |
| 24 | 23 | use PhpParser\PrettyPrinter\Standard; |
| 25 | 24 | use PhpParser\Node\Stmt\Class_; |
@@ -51,44 +51,44 @@ |
||
| 51 | 51 | |
| 52 | 52 | public function enterNode(Node $node) { |
| 53 | 53 | switch ($node->getType()) { |
| 54 | - case 'Stmt_Namespace': |
|
| 55 | - $this->visitNamespace($node); |
|
| 56 | - break; |
|
| 54 | + case 'Stmt_Namespace': |
|
| 55 | + $this->visitNamespace($node); |
|
| 56 | + break; |
|
| 57 | 57 | |
| 58 | - case 'Stmt_UseUse': |
|
| 59 | - $this->visitUseStatement($node); |
|
| 60 | - break; |
|
| 58 | + case 'Stmt_UseUse': |
|
| 59 | + $this->visitUseStatement($node); |
|
| 60 | + break; |
|
| 61 | 61 | |
| 62 | - case 'Stmt_Class': |
|
| 63 | - $this->visitStruct($node); |
|
| 64 | - $this->visitClass($node); |
|
| 65 | - break; |
|
| 62 | + case 'Stmt_Class': |
|
| 63 | + $this->visitStruct($node); |
|
| 64 | + $this->visitClass($node); |
|
| 65 | + break; |
|
| 66 | 66 | |
| 67 | - case 'Stmt_Interface': |
|
| 68 | - $this->visitStruct($node); |
|
| 69 | - $this->visitInterface($node); |
|
| 70 | - break; |
|
| 67 | + case 'Stmt_Interface': |
|
| 68 | + $this->visitStruct($node); |
|
| 69 | + $this->visitInterface($node); |
|
| 70 | + break; |
|
| 71 | 71 | |
| 72 | - case 'Stmt_Trait': |
|
| 73 | - $this->visitStruct($node); |
|
| 74 | - $this->visitTrait($node); |
|
| 75 | - break; |
|
| 72 | + case 'Stmt_Trait': |
|
| 73 | + $this->visitStruct($node); |
|
| 74 | + $this->visitTrait($node); |
|
| 75 | + break; |
|
| 76 | 76 | |
| 77 | - case 'Stmt_TraitUse': |
|
| 78 | - $this->visitTraitUse($node); |
|
| 79 | - break; |
|
| 77 | + case 'Stmt_TraitUse': |
|
| 78 | + $this->visitTraitUse($node); |
|
| 79 | + break; |
|
| 80 | 80 | |
| 81 | - case 'Stmt_ClassConst': |
|
| 82 | - $this->visitConstants($node); |
|
| 83 | - break; |
|
| 81 | + case 'Stmt_ClassConst': |
|
| 82 | + $this->visitConstants($node); |
|
| 83 | + break; |
|
| 84 | 84 | |
| 85 | - case 'Stmt_Property': |
|
| 86 | - $this->visitProperty($node); |
|
| 87 | - break; |
|
| 85 | + case 'Stmt_Property': |
|
| 86 | + $this->visitProperty($node); |
|
| 87 | + break; |
|
| 88 | 88 | |
| 89 | - case 'Stmt_ClassMethod': |
|
| 90 | - $this->visitMethod($node); |
|
| 91 | - break; |
|
| 89 | + case 'Stmt_ClassMethod': |
|
| 90 | + $this->visitMethod($node); |
|
| 91 | + break; |
|
| 92 | 92 | } |
| 93 | 93 | // echo $node->getType() . "\n"; |
| 94 | 94 | |
@@ -187,7 +187,7 @@ |
||
| 187 | 187 | $p->setDefaultValue($this->getValue($default)); |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | - $tag = $params->find($p, function (ParamTag $t, $p) { |
|
| 190 | + $tag = $params->find($p, function(ParamTag $t, $p) { |
|
| 191 | 191 | return $t->getVariable() == '$' . $p->getName(); |
| 192 | 192 | }); |
| 193 | 193 | |
@@ -160,11 +160,11 @@ |
||
| 160 | 160 | * |
| 161 | 161 | * If the class has already been declared you get only the set alias. |
| 162 | 162 | * |
| 163 | - * @param string $qualifiedName |
|
| 164 | - * @param null|string $alias |
|
| 165 | - * |
|
| 166 | - * @return string the used alias |
|
| 167 | - */ |
|
| 163 | + * @param string $qualifiedName |
|
| 164 | + * @param null|string $alias |
|
| 165 | + * |
|
| 166 | + * @return string the used alias |
|
| 167 | + */ |
|
| 168 | 168 | public function declareUse($qualifiedName, $alias = null) |
| 169 | 169 | { |
| 170 | 170 | $qualifiedName = trim($qualifiedName, '\\'); |
@@ -165,8 +165,7 @@ |
||
| 165 | 165 | * |
| 166 | 166 | * @return string the used alias |
| 167 | 167 | */ |
| 168 | - public function declareUse($qualifiedName, $alias = null) |
|
| 169 | - { |
|
| 168 | + public function declareUse($qualifiedName, $alias = null) { |
|
| 170 | 169 | $qualifiedName = trim($qualifiedName, '\\'); |
| 171 | 170 | if (!$this->hasUseStatement($qualifiedName)) { |
| 172 | 171 | $this->addUseStatement($qualifiedName, $alias); |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | $docblock = new Docblock($ref->getDeclaringFunction()); |
| 65 | 65 | |
| 66 | 66 | $params = $docblock->getTags('param'); |
| 67 | - $tag = $params->find($ref->name, function (ParamTag $t, $name) { |
|
| 67 | + $tag = $params->find($ref->name, function(ParamTag $t, $name) { |
|
| 68 | 68 | return $t->getVariable() == '$' . $name; |
| 69 | 69 | }); |
| 70 | 70 | |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | */ |
| 124 | 124 | public function getDocblockTag() { |
| 125 | 125 | return ParamTag::create() |
| 126 | - ->setType($this->getType() ? : 'mixed') |
|
| 126 | + ->setType($this->getType() ?: 'mixed') |
|
| 127 | 127 | ->setVariable($this->getName()) |
| 128 | 128 | ->setDescription($this->getTypeDescription()); |
| 129 | 129 | } |
@@ -12,8 +12,8 @@ |
||
| 12 | 12 | ->in($dir); |
| 13 | 13 | |
| 14 | 14 | $versions = GitVersionCollection::create($dir) |
| 15 | - ->addFromTags('v0.*') |
|
| 16 | - ->add('master', 'master branch') |
|
| 15 | + ->addFromTags('v0.*') |
|
| 16 | + ->add('master', 'master branch') |
|
| 17 | 17 | ; |
| 18 | 18 | |
| 19 | 19 | return new Sami($iterator, [ |