-
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
63 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/Languages/Php/Patterns/PhpAsymmetricPropertyPattern.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace Tempest\Highlight\Languages\Php\Patterns; | ||
|
||
use Tempest\Highlight\IsPattern; | ||
use Tempest\Highlight\Pattern; | ||
use Tempest\Highlight\PatternTest; | ||
use Tempest\Highlight\Tokens\TokenType; | ||
use Tempest\Highlight\Tokens\TokenTypeEnum; | ||
|
||
#[PatternTest(input: 'public public(set) Foo $foo', output: 'set')] | ||
#[PatternTest(input: 'public public(get) Foo $foo', output: 'get')] | ||
#[PatternTest(input: 'public private(get) Foo $foo', output: 'get')] | ||
#[PatternTest(input: 'public protected(get) Foo $foo', output: 'get')] | ||
final readonly class PhpAsymmetricPropertyPattern implements Pattern | ||
{ | ||
use IsPattern; | ||
|
||
public function getPattern(): string | ||
{ | ||
return '/(public|private|protected)\((?<match>set|get)\)/'; | ||
} | ||
|
||
public function getTokenType(): TokenType | ||
{ | ||
return TokenTypeEnum::KEYWORD; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,20 @@ | ||
```php | ||
public static function new(mixed ...$params): self; | ||
// controller for home | ||
final readonly class HomeController | ||
{ | ||
#[Get(uri: '/home')] | ||
public function __invoke(): View | ||
{ | ||
return view('Views/home.view.php') | ||
->data( | ||
name: 'Brent', | ||
date: new DateTime(), | ||
); | ||
} | ||
|
||
#[Post(uri: '/home')] | ||
public function __invoke(): View | ||
{ | ||
} | ||
} | ||
``` |