@@ -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 |
@@ -51,7 +51,7 @@ |
||
51 | 51 | } |
52 | 52 | |
53 | 53 | /** |
54 | - * @param int|null $offset |
|
54 | + * @param integer $offset |
|
55 | 55 | * @return string|null |
56 | 56 | */ |
57 | 57 | public function getValue(int $offset = 0): ?string |
@@ -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 | } |
@@ -84,7 +84,7 @@ |
||
84 | 84 | |
85 | 85 | /** |
86 | 86 | * @param Readable $input |
87 | - * @return \Traversable|TokenInterface[] |
|
87 | + * @return \Generator |
|
88 | 88 | */ |
89 | 89 | protected function exec(Readable $input): \Traversable |
90 | 90 | { |
@@ -72,7 +72,7 @@ |
||
72 | 72 | $this->map[$this->id] = $name; |
73 | 73 | $this->tokens[$this->id] = $pcre; |
74 | 74 | } catch (LexerException $e) { |
75 | - $message = \preg_replace('/rule\h+id\h+\d+/iu', 'token ' . $name, $e->getMessage()); |
|
75 | + $message = \preg_replace('/rule\h+id\h+\d+/iu', 'token '.$name, $e->getMessage()); |
|
76 | 76 | |
77 | 77 | throw new BadLexemeException($message); |
78 | 78 | } |
@@ -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 | /** |
@@ -35,7 +35,7 @@ |
||
35 | 35 | public function lex(Readable $input): \Traversable |
36 | 36 | { |
37 | 37 | foreach ($this->exec($input) as $token) { |
38 | - if (! \in_array($token->getName(), $this->skipped, true)) { |
|
38 | + if (!\in_array($token->getName(), $this->skipped, true)) { |
|
39 | 39 | yield $token; |
40 | 40 | } |
41 | 41 | } |
@@ -30,7 +30,7 @@ |
||
30 | 30 | |
31 | 31 | /** |
32 | 32 | * @param Readable $input |
33 | - * @return \Traversable|TokenInterface[] |
|
33 | + * @return \Generator |
|
34 | 34 | */ |
35 | 35 | public function lex(Readable $input): \Traversable |
36 | 36 | { |
@@ -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 |