Skip to content

Commit 1bf4a81

Browse files
committed
Upgrade subsplit env variable
1 parent 4260a28 commit 1bf4a81

File tree

4 files changed

+26
-13
lines changed

4 files changed

+26
-13
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<p align="center">
2-
<a href="https://railt.org"><img src="https://avatars2.githubusercontent.com/u/49816277?s=128" width="128" alt="Phplrt" /></a>
2+
<a href="https://phplrt.org"><img src="https://avatars2.githubusercontent.com/u/49816277?s=128" width="128" alt="Phplrt" /></a>
33
</p>
44

55
## Lexer

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
},
3636
"require-dev": {
3737
"phpunit/phpunit": "^9.5.20",
38-
"vimeo/psalm": "^5.6"
38+
"vimeo/psalm": "^5.12"
3939
},
4040
"autoload-dev": {
4141
"psr-4": {

src/Lexer.php

+5-4
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function __construct(array $tokens = [], array $skip = [], DriverInterfac
5858
/**
5959
* @return void
6060
*/
61-
public function disableUnrecognizedTokenException()
61+
public function disableUnrecognizedTokenException(): void
6262
{
6363
$this->throwOnError = false;
6464
}
@@ -192,7 +192,7 @@ private function run(ReadableInterface $source, int $offset): iterable
192192
continue;
193193
}
194194

195-
if (\count($unknown)) {
195+
if ($unknown !== []) {
196196
if ($this->throwOnError) {
197197
throw UnrecognizedTokenException::fromToken($source, $this->reduceUnknownToken($unknown));
198198
}
@@ -205,14 +205,15 @@ private function run(ReadableInterface $source, int $offset): iterable
205205
yield $token;
206206
}
207207

208-
if (\count($unknown)) {
208+
if ($unknown !== []) {
209209
if ($this->throwOnError) {
210210
throw UnrecognizedTokenException::fromToken($source, $this->reduceUnknownToken($unknown));
211211
}
212+
212213
yield $this->reduceUnknownToken($unknown);
213214
}
214215

215-
if (! \in_array(TokenInterface::END_OF_INPUT, $this->skip, true)) {
216+
if (!\in_array(TokenInterface::END_OF_INPUT, $this->skip, true)) {
216217
/** @psalm-suppress all : Psalm error: (offset) int<0, max> + (size) int<0, max> = int<0, max> */
217218
yield new EndOfInput(isset($token) ? $token->getOffset() + $token->getBytes() : 0);
218219
}

src/polyfill.php

+19-7
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,31 @@
22

33
namespace Phplrt\Lexer\Buffer {
44

5-
if (!class_exists(Buffer::class, false)) {
6-
class_alias(\Phplrt\Buffer\Buffer::class, Buffer::class);
5+
if (
6+
!\class_exists(Buffer::class, false)
7+
&& \class_exists(\Phplrt\Buffer\Buffer::class)
8+
) {
9+
\class_alias(\Phplrt\Buffer\Buffer::class, Buffer::class);
710
}
811

9-
if (!class_exists(ArrayBuffer::class, false)) {
10-
class_alias(\Phplrt\Buffer\ArrayBuffer::class, ArrayBuffer::class);
12+
if (
13+
!\class_exists(ArrayBuffer::class, false)
14+
&& \class_exists(\Phplrt\Buffer\ArrayBuffer::class)
15+
) {
16+
\class_alias(\Phplrt\Buffer\ArrayBuffer::class, ArrayBuffer::class);
1117
}
1218

13-
if (!class_exists(ExtrusiveBuffer::class, false)) {
14-
class_alias(\Phplrt\Buffer\ExtrusiveBuffer::class, ExtrusiveBuffer::class);
19+
if (
20+
!\class_exists(ExtrusiveBuffer::class, false)
21+
&& \class_exists(\Phplrt\Buffer\ExtrusiveBuffer::class, false)
22+
) {
23+
\class_alias(\Phplrt\Buffer\ExtrusiveBuffer::class, ExtrusiveBuffer::class);
1524
}
1625

17-
if (!class_exists(LazyBuffer::class, false)) {
26+
if (
27+
!\class_exists(LazyBuffer::class, false)
28+
&& \class_exists(\Phplrt\Buffer\LazyBuffer::class)
29+
) {
1830
class_alias(\Phplrt\Buffer\LazyBuffer::class, LazyBuffer::class);
1931
}
2032
}

0 commit comments

Comments
 (0)