Skip to content

Commit

Permalink
Trailing commas in methods/functions calls
Browse files Browse the repository at this point in the history
  • Loading branch information
kukulich committed May 28, 2020
1 parent bcd55b2 commit 34c8d63
Show file tree
Hide file tree
Showing 123 changed files with 585 additions and 584 deletions.
1 change: 1 addition & 0 deletions phpcs.xml.dist
Expand Up @@ -18,6 +18,7 @@
<exclude name="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification"/>
</rule>

<rule ref="SlevomatCodingStandard.Functions.TrailingCommaInCall"/>
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHint"/>
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingParameterTypeHint">
<exclude-pattern>src/Reflection/Adapter/*</exclude-pattern>
Expand Down
4 changes: 2 additions & 2 deletions src/BetterReflection.php
Expand Up @@ -87,7 +87,7 @@ public function phpParser() : Parser
?? $this->phpParser = new MemoizingParser(
(new ParserFactory())->create(ParserFactory::PREFER_PHP7, new Emulative([
'usedAttributes' => ['comments', 'startLine', 'endLine', 'startFilePos', 'endFilePos'],
]))
])),
);
}

Expand All @@ -110,7 +110,7 @@ public function sourceStubber() : SourceStubber
return $this->sourceStubber
?? $this->sourceStubber = new AggregateSourceStubber(
new PhpStormStubsSourceStubber($this->phpParser()),
new ReflectionSourceStubber()
new ReflectionSourceStubber(),
);
}
}
2 changes: 1 addition & 1 deletion src/Identifier/IdentifierType.php
Expand Up @@ -32,7 +32,7 @@ public function __construct(string $type = self::IDENTIFIER_CLASS)
if (! array_key_exists($type, self::VALID_TYPES)) {
throw new InvalidArgumentException(sprintf(
'%s is not a valid identifier type',
$type
$type,
));
}

Expand Down
2 changes: 1 addition & 1 deletion src/NodeCompiler/CompileNodeToValue.php
Expand Up @@ -129,7 +129,7 @@ private function compileClassConstFetch(Node\Expr\ClassConstFetch $node, Compile

return $this->__invoke(
$reflectionConstant->getAst()->consts[$reflectionConstant->getPositionInAst()]->value,
new CompilerContext($context->getReflector(), $classInfo)
new CompilerContext($context->getReflector(), $classInfo),
);
}

Expand Down
6 changes: 3 additions & 3 deletions src/NodeCompiler/Exception/UnableToCompileNode.php
Expand Up @@ -29,7 +29,7 @@ public static function forUnRecognizedExpressionInContext(Node\Expr $expression,
'Unable to compile expression in %s: unrecognized node type %s at line %d',
self::compilerContextToContextDescription($context),
get_class($expression),
$expression->getLine()
$expression->getLine(),
));
}

Expand All @@ -45,7 +45,7 @@ public static function becauseOfNotFoundClassConstantReference(
$targetClass->getName(),
$constantFetch->name->name,
self::compilerContextToContextDescription($fetchContext),
$constantFetch->getLine()
$constantFetch->getLine(),
));
}

Expand All @@ -59,7 +59,7 @@ public static function becauseOfNotFoundConstantReference(
'Could not locate constant "%s" while evaluating expression in %s at line %s',
$constantName,
self::compilerContextToContextDescription($fetchContext),
$constantFetch->getLine()
$constantFetch->getLine(),
));

$exception->constantName = $constantName;
Expand Down
8 changes: 4 additions & 4 deletions src/Reflection/Adapter/ReflectionClass.php
Expand Up @@ -252,7 +252,7 @@ public function getConstant($name)
public function getReflectionConstant($name)
{
return new ReflectionClassConstant(
$this->betterReflectionClass->getReflectionConstant($name)
$this->betterReflectionClass->getReflectionConstant($name),
);
}

Expand Down Expand Up @@ -313,15 +313,15 @@ public function getTraits()
$traitNames,
array_map(static function (BetterReflectionClass $trait) : self {
return new self($trait);
}, $traits)
}, $traits),
);

assert(
is_array($traitsByName),
sprintf(
'Could not create an array<trait-string, ReflectionClass> for class "%s"',
$this->betterReflectionClass->getName()
)
$this->betterReflectionClass->getName(),
),
);

return $traitsByName;
Expand Down
6 changes: 3 additions & 3 deletions src/Reflection/Adapter/ReflectionObject.php
Expand Up @@ -286,15 +286,15 @@ public function getTraits()
$traitNames,
array_map(static function (BetterReflectionClass $trait) : ReflectionClass {
return new ReflectionClass($trait);
}, $traits)
}, $traits),
);

assert(
is_array($traitsByName),
sprintf(
'Could not create an array<trait-string, ReflectionClass> for class "%s"',
$this->betterReflectionObject->getName()
)
$this->betterReflectionObject->getName(),
),
);

return $traitsByName;
Expand Down
Expand Up @@ -19,7 +19,7 @@ public static function fromNode(Node $node) : self
ReflectionFunctionAbstract::class,
Node\Stmt\ClassMethod::class,
Node\FunctionLike::class,
get_class($node)
get_class($node),
));
}
}
2 changes: 1 addition & 1 deletion src/Reflection/Exception/InvalidConstantNode.php
Expand Up @@ -16,7 +16,7 @@ public static function create(Node $node) : self
{
return new self(sprintf(
'Invalid constant node (first 50 characters: %s)',
substr((new Standard())->prettyPrint([$node]), 0, 50)
substr((new Standard())->prettyPrint([$node]), 0, 50),
));
}
}
Expand Up @@ -16,7 +16,7 @@ public static function for(ReflectionType $type) : self
return new self(sprintf(
'Provided %s instance does not point to a class-alike type, but to "%s"',
get_class($type),
$type->__toString()
$type->__toString(),
));
}
}

0 comments on commit 34c8d63

Please sign in to comment.