Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnathonKoster committed Oct 13, 2024
1 parent 4aadce8 commit 1c9b963
Show file tree
Hide file tree
Showing 84 changed files with 145 additions and 205 deletions.
4 changes: 1 addition & 3 deletions src/Compiler/AppendState.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,5 @@ class AppendState
public function __construct(public AbstractNode $node,
public int $beforeLineNumber,
public int $afterLineNumber,
public string $value)
{
}
public string $value) {}
}
10 changes: 5 additions & 5 deletions src/Compiler/Compiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,13 @@ class Compiler

public function __construct(DocumentParser $parser)
{
$this->compilationBuffer = new StringBuffer();
$this->loopExtractor = new LoopVariablesExtractor();
$this->compilationBuffer = new StringBuffer;
$this->loopExtractor = new LoopVariablesExtractor;
$this->parser = $parser;
$this->rawTransformer = new RawTransformer();
$this->rawTransformer = new RawTransformer;
$this->componentTagCompiler = new ComponentTagCompiler(
new ComponentNodeCompiler(),
new DocumentParser()
new ComponentNodeCompiler,
new DocumentParser
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Compiler/CompilerServices/CoreDirectiveRetriever.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function __construct()
public static function instance(): CoreDirectiveRetriever
{
if (self::$instance == null) {
self::$instance = new CoreDirectiveRetriever();
self::$instance = new CoreDirectiveRetriever;
}

return self::$instance;
Expand Down
4 changes: 2 additions & 2 deletions src/Compiler/CompilerServices/LoopVariablesExtractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class LoopVariablesExtractor

public function __construct()
{
$this->splitter = new StringSplitter();
$this->splitter = new StringSplitter;
}

/**
Expand All @@ -21,7 +21,7 @@ public function __construct()
*/
public function extractDetails(string $value): LoopVariables
{
$result = new LoopVariables();
$result = new LoopVariables;
$result->source = $value;

$value = StringUtilities::unwrapParentheses($value);
Expand Down
2 changes: 1 addition & 1 deletion src/Compiler/ComponentNodeCompiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ protected function compileSelfClosingTag(ComponentNode $component): string

protected function compileParameterEcho(ParameterNode $node): string
{
$compiler = new Compiler(new DocumentParser());
$compiler = new Compiler(new DocumentParser);
$compiler->setCompilationTarget(CompilationTarget::ComponentParameter);

$result = $compiler->compileString($node->value);
Expand Down
4 changes: 1 addition & 3 deletions src/Compiler/UnresolvableComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,4 @@
* This class is used when the compiler is set to not throw
* compilation errors when it encounters unknown components.
*/
class UnresolvableComponent
{
}
class UnresolvableComponent {}
4 changes: 2 additions & 2 deletions src/Document/Document.php
Original file line number Diff line number Diff line change
Expand Up @@ -468,12 +468,12 @@ public function getFragments(): Collection
return collect($this->fragments);
}

$fragmentsParser = new FragmentsDocumentParser();
$fragmentsParser = new FragmentsDocumentParser;
$fragmentsParser->setIgnoreRanges($this->toSkipIndex());

$this->fragments = $fragmentsParser->parse($this->toString());

$fragmentPositions = new FragmentPositionsAnalyzer();
$fragmentPositions = new FragmentPositionsAnalyzer;
$fragmentPositions->setFragments($this->fragments);

foreach ($this->nodes as $node) {
Expand Down
4 changes: 1 addition & 3 deletions src/Document/DocumentCompilerOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,5 @@ public function __construct(
public array $appendCallbacks = [],
public array $customTagCompilers = [],
public bool $compileCoreComponentTags = true,
public array $ignoreDirectives = [])
{
}
public array $ignoreDirectives = []) {}
}
2 changes: 1 addition & 1 deletion src/Document/DocumentFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ public static function makeDocument(): Document
return $methodToCall();
}

return new Document();
return new Document;
}
}
3 changes: 1 addition & 2 deletions src/Document/DocumentOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,5 @@ public function __construct(
* @var string[] $ignoreDirectives
*/
public array $ignoreDirectives = [],
) {
}
) {}
}
2 changes: 1 addition & 1 deletion src/Document/Structures/Concerns/ConstructsConditions.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ protected function constructConditions(array $nodes): void
$chainedDirectives = $node->getChainedClosingDirectives();
$chainedDirectives->pop(); // Removes the closing directive.

$condition = new Condition();
$condition = new Condition;
$condition->constructedFrom = $node;

$node->isStructure = true;
Expand Down
2 changes: 1 addition & 1 deletion src/Document/Structures/Concerns/ConstructsForElse.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ protected function constructForElse(array $nodes): void
continue;
}

$forElse = new ForElse();
$forElse = new ForElse;

$forElse->constructedFrom = $node;
$node->isStructure = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ protected function constructSwitchStatements(array $nodes): void
continue;
}

$switchStatement = new SwitchStatement();
$switchStatement = new SwitchStatement;
$switchStatement->constructedFrom = $node;
$node->isStructure = true;
$node->structure = $switchStatement;
Expand Down
2 changes: 1 addition & 1 deletion src/Document/Structures/StructurePairAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public function associate(): void
/** @var DirectiveStackItem[] $nodeStack */
$nodeStack = [];

$stackItem = new DirectiveStackItem();
$stackItem = new DirectiveStackItem;
$stackItem->documentNodes = $this->document->getNodes()->all();

$nodeStack[] = $stackItem;
Expand Down
4 changes: 1 addition & 3 deletions src/Errors/Exceptions/DuplicateParameterException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@

use InvalidArgumentException;

class DuplicateParameterException extends InvalidArgumentException
{
}
class DuplicateParameterException extends InvalidArgumentException {}
4 changes: 1 addition & 3 deletions src/Errors/Exceptions/InvalidCastException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@

use Exception;

class InvalidCastException extends Exception
{
}
class InvalidCastException extends Exception {}
4 changes: 1 addition & 3 deletions src/Errors/Exceptions/InvalidParameterException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@

use InvalidArgumentException;

class InvalidParameterException extends InvalidArgumentException
{
}
class InvalidParameterException extends InvalidArgumentException {}
4 changes: 1 addition & 3 deletions src/Errors/Exceptions/UnsupportedNodeException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@

use Exception;

class UnsupportedNodeException extends Exception
{
}
class UnsupportedNodeException extends Exception {}
4 changes: 1 addition & 3 deletions src/Nodes/AbstractNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,7 @@ public function getRootNodes(): NodeCollection
return $this->getDirectChildren();
}

public function resolveStructures(): void
{
}
public function resolveStructures(): void {}

public function getDirectChildren(): NodeCollection
{
Expand Down
4 changes: 2 additions & 2 deletions src/Nodes/ArgumentGroupNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function getValues(): Collection
return collect([$this->innerContent]);
}

$results = (new StringSplitter())->split($this->innerContent);
$results = (new StringSplitter)->split($this->innerContent);
$lastIndex = count($results) - 1;

return collect($results)->map(function ($value, $i) use ($lastIndex) {
Expand All @@ -93,7 +93,7 @@ public function getArgValues(): Collection
return collect([$this->innerContent]);
}

return collect((new ArgStringSplitter())->split($this->innerContent));
return collect((new ArgStringSplitter)->split($this->innerContent));
}

public function clone(?DirectiveNode $newOwner = null): ArgumentGroupNode
Expand Down
2 changes: 1 addition & 1 deletion src/Nodes/CommentNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function setContent(string $content, bool $preserveOriginalWhitespace = t

public function clone(): CommentNode
{
$commentNode = new CommentNode();
$commentNode = new CommentNode;
$this->copyBasicDetailsTo($commentNode);

$commentNode->innerContent = $this->innerContent;
Expand Down
2 changes: 1 addition & 1 deletion src/Nodes/Components/ComponentNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public function getName(): string|ParameterNode

public function clone(): ComponentNode
{
$component = new ComponentNode();
$component = new ComponentNode;
$this->copyBasicDetailsTo($component);

$component->isSelfClosing = $this->isSelfClosing;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function addParameterFromText(string $parameterContent): void
$param = ParameterFactory::parameterFromText($parameterContent);

if ($param == null) {
throw new InvalidParameterException();
throw new InvalidParameterException;
}

$this->addParameter($param);
Expand Down
2 changes: 1 addition & 1 deletion src/Nodes/Components/ParameterAttribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class ParameterAttribute extends BaseNode

public function clone(): ParameterAttribute
{
$attribute = new ParameterAttribute();
$attribute = new ParameterAttribute;
$this->copyBasicDetailsTo($attribute);

$attribute->content = $this->content;
Expand Down
2 changes: 1 addition & 1 deletion src/Nodes/Components/ParameterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class ParameterFactory
*/
public static function fromText(string $parameterContent): array
{
$componentParser = new ComponentParser();
$componentParser = new ComponentParser;

return $componentParser->parseOnlyParameters($parameterContent);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Nodes/Components/ParameterNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public function hasValue(): bool

public function clone(): ParameterNode
{
$parameter = new ParameterNode();
$parameter = new ParameterNode;
$this->copyBasicDetailsTo($parameter);

$parameter->nameNode = $this->nameNode?->clone();
Expand Down
2 changes: 1 addition & 1 deletion src/Nodes/DirectiveNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ public function getValue(): ?string

public function clone(): DirectiveNode
{
$directive = new DirectiveNode();
$directive = new DirectiveNode;
$this->copyBasicDetailsTo($directive);

$directive->isClosingDirective = $this->isClosingDirective;
Expand Down
2 changes: 1 addition & 1 deletion src/Nodes/EchoNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function setInnerContent(string $innerContent): void

public function clone(): EchoNode
{
$echo = new EchoNode();
$echo = new EchoNode;
$this->copyBasicDetailsTo($echo);

$echo->innerContent = $this->innerContent;
Expand Down
2 changes: 1 addition & 1 deletion src/Nodes/Fragments/Fragment.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ public function __construct()
{
parent::__construct();

$this->position = new Position();
$this->position = new Position;
}
}
2 changes: 1 addition & 1 deletion src/Nodes/LiteralNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function setContent(string $content, bool $preserveOriginalWhitespace = t

public function clone(): LiteralNode
{
$literal = new LiteralNode();
$literal = new LiteralNode;
$this->copyBasicDetailsTo($literal);

$literal->originalLeadingWhitespace = $this->originalLeadingWhitespace;
Expand Down
2 changes: 1 addition & 1 deletion src/Nodes/PhpBlockNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function setContent(string $content, bool $preserveOriginalWhitespace = t

public function clone(): PhpBlockNode
{
$phpBlock = new PhpBlockNode();
$phpBlock = new PhpBlockNode;
$this->copyBasicDetailsTo($phpBlock);
$phpBlock->originalTrailingWhitespace = $this->originalTrailingWhitespace;
$phpBlock->originalLeadingWhitespace = $this->originalLeadingWhitespace;
Expand Down
2 changes: 1 addition & 1 deletion src/Nodes/PhpTagNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function setType(PhpTagType $type, bool $preserveOriginalWhitespace = tru

public function clone(): PhpTagNode
{
$phpTag = new PhpTagNode();
$phpTag = new PhpTagNode;
$this->copyBasicDetailsTo($phpTag);
$phpTag->innerContent = $this->innerContent;
$phpTag->originalLeadingWhitespace = $this->originalLeadingWhitespace;
Expand Down
2 changes: 1 addition & 1 deletion src/Nodes/Position.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function contains(int $offset): bool

public function clone(): Position
{
$position = new Position();
$position = new Position;

$position->startOffset = $this->startOffset;
$position->startLine = $this->startLine;
Expand Down
4 changes: 1 addition & 3 deletions src/Nodes/Structures/BaseStructureNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,5 @@ public function getNodes(): NodeCollection
return $this->constructedFrom->getNodes();
}

public function resolveStructures(): void
{
}
public function resolveStructures(): void {}
}
2 changes: 1 addition & 1 deletion src/Nodes/VerbatimNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function setContent(string $content, bool $preserveOriginalWhitespace = t

public function clone(): VerbatimNode
{
$verbatim = new VerbatimNode();
$verbatim = new VerbatimNode;
$this->copyBasicDetailsTo($verbatim);
$verbatim->originalTrailingWhitespace = $this->originalTrailingWhitespace;
$verbatim->originalLeadingWhitespace = $this->originalLeadingWhitespace;
Expand Down
Loading

0 comments on commit 1c9b963

Please sign in to comment.