From ac11c63f17322e31dc6d8c5e8dada54423d66fe0 Mon Sep 17 00:00:00 2001 From: Vincent Langlet Date: Tue, 13 Aug 2024 18:27:40 +0200 Subject: [PATCH] Fix GPG key (#299) --- .github/workflows/phar.yaml | 10 ++++------ tests/Binary/Fixtures/.twig-cs-fixer.php | 14 +++++++------- tests/Cache/SignatureTest.php | 2 +- tests/Environment/StubbedEnvironmentTest.php | 2 +- tests/Report/ReporterFactoryTest.php | 2 +- tests/Rules/Node/NodeRuleTest.php | 6 +++--- tests/Rules/RuleTest.php | 4 ++-- tests/Rules/SpacingRuleTest.php | 2 +- tests/Ruleset/RulesetTest.php | 4 ++-- tests/Runner/FixerTest.php | 16 ++++++++-------- 10 files changed, 30 insertions(+), 32 deletions(-) diff --git a/.github/workflows/phar.yaml b/.github/workflows/phar.yaml index 47fb342d..8001aba9 100644 --- a/.github/workflows/phar.yaml +++ b/.github/workflows/phar.yaml @@ -45,19 +45,17 @@ jobs: run: bin/twig-cs-fixer.phar lint -c tests/Binary/Fixtures/.twig-cs-fixer.php tests/Binary/Fixtures/file.twig - name: Import GPG key - if: github.event_name == 'release' uses: crazy-max/ghaction-import-gpg@v6 with: - gpg_private_key: ${{ secrets.GPG_KEY_AC0E7FD8858D80003AA88FF8DEBB71EDE9601234 }} - passphrase: ${{ secrets.GPG_KEY_AC0E7FD8858D80003AA88FF8DEBB71EDE9601234_PASSPHRASE }} + gpg_private_key: ${{ secrets.GPG_KEY_6371FDC534E47BD979208B6F21A10B2F4F0488C9 }} + passphrase: ${{ secrets.GPG_KEY_6371FDC534E47BD979208B6F21A10B2F4F0488C9_PASSPHRASE }} - name: Sign the PHAR - if: github.event_name == 'release' run: | - gpg --local-user VincentLanglet@users.noreply.github.com \ + gpg --local-user 6371FDC534E47BD979208B6F21A10B2F4F0488C9 \ --batch \ --yes \ - --passphrase="${{ secrets.GPG_KEY_AC0E7FD8858D80003AA88FF8DEBB71EDE9601234_PASSPHRASE }}" \ + --passphrase="${{ secrets.GPG_KEY_6371FDC534E47BD979208B6F21A10B2F4F0488C9_PASSPHRASE }}" \ --detach-sign \ --output bin/twig-cs-fixer.phar.asc \ bin/twig-cs-fixer.phar diff --git a/tests/Binary/Fixtures/.twig-cs-fixer.php b/tests/Binary/Fixtures/.twig-cs-fixer.php index 410b3283..a5532061 100644 --- a/tests/Binary/Fixtures/.twig-cs-fixer.php +++ b/tests/Binary/Fixtures/.twig-cs-fixer.php @@ -20,27 +20,27 @@ use TwigCsFixer\Standard\StandardInterface; use TwigCsFixer\Token\Tokens; -$rule = new class() extends AbstractRule { +$rule = new class extends AbstractRule { protected function process(int $tokenIndex, Tokens $tokens): void { } }; -$nodeRule = new class() extends AbstractNodeRule { +$nodeRule = new class extends AbstractNodeRule { public function enterNode(Node $node, Environment $env): Node { return $node; } }; -$standard = new class() implements StandardInterface { +$standard = new class implements StandardInterface { public function getRules(): array { return []; } }; -$reporter = new class() implements ReporterInterface { +$reporter = new class implements ReporterInterface { public function display( OutputInterface $output, Report $report, @@ -55,7 +55,7 @@ public function getName(): string } }; -$twigExtension = new class() implements ExtensionInterface { +$twigExtension = new class implements ExtensionInterface { public function getTokenParsers(): array { return []; @@ -87,7 +87,7 @@ public function getOperators(): array } }; -$tokenParser = new class() implements TokenParserInterface { +$tokenParser = new class implements TokenParserInterface { public function setParser(Parser $parser): void { } @@ -103,7 +103,7 @@ public function getTag(): string } }; -$nodeVisitor = new class() implements NodeVisitorInterface { +$nodeVisitor = new class implements NodeVisitorInterface { public function enterNode(Node $node, Environment $env): Node { return $node; diff --git a/tests/Cache/SignatureTest.php b/tests/Cache/SignatureTest.php index 5d1f065e..eebddc4c 100644 --- a/tests/Cache/SignatureTest.php +++ b/tests/Cache/SignatureTest.php @@ -31,7 +31,7 @@ public function testSignatureFromRuleset(): void $rule = self::createStub(RuleInterface::class); $ruleset->addRule($rule); - $configurableRule = new class() extends AbstractRule implements ConfigurableRuleInterface { + $configurableRule = new class extends AbstractRule implements ConfigurableRuleInterface { public function getConfiguration(): array { return ['a' => 1]; diff --git a/tests/Environment/StubbedEnvironmentTest.php b/tests/Environment/StubbedEnvironmentTest.php index 4cec7a6f..da26763b 100644 --- a/tests/Environment/StubbedEnvironmentTest.php +++ b/tests/Environment/StubbedEnvironmentTest.php @@ -185,7 +185,7 @@ public function testParseWithCustomNodeVisitor(): void $content = file_get_contents(__DIR__.'/Fixtures/node_visitor.html.twig'); static::assertNotFalse($content); - $visitor = new class() implements NodeVisitorInterface { + $visitor = new class implements NodeVisitorInterface { public int $called = 0; public function enterNode(Node $node, Environment $env): Node diff --git a/tests/Report/ReporterFactoryTest.php b/tests/Report/ReporterFactoryTest.php index dc406ebe..d5ab6e37 100644 --- a/tests/Report/ReporterFactoryTest.php +++ b/tests/Report/ReporterFactoryTest.php @@ -39,7 +39,7 @@ public function testGetUnsupporterReporter(): void public function testGetCustomReporter(): void { - $fooReporter = new class() implements ReporterInterface { + $fooReporter = new class implements ReporterInterface { public function getName(): string { return 'foo'; diff --git a/tests/Rules/Node/NodeRuleTest.php b/tests/Rules/Node/NodeRuleTest.php index 31a2e8aa..decbc56d 100644 --- a/tests/Rules/Node/NodeRuleTest.php +++ b/tests/Rules/Node/NodeRuleTest.php @@ -24,7 +24,7 @@ public function testEnterNodeRule(): void { $report = new Report([new \SplFileInfo('fakeFile.html.twig')]); - $rule = new class() extends AbstractNodeRule { + $rule = new class extends AbstractNodeRule { public function enterNode(Node $node, Environment $env): Node { $this->addWarning('Fake Warning', $node); @@ -50,7 +50,7 @@ public function testLeaveNodeRule(): void { $report = new Report([new \SplFileInfo('fakeFile.html.twig')]); - $rule = new class() extends AbstractNodeRule { + $rule = new class extends AbstractNodeRule { public function leaveNode(Node $node, Environment $env): Node { $this->addWarning('Fake Warning', $node); @@ -81,7 +81,7 @@ public function testRuleName(): void public function testNodeVisitorPriority(): void { - $rule = new class() extends AbstractNodeRule {}; + $rule = new class extends AbstractNodeRule {}; static::assertSame(0, $rule->getPriority()); } diff --git a/tests/Rules/RuleTest.php b/tests/Rules/RuleTest.php index 8a3bdeea..c39823d7 100644 --- a/tests/Rules/RuleTest.php +++ b/tests/Rules/RuleTest.php @@ -22,7 +22,7 @@ public function testRuleWithReport(): void { $report = new Report([new \SplFileInfo('fakeFile.html.twig')]); - $rule = new class() extends AbstractFixableRule { + $rule = new class extends AbstractFixableRule { protected function process(int $tokenIndex, Tokens $tokens): void { $token = $tokens->get($tokenIndex); @@ -55,7 +55,7 @@ public function testRuleWithReport2(): void { $report = new Report([new \SplFileInfo('fakeFile.html.twig')]); - $rule = new class() extends AbstractFixableRule { + $rule = new class extends AbstractFixableRule { protected function process(int $tokenIndex, Tokens $tokens): void { $token = $tokens->get($tokenIndex); diff --git a/tests/Rules/SpacingRuleTest.php b/tests/Rules/SpacingRuleTest.php index 9634aa01..06e15477 100644 --- a/tests/Rules/SpacingRuleTest.php +++ b/tests/Rules/SpacingRuleTest.php @@ -14,7 +14,7 @@ final class SpacingRuleTest extends TestCase { public function testSpacingRule(): void { - $rule = new class() extends AbstractSpacingRule { + $rule = new class extends AbstractSpacingRule { protected function getSpaceBefore(int $tokenIndex, Tokens $tokens): ?int { $token = $tokens->get($tokenIndex); diff --git a/tests/Ruleset/RulesetTest.php b/tests/Ruleset/RulesetTest.php index 43a00d90..10f38cb9 100644 --- a/tests/Ruleset/RulesetTest.php +++ b/tests/Ruleset/RulesetTest.php @@ -71,12 +71,12 @@ public function testAllowNonFixableRules(): void { $ruleset = new Ruleset(); - $rule1 = new class() extends AbstractRule { + $rule1 = new class extends AbstractRule { protected function process(int $tokenIndex, Tokens $tokens): void { } }; - $rule2 = new class() extends AbstractFixableRule { + $rule2 = new class extends AbstractFixableRule { protected function process(int $tokenIndex, Tokens $tokens): void { } diff --git a/tests/Runner/FixerTest.php b/tests/Runner/FixerTest.php index cfe9ac4b..c4da3253 100644 --- a/tests/Runner/FixerTest.php +++ b/tests/Runner/FixerTest.php @@ -51,7 +51,7 @@ public function testReplaceToken(): void { $tokenizer = new Tokenizer(new StubbedEnvironment()); - $rule = new class() extends AbstractFixableRule { + $rule = new class extends AbstractFixableRule { private bool $isAlreadyExecuted = false; protected function process(int $tokenIndex, Tokens $tokens): void @@ -97,7 +97,7 @@ public function testReplaceTokenIsDesignedAgainstInfiniteLoop(): void { $tokenizer = new Tokenizer(new StubbedEnvironment()); - $rule = new class() extends AbstractFixableRule { + $rule = new class extends AbstractFixableRule { protected function process(int $tokenIndex, Tokens $tokens): void { $fixer = $this->addFixableError('Error', $tokens->get($tokenIndex)); @@ -122,7 +122,7 @@ public function testReplaceTokenIsDesignedAgainstConflict(): void { $tokenizer = new Tokenizer(new StubbedEnvironment()); - $rule1 = new class() extends AbstractFixableRule { + $rule1 = new class extends AbstractFixableRule { private bool $isAlreadyExecuted = false; protected function process(int $tokenIndex, Tokens $tokens): void @@ -140,7 +140,7 @@ protected function process(int $tokenIndex, Tokens $tokens): void $fixer->replaceToken($tokenIndex, 'rule'); } }; - $rule2 = new class() extends AbstractFixableRule { + $rule2 = new class extends AbstractFixableRule { private int $error = 0; protected function process(int $tokenIndex, Tokens $tokens): void @@ -172,7 +172,7 @@ protected function process(int $tokenIndex, Tokens $tokens): void $fixer->endChangeSet(); } }; - $rule3 = new class() extends AbstractFixableRule { + $rule3 = new class extends AbstractFixableRule { private bool $isAlreadyExecuted = false; protected function process(int $tokenIndex, Tokens $tokens): void @@ -210,7 +210,7 @@ public function testIgnoredViolations(): void { $tokenizer = new Tokenizer(new StubbedEnvironment()); - $rule = new class() extends AbstractFixableRule { + $rule = new class extends AbstractFixableRule { public function getShortName(): string { return 'Rule'; @@ -247,7 +247,7 @@ public function testAddContentMethods(string $content, string $expected): void { $tokenizer = new Tokenizer(new StubbedEnvironment()); - $rule = new class() extends AbstractFixableRule { + $rule = new class extends AbstractFixableRule { private bool $isAlreadyExecuted = false; protected function process(int $tokenIndex, Tokens $tokens): void @@ -313,7 +313,7 @@ public function testNonFixableRulesAreSkipped(): void { $tokenizer = new Tokenizer(new StubbedEnvironment()); - $rule = new class() extends AbstractRule { + $rule = new class extends AbstractRule { protected function process(int $tokenIndex, Tokens $tokens): void { throw new \LogicException('Should be skipped');