Skip to content

Commit

Permalink
Fixes styling.
Browse files Browse the repository at this point in the history
  • Loading branch information
brendt authored and github-actions[bot] committed Mar 16, 2024
1 parent 93c0552 commit 18ec88b
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 15 deletions.
3 changes: 2 additions & 1 deletion src/Languages/Php/Patterns/AttributePattern.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
output:
'#[Foo(
prop: hi,
)]'),
)]'
),
]
final readonly class AttributePattern implements Pattern
{
Expand Down
5 changes: 3 additions & 2 deletions src/Languages/Php/Patterns/TypedConstantNamePattern.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?php

namespace Tempest\Highlight\Languages\Php\Patterns;
declare(strict_types=1);

namespace Tempest\Highlight\Languages\Php\Patterns;

use Tempest\Highlight\IsPattern;
use Tempest\Highlight\Pattern;
Expand All @@ -25,4 +26,4 @@ public function getTokenType(): TokenType
{
return TokenType::PROPERTY;
}
}
}
4 changes: 3 additions & 1 deletion src/Languages/Php/Patterns/UntypedConstantNamePattern.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Tempest\Highlight\Languages\Php\Patterns;

use Tempest\Highlight\IsPattern;
Expand All @@ -24,4 +26,4 @@ public function getTokenType(): TokenType
{
return TokenType::PROPERTY;
}
}
}
7 changes: 5 additions & 2 deletions src/PatternTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Tempest\Highlight;

use Attribute;
Expand All @@ -10,5 +12,6 @@
public function __construct(
public string $input,
public string|array $output,
) {}
}
) {
}
}
15 changes: 8 additions & 7 deletions tests/PatternsTest.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
<?php

declare(strict_types=1);

namespace Tempest\Highlight\Tests;

use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
use ReflectionClass;
use Tempest\Highlight\Pattern;
use Tempest\Highlight\PatternTest;

final class PatternsTest extends TestCase
{
use TestsPatterns;

#[Test]
public function test_patterns_with_attribute()
public function test_patterns_with_attribute()
{
$patternFiles = glob(__DIR__ . '/../src/Languages/*/Patterns/**.php');

foreach ($patternFiles as $patternFile) {
$className = str_replace(
search: [__DIR__ . '/../src/', '/', '.php'],
Expand All @@ -28,9 +29,9 @@ public function test_patterns_with_attribute()

$attributes = $reflectionClass->getAttributes(PatternTest::class);

// if ($attributes === []) {
// $this->fail("No #[PatternTest] attribute found on {$reflectionClass->getName()}");
// }
// if ($attributes === []) {
// $this->fail("No #[PatternTest] attribute found on {$reflectionClass->getName()}");
// }

foreach ($attributes as $attribute) {
/** @var PatternTest $patternTest */
Expand All @@ -44,4 +45,4 @@ public function test_patterns_with_attribute()
}
}
}
}
}
3 changes: 1 addition & 2 deletions tests/TestsPatterns.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ public function assertMatches(
Pattern $pattern,
string $content,
string|array $expected,
): void
{
): void {
$matches = $pattern->match($content);

if (is_string($expected)) {
Expand Down

0 comments on commit 18ec88b

Please sign in to comment.