Skip to content

Commit

Permalink
Suppresses Stempler issues
Browse files Browse the repository at this point in the history
see #767

Sets psalm level 5
  • Loading branch information
butschster committed Aug 30, 2022
1 parent b451c16 commit a040b13
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 4 deletions.
2 changes: 1 addition & 1 deletion psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"

errorLevel="7"
errorLevel="5"
hoistConstants="true"
resolveFromConfigFile="true"
findUnusedPsalmSuppress="true"
Expand Down
6 changes: 3 additions & 3 deletions src/Stempler/src/Lexer/Buffer.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function nextBytes(): string
/**
* Get next generator value without advancing the position.
*/
public function lookahead()
public function lookahead(): Byte|Token|null
{
if ($this->replay !== []) {
return $this->replay[0];
Expand All @@ -97,9 +97,9 @@ public function lookahead()
/**
* Get next byte(s) value if any.
*
* @param int $size Size of lookup string.
* @param positive-int $size Size of lookup string.
*/
public function lookaheadByte(int $size = 1): ?string
public function lookaheadByte(int $size = 1): string
{
$result = '';
$replay = [];
Expand Down
6 changes: 6 additions & 0 deletions src/Stempler/src/Lexer/Grammar/Dynamic/BracesGrammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,12 @@ private function ends(Buffer $src, Byte $n): bool

/**
* Fetch next N bytes.
*
* @param positive-int $size
*
* TODO issue #767
* @link https://github.com/spiral/framework/issues/767
* @psalm-suppress UndefinedPropertyFetch
*/
private function nextBytes(Buffer $src, int $size): string
{
Expand Down
5 changes: 5 additions & 0 deletions src/Stempler/src/Lexer/Grammar/Dynamic/DeclareGrammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ final class DeclareGrammar implements GrammarInterface

private array $keyword = [];

/**
* TODO issue #767
* @link https://github.com/spiral/framework/issues/767
* @psalm-suppress UndefinedPropertyFetch
*/
public function parse(Buffer $src): \Generator
{
$quoted = [];
Expand Down
5 changes: 5 additions & 0 deletions src/Stempler/src/Lexer/Grammar/Dynamic/DirectiveGrammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,11 @@ private function flushName(): void
$this->name = [];
}

/**
* TODO issue #767
* @link https://github.com/spiral/framework/issues/767
* @psalm-suppress UndefinedPropertyFetch
*/
private function parseBody(Buffer $src): bool
{
$this->body = [];
Expand Down
5 changes: 5 additions & 0 deletions src/Stempler/src/Lexer/Grammar/HTMLGrammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,11 @@ private function tagName(array $tag): string
return '';
}

/**
* TODO issue #767
* @link https://github.com/spiral/framework/issues/767
* @psalm-suppress UndefinedPropertyFetch
*/
private function parseGrammar(Buffer $src): ?array
{
$this->tokens = [
Expand Down
4 changes: 4 additions & 0 deletions src/Stempler/src/Lexer/Grammar/InlineGrammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ public static function tokenName(int $token): string

/**
* @return Token[]|null
*
* TODO issue #767
* @link https://github.com/spiral/framework/issues/767
* @psalm-suppress UndefinedPropertyFetch
*/
private function parseGrammar(Buffer $src, int $offset): ?array
{
Expand Down

0 comments on commit a040b13

Please sign in to comment.