Skip to content

Commit 34fe09c

Browse files
committed
Apply phpcs
1 parent 3edccb4 commit 34fe09c

22 files changed

+69
-445
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
strategy:
1717
fail-fast: false
1818
matrix:
19-
php: [ '8.1', '8.2', '8.3', '8.4' ]
19+
php: [ '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ]
2020
os: [ ubuntu-latest, macos-latest, windows-latest ]
2121
stability: [ prefer-lowest, prefer-stable ]
2222
steps:

composer.json

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,12 @@
1717
],
1818
"require": {
1919
"php": "^8.1",
20-
"phplrt/source": "^3.7",
21-
"phplrt/buffer": "^3.7",
22-
"phplrt/exception": "^3.7",
23-
"phplrt/parser-contracts": "^3.7",
24-
"phplrt/lexer-contracts": "^3.7",
25-
"phplrt/ast-contracts": "^3.7",
26-
"symfony/deprecation-contracts": "^2.5|^3.0"
20+
"phplrt/source": "^4.0",
21+
"phplrt/buffer": "^4.0",
22+
"phplrt/exception": "^4.0",
23+
"phplrt/parser-contracts": "^4.0",
24+
"phplrt/lexer-contracts": "^4.0",
25+
"phplrt/ast-contracts": "^4.0"
2726
},
2827
"replace": {
2928
"phplrt/grammar": "<=3.1",
@@ -32,14 +31,11 @@
3231
"autoload": {
3332
"psr-4": {
3433
"Phplrt\\Parser\\": "src"
35-
},
36-
"files": [
37-
"src/polyfill.php"
38-
]
34+
}
3935
},
4036
"require-dev": {
41-
"phplrt/visitor": "^3.7",
42-
"phplrt/lexer": "^3.7",
37+
"phplrt/visitor": "^4.0",
38+
"phplrt/lexer": "^4.0",
4339
"phpunit/phpunit": "^10.5|^11.0",
4440
"phpstan/extension-installer": "^1.4",
4541
"phpstan/phpstan": "^1.11",
@@ -52,19 +48,16 @@
5248
}
5349
},
5450
"provide": {
55-
"phplrt/parser-contracts-implementation": "^3.7"
51+
"phplrt/parser-contracts-implementation": "^4.0"
5652
},
5753
"extra": {
5854
"branch-alias": {
59-
"dev-master": "3.x-dev",
60-
"dev-main": "3.x-dev"
55+
"dev-master": "4.x-dev",
56+
"dev-main": "4.x-dev"
6157
}
6258
},
6359
"config": {
64-
"sort-packages": true,
65-
"allow-plugins": {
66-
"phpstan/extension-installer": true
67-
}
60+
"sort-packages": true
6861
},
6962
"minimum-stability": "dev",
7063
"prefer-stable": true

resources/.deprecations.php

Lines changed: 0 additions & 91 deletions
This file was deleted.

src/BuilderInterface.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@
1010
interface BuilderInterface
1111
{
1212
/**
13-
* Note: Native type hints will be added in phplrt 4.0, as adding them
14-
* clearly breaks backward compatibility with inheritance.
15-
*
1613
* @param NodeInterface|TokenInterface|iterable<NodeInterface|TokenInterface> $result
1714
*/
18-
public function build(Context $context, /* mixed */ $result)/* : mixed */;
15+
public function build(Context $context, mixed $result);
1916
}

src/Context.php

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,8 @@
1717
* The presence of public modifiers in fields is required only to speed up the
1818
* parser, since direct access is several times faster than using methods of
1919
* setting values or creating a new class at each step of the parser.
20-
*
21-
* @property-read ReadableInterface $source
22-
* @property-read BufferInterface $buffer
23-
*
24-
* @final marked as final since phplrt 3.4 and will be final since 4.0
2520
*/
26-
class Context implements ContextInterface
21+
final class Context
2722
{
2823
use ContextOptionsTrait;
2924

@@ -60,6 +55,7 @@ class Context implements ContextInterface
6055
public ?RuleInterface $rule = null;
6156

6257
/**
58+
* @param array-key $state
6359
* @param array<non-empty-string, mixed> $options
6460
*/
6561
public function __construct(
@@ -77,11 +73,9 @@ public function __construct(
7773
* Note: This is a stateful data and may cause a race condition error. In
7874
* the future, it is necessary to delete this data with a replacement for
7975
* the stateless structure.
80-
*
81-
* @var array-key
8276
*/
83-
public int|string $state,
84-
array $options,
77+
public string|int $state,
78+
array $options
8579
) {
8680
$this->options = $options;
8781
$this->lastOrdinalToken = $this->lastProcessedToken = $this->buffer->current();

src/ContextInterface.php

Lines changed: 0 additions & 61 deletions
This file was deleted.

src/ContextOptionsInterface.php

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/Environment/XdebugSelector.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ final class XdebugSelector implements SelectorInterface
3333
*/
3434
private readonly bool $enabled;
3535

36+
/**
37+
* @param int<0, max> $expectedRecursionDepth
38+
*/
3639
public function __construct(
37-
/**
38-
* @var int<0, max>
39-
*/
40-
private readonly int $expectedRecursionDepth = self::DEFAULT_EXPECTED_RECURSION_DEPTH
40+
private readonly int $expectedRecursionDepth = self::DEFAULT_EXPECTED_RECURSION_DEPTH,
4141
) {
4242
$this->enabled = \extension_loaded('xdebug');
4343
$this->actualRecursionDepth = (int) \ini_get('xdebug.max_nesting_level');

src/Exception/UnexpectedTokenWithHintsException.php

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/Grammar/Alternation.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
*/
1212
class Alternation extends Production
1313
{
14+
/**
15+
* @param list<array-key> $sequence
16+
*/
1417
public function __construct(
15-
/**
16-
* @var list<array-key>
17-
*/
1818
public readonly array $sequence,
1919
) {}
2020

@@ -31,7 +31,7 @@ public function getTerminals(array $rules): iterable
3131
return $result;
3232
}
3333

34-
public function reduce(BufferInterface $buffer, \Closure $reduce): mixed
34+
public function reduce(BufferInterface $buffer, \Closure $reduce)
3535
{
3636
$rollback = $buffer->key();
3737

0 commit comments

Comments
 (0)