Skip to content

Commit

Permalink
cs: fix native_function_invocation & trailing_comma_in_multiline (#178)
Browse files Browse the repository at this point in the history
  • Loading branch information
gimler authored Oct 2, 2024
1 parent 42e6fae commit 4975dfa
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/FileExtractor/PHPFileExtractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function getSourceLocations(SplFileInfo $file, SourceCollection $collecti
$tokens = $parser->parse($file->getContents());
$traverser->traverse($tokens);
} catch (Error $e) {
trigger_error(sprintf('Skipping file "%s" because of parse Error: %s. ', $path, $e->getMessage()));
trigger_error(\sprintf('Skipping file "%s" because of parse Error: %s. ', $path, $e->getMessage()));
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Model/Error.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ final class Error
public function __construct(
private readonly string $message,
private readonly string $path,
private readonly int $line
private readonly int $line,
) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/Model/SourceLocation.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function __construct(
private readonly string $message, /** Translation key. */
private readonly string $path,
private readonly int $line,
private readonly array $context = []
private readonly array $context = [],
) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/Visitor/Php/SourceLocationContainerVisitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function enterNode(Node $node): ?Node

foreach ($sourceLocations as $sourceLocation) {
if (!$sourceLocation instanceof SourceLocation) {
throw new \RuntimeException(sprintf('%s::getTranslationSourceLocations() was expected to return an array of SourceLocations, but got an array which contains an item of type %s.', $this->namespace.'\\'.$node->name, \gettype($sourceLocation)));
throw new \RuntimeException(\sprintf('%s::getTranslationSourceLocations() was expected to return an array of SourceLocations, but got an array which contains an item of type %s.', $this->namespace.'\\'.$node->name, \gettype($sourceLocation)));
}

$this->collection->addLocation($sourceLocation);
Expand Down
2 changes: 1 addition & 1 deletion src/Visitor/Php/Symfony/ValidationAnnotation.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function enterNode(Node $node): ?Node
/** @var ClassMetadata $metadata */
$metadata = $this->metadataFactory->getMetadataFor($name);
} catch (AnnotationException $e) {
$this->addError($node, sprintf('Could not parse class "%s" for annotations. %s', $this->namespace, $e->getMessage()));
$this->addError($node, \sprintf('Could not parse class "%s" for annotations. %s', $this->namespace, $e->getMessage()));

return null;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Visitor/Twig/Worker.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ private function extractContextFromJoinedFilters(): array
} elseif ('desc' === $name) {
$arguments = $this->stack[$i]->getNode('arguments');
if (!$arguments->hasNode(0)) {
throw new \LogicException(sprintf('The "%s" filter requires exactly one argument, the description text.', $name));
throw new \LogicException(\sprintf('The "%s" filter requires exactly one argument, the description text.', $name));
}
$text = $arguments->getNode(0);
if (!$text instanceof ConstantExpression) {
throw new \LogicException(sprintf('The first argument of the "%s" filter must be a constant expression, such as a string.', $name));
throw new \LogicException(\sprintf('The first argument of the "%s" filter must be a constant expression, such as a string.', $name));
}
$context['desc'] = $text->getAttribute('value');
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Smoke/AllExtractorsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public function testNoException()
private function translationExists(SourceCollection $sc, string $translationKey, ?string $message = null): SourceLocation
{
if (empty($message)) {
$message = sprintf('Tried to find "%s" but failed', $translationKey);
$message = \sprintf('Tried to find "%s" but failed', $translationKey);
}

$source = null;
Expand All @@ -127,7 +127,7 @@ private function translationExists(SourceCollection $sc, string $translationKey,
private function translationMissing(SourceCollection $sc, string $translationKey, ?string $message = null): void
{
if (empty($message)) {
$message = sprintf('The translation key "%s" should not exist', $translationKey);
$message = \sprintf('The translation key "%s" should not exist', $translationKey);
}

$found = false;
Expand Down

0 comments on commit 4975dfa

Please sign in to comment.