@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | ]); |
49 | 49 | throw new \InvalidArgumentException($error); |
50 | 50 | |
51 | - case ! self::isLookahead($flags) && \class_exists(\Parle\Lexer::class, false): |
|
51 | + case !self::isLookahead($flags) && \class_exists(\Parle\Lexer::class, false): |
|
52 | 52 | return new ParleLexer($tokens, $skip); |
53 | 53 | |
54 | 54 | default: |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | */ |
63 | 63 | private static function isLookahead(int $flags): bool |
64 | 64 | { |
65 | - return (bool)($flags & self::LOOKAHEAD); |
|
65 | + return (bool) ($flags & self::LOOKAHEAD); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
@@ -71,6 +71,6 @@ discard block |
||
71 | 71 | */ |
72 | 72 | private static function isMultistate(int $flags): bool |
73 | 73 | { |
74 | - return (bool)($flags & self::MULTISTATE); |
|
74 | + return (bool) ($flags & self::MULTISTATE); |
|
75 | 75 | } |
76 | 76 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | */ |
97 | 97 | protected function escapeTokenPattern(string $value): string |
98 | 98 | { |
99 | - return \str_replace(static::REGEX_DELIMITER, '\\' . self::REGEX_DELIMITER, $value); |
|
99 | + return \str_replace(static::REGEX_DELIMITER, '\\'.self::REGEX_DELIMITER, $value); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | /** |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | */ |
105 | 105 | private function renderFlags(): string |
106 | 106 | { |
107 | - return self::FLAG_UNICODE . self::FLAG_DOT_ALL . self::FLAG_ANALYZED; |
|
107 | + return self::FLAG_UNICODE.self::FLAG_DOT_ALL.self::FLAG_ANALYZED; |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | public function lex(Readable $input): \Traversable |
38 | 38 | { |
39 | 39 | foreach ($this->exec($input) as $token) { |
40 | - if (! \in_array($token->getName(), $this->skipped, true)) { |
|
40 | + if (!\in_array($token->getName(), $this->skipped, true)) { |
|
41 | 41 | yield $token; |
42 | 42 | } |
43 | 43 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | public function getTokenDefinitions(): iterable |
79 | 79 | { |
80 | 80 | foreach ($this->tokens as $name => $pcre) { |
81 | - yield new TokenDefinition($name, $pcre, ! \in_array($name, $this->skipped, true)); |
|
81 | + yield new TokenDefinition($name, $pcre, !\in_array($name, $this->skipped, true)); |
|
82 | 82 | } |
83 | 83 | } |
84 | 84 | } |
@@ -31,12 +31,12 @@ |
||
31 | 31 | */ |
32 | 32 | public function __toString(): string |
33 | 33 | { |
34 | - $format = function (string $value) { |
|
35 | - $value = (string)(\preg_replace('/\s+/iu', ' ', $value) ?? $value); |
|
34 | + $format = function(string $value) { |
|
35 | + $value = (string) (\preg_replace('/\s+/iu', ' ', $value) ?? $value); |
|
36 | 36 | $value = \addcslashes($value, '"'); |
37 | 37 | |
38 | 38 | if (\mb_strlen($value) > 35) { |
39 | - $value = \mb_substr($value, 0, 30) . |
|
39 | + $value = \mb_substr($value, 0, 30). |
|
40 | 40 | \sprintf('… (%s+)', \mb_strlen($value) - 30); |
41 | 41 | } |
42 | 42 |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | { |
52 | 52 | $result = new \SplQueue(); |
53 | 53 | |
54 | - $status = @\preg_replace_callback($this->pattern, function (array $matches) use ($result): void { |
|
54 | + $status = @\preg_replace_callback($this->pattern, function(array $matches) use ($result): void { |
|
55 | 55 | $result->push($matches); |
56 | 56 | }, $this->subject); |
57 | 57 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | case \PREG_BAD_UTF8_OFFSET_ERROR: |
100 | 100 | return self::PREG_BAD_UTF8_OFFSET_ERROR; |
101 | 101 | } |
102 | - return 'Unexpected PCRE error (Code ' . $code . ')'; |
|
102 | + return 'Unexpected PCRE error (Code '.$code.')'; |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | /** |
@@ -25,7 +25,7 @@ |
||
25 | 25 | $context = []; |
26 | 26 | |
27 | 27 | foreach (\array_reverse($result) as $index => $body) { |
28 | - if (! \is_string($index)) { |
|
28 | + if (!\is_string($index)) { |
|
29 | 29 | $context[] = $body; |
30 | 30 | continue; |
31 | 31 | } |
@@ -55,7 +55,7 @@ |
||
55 | 55 | public function getTokenDefinitions(): iterable |
56 | 56 | { |
57 | 57 | foreach ($this->tokens as $name => $pcre) { |
58 | - $keep = ! \in_array($name, $this->skipped, true); |
|
58 | + $keep = !\in_array($name, $this->skipped, true); |
|
59 | 59 | $state = $this->getTokenState($name); |
60 | 60 | $next = $this->getNextState($name); |
61 | 61 |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | $this->map[$this->id] = $name; |
74 | 74 | $this->tokens[$this->id] = $pcre; |
75 | 75 | } catch (LexerException $e) { |
76 | - $message = \preg_replace('/rule\h+id\h+\d+/iu', 'token ' . $name, $e->getMessage()); |
|
76 | + $message = \preg_replace('/rule\h+id\h+\d+/iu', 'token '.$name, $e->getMessage()); |
|
77 | 77 | |
78 | 78 | throw new BadLexemeException($message); |
79 | 79 | } |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | foreach ($this->tokens as $id => $pcre) { |
167 | 167 | $name = $this->map[$id]; |
168 | 168 | |
169 | - yield new TokenDefinition($name, $pcre, ! \in_array($name, $this->skipped, true)); |
|
169 | + yield new TokenDefinition($name, $pcre, !\in_array($name, $this->skipped, true)); |
|
170 | 170 | } |
171 | 171 | } |
172 | 172 | } |
@@ -38,7 +38,7 @@ |
||
38 | 38 | public function __construct(string $name, $value, int $offset = 0) |
39 | 39 | { |
40 | 40 | $this->name = $name; |
41 | - $this->value = (array)$value; |
|
41 | + $this->value = (array) $value; |
|
42 | 42 | $this->offset = $offset; |
43 | 43 | } |
44 | 44 |