Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add IncludeFunctionRule in default standard fixer #218

Merged
merged 2 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ By default, the twig-cs-fixer standard is enabled with the twig coding standard
- `BlankEOFRule`: ensures that files end with one blank line.
- `BlockNameSpacingRule`: ensures there is one space before and after block names.
- `EmptyLinesRule`: ensures that 2 empty lines do not follow each other.
- `IncludeFunctionRule`: ensures that include function is used instead of function tag.
- `IndentRule`: ensures that files are not indented with tabs.
- `TrailingCommaSingleLineRule`: ensures that single-line arrays, objects and argument lists do not have a trailing comma.
- `TrailingSpaceRule`: ensures that files have no trailing spaces.
Expand Down
2 changes: 2 additions & 0 deletions src/Standard/TwigCsFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace TwigCsFixer\Standard;

use TwigCsFixer\Rules\Delimiter\BlockNameSpacingRule;
use TwigCsFixer\Rules\Function\IncludeFunctionRule;
use TwigCsFixer\Rules\Punctuation\TrailingCommaSingleLineRule;
use TwigCsFixer\Rules\String\SingleQuoteRule;
use TwigCsFixer\Rules\Whitespace\BlankEOFRule;
Expand All @@ -24,6 +25,7 @@
new BlankEOFRule(),
new BlockNameSpacingRule(),
new EmptyLinesRule(),
new IncludeFunctionRule();

Check failure on line 28 in src/Standard/TwigCsFixer.php

View workflow job for this annotation

GitHub Actions / Psalm

ParseError

src/Standard/TwigCsFixer.php:28:38: ParseError: Syntax error, unexpected ';', expecting ',' or ']' or ')' on line 28 (see https://psalm.dev/173)

Check failure on line 28 in src/Standard/TwigCsFixer.php

View workflow job for this annotation

GitHub Actions / PHPStan

Syntax error, unexpected ';', expecting ',' or ']' or ')' on line 28
VincentLanglet marked this conversation as resolved.
Show resolved Hide resolved
new IndentRule(),
new SingleQuoteRule(),
new TrailingCommaSingleLineRule(),
Expand Down
2 changes: 2 additions & 0 deletions tests/Standard/TwigCsFixerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use PHPUnit\Framework\TestCase;
use TwigCsFixer\Rules\Delimiter\BlockNameSpacingRule;
use TwigCsFixer\Rules\Delimiter\DelimiterSpacingRule;
use TwigCsFixer\Rules\Function\IncludeFunctionRule;
use TwigCsFixer\Rules\Operator\OperatorNameSpacingRule;
use TwigCsFixer\Rules\Operator\OperatorSpacingRule;
use TwigCsFixer\Rules\Punctuation\PunctuationSpacingRule;
Expand All @@ -23,7 +24,7 @@
{
public function testGetRules(): void
{
$standard = new TwigCsFixer();

Check failure on line 27 in tests/Standard/TwigCsFixerTest.php

View workflow job for this annotation

GitHub Actions / PHPStan

Instantiated class TwigCsFixer\Standard\TwigCsFixer not found.

static::assertEquals([
new DelimiterSpacingRule(),
Expand All @@ -34,10 +35,11 @@
new BlankEOFRule(),
new BlockNameSpacingRule(),
new EmptyLinesRule(),
new IncludeFunctionRule(),
new IndentRule(),
new SingleQuoteRule(),
new TrailingCommaSingleLineRule(),
new TrailingSpaceRule(),
], $standard->getRules());

Check failure on line 43 in tests/Standard/TwigCsFixerTest.php

View workflow job for this annotation

GitHub Actions / PHPStan

Call to method getRules() on an unknown class TwigCsFixer\Standard\TwigCsFixer.
}
}
Loading