Skip to content

Commit

Permalink
Enable strict_types across the project
Browse files Browse the repository at this point in the history
  • Loading branch information
drjayvee committed Oct 21, 2024
1 parent 09ad502 commit 539ecd4
Show file tree
Hide file tree
Showing 16 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/Assertion/AssertType.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);

namespace AlisQI\TwigQI\Assertion;

Expand Down
2 changes: 1 addition & 1 deletion src/Assertion/AssertedTypesNode.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);

namespace AlisQI\TwigQI\Assertion;

Expand Down
2 changes: 1 addition & 1 deletion src/Assertion/WrapTypesInAssertedTypes.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);

namespace AlisQI\TwigQI\Assertion;

Expand Down
2 changes: 1 addition & 1 deletion src/Extension.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);

namespace AlisQI\TwigQI;

Expand Down
2 changes: 1 addition & 1 deletion src/Inspection/BadArgumentCountInMacroCall.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);

namespace AlisQI\TwigQI\Inspection;

Expand Down
8 changes: 4 additions & 4 deletions src/Inspection/InvalidConstant.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);

namespace AlisQI\TwigQI\Inspection;

Expand Down Expand Up @@ -36,10 +36,10 @@ private function checkArguments(FunctionExpression $node): void
$location = "$sourcePath:{$node->getTemplateLine()}";

if (count($arguments) === 1) {
$error = $this->checkConstant($arguments->getNode(0));
$error = $this->checkConstant($arguments->getNode('0'));
} else {
if (count($arguments) === 2) {
$error = $this->checkConstantAndObject($arguments->getNode(0), $arguments->getNode(1));
$error = $this->checkConstantAndObject($arguments->getNode('0'), $arguments->getNode('1'));
} else {
$error = 'too many arguments';
}
Expand All @@ -58,7 +58,7 @@ private function checkConstant(Node $node): ?string

$value = $node->getAttribute('value');

if (!defined($value)) {
if (!is_string($value) || !defined($value)) {
return "invalid constant: '$value'";
}

Expand Down
2 changes: 1 addition & 1 deletion src/Inspection/RequiredMacroArgumentAfterOptional.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);

namespace AlisQI\TwigQI\Inspection;

Expand Down
2 changes: 1 addition & 1 deletion src/Inspection/UndeclaredVariableInMacro.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);

namespace AlisQI\TwigQI\Inspection;

Expand Down
2 changes: 1 addition & 1 deletion src/Inspection/ValidTypes.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);

namespace AlisQI\TwigQI\Inspection;

Expand Down
2 changes: 1 addition & 1 deletion tests/AbstractTestCase.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);

namespace AlisQI\TwigQI\Tests;

Expand Down
2 changes: 1 addition & 1 deletion tests/BadArgumentCountInMacroCallTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);

namespace AlisQI\TwigQI\Tests;

Expand Down
2 changes: 1 addition & 1 deletion tests/InvalidConstantTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);

namespace AlisQI\TwigQI\Tests;

Expand Down
2 changes: 1 addition & 1 deletion tests/RequiredMacroArgumentAfterOptionalTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);

use AlisQI\TwigQI\Tests\AbstractTestCase;

Expand Down
2 changes: 1 addition & 1 deletion tests/TypeAssertionsTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);

namespace AlisQI\TwigQI\Tests;

Expand Down
2 changes: 1 addition & 1 deletion tests/UndeclaredVariableInMacroTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);

namespace AlisQI\TwigQI\Tests;

Expand Down
2 changes: 1 addition & 1 deletion tests/ValidTypesTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);

namespace AlisQI\TwigQI\Tests;

Expand Down

0 comments on commit 539ecd4

Please sign in to comment.