Skip to content

Commit d0af781

Browse files
committed
Various static and linting prompted fixes
1 parent ed64131 commit d0af781

8 files changed

Lines changed: 9 additions & 12 deletions

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
}
1111
],
1212
"require": {
13-
"php": "^8.1.0",
13+
"php": "^8.1 || ^8.2 || ^8.3 || ^8.4",
1414
"ext-gettext": "*",
1515
"twig/twig": "^v3.21",
1616
"symfony/finder": "^4.0 || ^5.0",

psalm.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
55
xmlns="https://getpsalm.org/schema/config"
66
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
7-
findUnusedBaselineEntry="true"
8-
findUnusedCode="true"
7+
ensureOverrideAttribute="false"
98
>
109
<projectFiles>
1110
<directory name="src" />

src/ExtractionException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66

77
use Exception;
88

9-
class ExtractionException extends Exception
9+
final class ExtractionException extends Exception
1010
{
1111
}

src/NodeVisitor/Message.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace Acpr\I18n\NodeVisitor;
66

7-
class Message
7+
final class Message
88
{
99
/**
1010
* @param string $original The original text, or key to use for the translation

src/NodeVisitor/PhpParserNodeVisitor.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Acpr\I18n\NodeVisitor;
66

7+
use Override;
78
use PhpParser\Node;
89
use PhpParser\Node\Arg;
910
use PhpParser\Node\Expr\MethodCall;
@@ -27,6 +28,7 @@ public function getMessages(): array
2728
return $this->messages;
2829
}
2930

31+
#[Override]
3032
public function leaveNode(Node $node)
3133
{
3234
if (!$node instanceof MethodCall) {

src/TokenParser/BadPluralisationRuleException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66

77
use Exception;
88

9-
class BadPluralisationRuleException extends Exception
9+
final class BadPluralisationRuleException extends Exception
1010
{
1111
}

src/TokenParser/TransTokenParser.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
use Acpr\I18n\Node\TransNode;
1717
use Twig\Error\SyntaxError;
18-
use Twig\Node\Expression\AbstractExpression;
1918
use Twig\Node\Expression\ArrayExpression;
2019
use Twig\Node\Node;
2120
use Twig\Node\TextNode;
@@ -48,21 +47,18 @@ public function parse(Token $token): Node
4847
if ($stream->test('count')) {
4948
// {% trans count 5 %}
5049
$stream->next();
51-
/** @var AbstractExpression $count */
5250
$count = $this->parser->parseExpression();
5351
}
5452

5553
if ($stream->test('with')) {
5654
// {% trans with vars %}
5755
$stream->next();
58-
/** @var AbstractExpression $vars */
5956
$vars = $this->parser->parseExpression();
6057
}
6158

6259
if ($stream->test('from')) {
6360
// {% trans from "messages" %}
6461
$stream->next();
65-
/** @var AbstractExpression $domain */
6662
$domain = $this->parser->parseExpression();
6763
}
6864

@@ -144,7 +140,7 @@ public function parse(Token $token): Node
144140
preg_replace('/\s{2,}/', ' ', $msg)
145141
);
146142

147-
return new TransNode($body, $plural, $domain, $count, $vars, $notes, $context, $lineno, $this->getTag());
143+
return new TransNode($body, $plural, $domain, $count, $vars, $notes, $context, $lineno);
148144
}
149145

150146
/**

src/TokenParser/UnhandledPluralisationRuleException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66

77
use Exception;
88

9-
class UnhandledPluralisationRuleException extends Exception
9+
final class UnhandledPluralisationRuleException extends Exception
1010
{
1111
}

0 commit comments

Comments
 (0)