Skip to content

Commit

Permalink
Fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
giorgiopogliani authored and actions-user committed Sep 15, 2021
1 parent 08b6f5d commit 445d699
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .php-cs-fixer.cache
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"php":"8.0.5","version":"3.0.0","indent":" ","lineEnding":"\n","rules":{"blank_line_after_namespace":true,"braces":true,"class_definition":true,"constant_case":true,"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"method_argument_space":{"on_multiline":"ensure_fully_multiline","keep_multiple_spaces_after_comma":true},"no_break_comment":true,"no_closing_tag":true,"no_spaces_after_function_name":true,"no_spaces_inside_parenthesis":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_class_element_per_statement":{"elements":["property"]},"single_import_per_statement":true,"single_line_after_imports":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"visibility_required":{"elements":["method","property"]},"encoding":true,"full_opening_tag":true,"array_syntax":{"syntax":"short"},"ordered_imports":{"sort_algorithm":"alpha"},"no_unused_imports":true,"not_operator_with_successor_space":true,"trailing_comma_in_multiline":true,"phpdoc_scalar":true,"unary_operator_spaces":true,"binary_operator_spaces":true,"blank_line_before_statement":{"statements":["break","continue","declare","return","throw","try"]},"phpdoc_single_line_var_spacing":true,"phpdoc_var_without_name":true,"class_attributes_separation":{"elements":{"method":"one"}},"single_trait_insert_per_statement":true},"hashes":{"src\/ComponentNode.php":495735954,"src\/SlotTokenParser.php":1705137408,"src\/Setup.php":2590804620,"src\/SlotBag.php":2813959692,"src\/ComponentTagCompiler.php":1655642996,"src\/ComponentTokenParser.php":1300987293,"src\/ComponentExtension.php":1906178892,"src\/SlotNode.php":3498435644,"src\/ComponentLexer.php":1680794890,"src\/AttributesBag.php":2838536753,"tests\/ComponentTest.php":1692604728}}
{"php":"8.0.10","version":"3.1.0","indent":" ","lineEnding":"\n","rules":{"blank_line_after_namespace":true,"braces":true,"class_definition":true,"constant_case":true,"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"method_argument_space":{"on_multiline":"ensure_fully_multiline","keep_multiple_spaces_after_comma":true},"no_break_comment":true,"no_closing_tag":true,"no_spaces_after_function_name":true,"no_spaces_inside_parenthesis":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_class_element_per_statement":{"elements":["property"]},"single_import_per_statement":true,"single_line_after_imports":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"visibility_required":{"elements":["method","property"]},"encoding":true,"full_opening_tag":true,"array_syntax":{"syntax":"short"},"ordered_imports":{"sort_algorithm":"alpha"},"no_unused_imports":true,"not_operator_with_successor_space":true,"trailing_comma_in_multiline":true,"phpdoc_scalar":true,"unary_operator_spaces":true,"binary_operator_spaces":true,"blank_line_before_statement":{"statements":["break","continue","declare","return","throw","try"]},"phpdoc_single_line_var_spacing":true,"phpdoc_var_without_name":true,"class_attributes_separation":{"elements":{"method":"one"}},"single_trait_insert_per_statement":true},"hashes":{"src\/SlotBag.php":2813959692,"src\/ComponentLexer.php":1680794890,"src\/SlotTokenParser.php":1705137408,"src\/SlotNode.php":3498435644,"src\/ComponentNode.php":495735954,"src\/ComponentExtension.php":1906178892,"src\/ComponentTokenParser.php":291316121,"src\/AttributesBag.php":2838536753,"src\/Setup.php":2590804620,"src\/ComponentTagCompiler.php":1655642996,"tests\/ComponentTest.php":586052960}}
12 changes: 7 additions & 5 deletions src/ComponentTokenParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ public function __construct(string $path)

public function getComponentPath(string $name)
{
if (strpos( $name, '@' ) === 0) {
if (strpos($name, '@') === 0) {
return $name . '.twig';
}

return rtrim($this->path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $name . '.twig';
}

Expand Down Expand Up @@ -75,9 +76,9 @@ public function parseComponentName(): string

$name = $this->getNameSection();

if ( $stream->nextIf(Token::PUNCTUATION_TYPE, ':') ) {
if ($stream->nextIf(Token::PUNCTUATION_TYPE, ':')) {
$path[] = '@' . $name;
$name = $this->getNameSection();
$name = $this->getNameSection();
}

$path[] = $name;
Expand All @@ -89,14 +90,15 @@ public function parseComponentName(): string
return implode('/', $path);
}

public function getNameSection(): string {
public function getNameSection(): string
{
$stream = $this->parser->getStream();

$name = $stream->next()->getValue();

while ($stream->nextIf(Token::OPERATOR_TYPE, '-')) {
$token = $stream->nextIf(Token::NAME_TYPE);
if (! is_null( $token )) {
if (! is_null($token)) {
$name .= '-' . $token->getValue();
}
}
Expand Down

0 comments on commit 445d699

Please sign in to comment.