Skip to content

Commit ad3391b

Browse files
committed
Add xdebug recursion nesting level fix
1 parent 2f121b4 commit ad3391b

File tree

75 files changed

+92
-781
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+92
-781
lines changed

composer.json

+10-10
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818
}
1919
],
2020
"require": {
21-
"php": ">=7.4",
21+
"php": "^7.4|^8.0",
2222
"ffi/preprocessor-contracts": "^1.0",
2323
"psr/log": "^1.0|^2.0|^3.0",
24-
"phplrt/parser": "^3.1",
25-
"phplrt/lexer": "^3.1",
26-
"symfony/polyfill-php80": "^1.24",
27-
"symfony/polyfill-ctype": "^1.24"
24+
"phplrt/parser": "^3.2",
25+
"phplrt/lexer": "^3.2",
26+
"symfony/polyfill-php80": "^1.27",
27+
"symfony/polyfill-ctype": "^1.27"
2828
},
2929
"autoload": {
3030
"psr-4": {
@@ -33,11 +33,11 @@
3333
},
3434
"require-dev": {
3535
"jetbrains/phpstorm-attributes": "^1.0",
36-
"phpunit/phpunit": "^9.5",
37-
"monolog/monolog": "^2.3",
38-
"phplrt/phplrt": "^3.1",
39-
"vimeo/psalm": "^4.21",
40-
"squizlabs/php_codesniffer": "^3.6"
36+
"phpunit/phpunit": "^9.6",
37+
"monolog/monolog": "^2.9|^3.0",
38+
"phplrt/phplrt": "^3.2",
39+
"vimeo/psalm": "^5.14",
40+
"squizlabs/php_codesniffer": "^3.7"
4141
},
4242
"autoload-dev": {
4343
"psr-4": {

psalm.xml

+7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
<?xml version="1.0"?>
22
<psalm
33
errorLevel="1"
4+
resolveFromConfigFile="true"
5+
findUnusedCode="false"
6+
findUnusedBaselineEntry="true"
7+
findUnusedPsalmSuppress="true"
8+
cacheDirectory="vendor/.psalm.cache"
49
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
510
xmlns="https://getpsalm.org/schema/config"
611
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
712
>
813
<projectFiles>
914
<directory name="src" />
15+
1016
<ignoreFiles>
17+
<!-- vendor -->
1118
<directory name="vendor" />
1219
</ignoreFiles>
1320
</projectFiles>

src/Directive/Directive.php

+5-27
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
<?php
22

3-
/**
4-
* This file is part of FFI package.
5-
*
6-
* For the full copyright and license information, please view the LICENSE
7-
* file that was distributed with this source code.
8-
*/
9-
103
declare(strict_types=1);
114

125
namespace FFI\Preprocessor\Directive;
@@ -16,37 +9,32 @@
169
abstract class Directive implements FunctionLikeDirectiveInterface
1710
{
1811
/**
19-
* @var string
12+
* @var non-empty-string
2013
*/
2114
private const ERROR_TOO_MANY_ARGUMENTS = 'Too many arguments when macro directive is called, %s required';
2215

2316
/**
24-
* @var string
17+
* @var non-empty-string
2518
*/
2619
private const ERROR_TOO_FEW_ARGUMENTS = 'Too few arguments when macro directive is called, %s required';
2720

2821
/**
29-
* @var positive-int|0
22+
* @var int<0, max>
3023
*/
3124
protected int $minArgumentsCount = 0;
3225

3326
/**
34-
* @var positive-int|0
27+
* @var int<0, max>
3528
*/
3629
protected int $maxArgumentsCount = 0;
3730

38-
/**
39-
* @param string $body
40-
* @return string
41-
*/
4231
protected function normalizeBody(string $body): string
4332
{
4433
return \str_replace("\\\n", "\n", $body);
4534
}
4635

4736
/**
48-
* @param array|string[] $arguments
49-
* @return void
37+
* @param list<string> $arguments
5038
*/
5139
protected function assertArgumentsCount(array $arguments): void
5240
{
@@ -61,26 +49,16 @@ protected function assertArgumentsCount(array $arguments): void
6149
}
6250
}
6351

64-
/**
65-
* {@inheritDoc}
66-
*/
6752
public function getMaxArgumentsCount(): int
6853
{
6954
return $this->maxArgumentsCount;
7055
}
7156

72-
/**
73-
* {@inheritDoc}
74-
*/
7557
public function getMinArgumentsCount(): int
7658
{
7759
return $this->minArgumentsCount;
7860
}
7961

80-
/**
81-
* @param mixed $result
82-
* @return string
83-
*/
8462
public static function render($result): string
8563
{
8664
switch (true) {

src/Directive/FunctionDirective.php

+1-16
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,14 @@
11
<?php
22

3-
/**
4-
* This file is part of FFI package.
5-
*
6-
* For the full copyright and license information, please view the LICENSE
7-
* file that was distributed with this source code.
8-
*/
9-
103
declare(strict_types=1);
114

125
namespace FFI\Preprocessor\Directive;
136

147
final class FunctionDirective extends Directive
158
{
16-
/**
17-
* @var \Closure
18-
*/
199
private \Closure $callback;
2010

2111
/**
22-
* @param callable $cb
2312
* @throws \ReflectionException
2413
*/
2514
public function __construct(callable $cb)
@@ -32,12 +21,8 @@ public function __construct(callable $cb)
3221
$this->maxArgumentsCount = $reflection->getNumberOfParameters();
3322
}
3423

35-
/**
36-
* @param string ...$args
37-
* @return string
38-
*/
3924
public function __invoke(string ...$args): string
4025
{
41-
return $this->render(($this->callback)(...$args));
26+
return self::render(($this->callback)(...$args));
4227
}
4328
}

src/Directive/FunctionLikeDirective.php

-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
<?php
22

3-
/**
4-
* This file is part of FFI package.
5-
*
6-
* For the full copyright and license information, please view the LICENSE
7-
* file that was distributed with this source code.
8-
*/
9-
103
declare(strict_types=1);
114

125
namespace FFI\Preprocessor\Directive;

src/Directive/FunctionLikeDirective/Compiler.php

-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
<?php
22

3-
/**
4-
* This file is part of FFI package.
5-
*
6-
* For the full copyright and license information, please view the LICENSE
7-
* file that was distributed with this source code.
8-
*/
9-
103
declare(strict_types=1);
114

125
namespace FFI\Preprocessor\Directive\FunctionLikeDirective;

src/Directive/ObjectLikeDirective.php

-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
<?php
22

3-
/**
4-
* This file is part of FFI package.
5-
*
6-
* For the full copyright and license information, please view the LICENSE
7-
* file that was distributed with this source code.
8-
*/
9-
103
declare(strict_types=1);
114

125
namespace FFI\Preprocessor\Directive;

src/Directive/Repository.php

-25
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
<?php
22

3-
/**
4-
* This file is part of FFI package.
5-
*
6-
* For the full copyright and license information, please view the LICENSE
7-
* file that was distributed with this source code.
8-
*/
9-
103
declare(strict_types=1);
114

125
namespace FFI\Preprocessor\Directive;
@@ -54,9 +47,6 @@ private function cast($directive): DirectiveInterface
5447
}
5548
}
5649

57-
/**
58-
* {@inheritDoc}
59-
*/
6050
public function define(string $directive, $value = DirectiveInterface::DEFAULT_VALUE): void
6151
{
6252
try {
@@ -72,9 +62,6 @@ public function define(string $directive, $value = DirectiveInterface::DEFAULT_V
7262
}
7363
}
7464

75-
/**
76-
* {@inheritDoc}
77-
*/
7865
public function undef(string $directive): bool
7966
{
8067
$exists = $this->defined($directive);
@@ -84,33 +71,21 @@ public function undef(string $directive): bool
8471
return $exists;
8572
}
8673

87-
/**
88-
* {@inheritDoc}
89-
*/
9074
public function defined(string $directive): bool
9175
{
9276
return isset($this->directives[$directive]);
9377
}
9478

95-
/**
96-
* {@inheritDoc}
97-
*/
9879
public function find(string $directive): ?DirectiveInterface
9980
{
10081
return $this->directives[$directive] ?? null;
10182
}
10283

103-
/**
104-
* {@inheritDoc}
105-
*/
10684
public function getIterator(): \Traversable
10785
{
10886
return new \ArrayIterator($this->directives);
10987
}
11088

111-
/**
112-
* {@inheritDoc}
113-
*/
11489
public function count(): int
11590
{
11691
return \count($this->directives);

src/Environment/CVersion.php

+4-11
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,28 @@
11
<?php
22

3-
/**
4-
* This file is part of FFI package.
5-
*
6-
* For the full copyright and license information, please view the LICENSE
7-
* file that was distributed with this source code.
8-
*/
9-
103
declare(strict_types=1);
114

125
namespace FFI\Preprocessor\Environment;
136

147
final class CVersion
158
{
169
/**
17-
* @var int
10+
* @var int<0, max>
1811
*/
1912
public const VERSION_ISO_C94 = 199409;
2013

2114
/**
22-
* @var int
15+
* @var int<0, max>
2316
*/
2417
public const VERSION_ISO_C99 = 199901;
2518

2619
/**
27-
* @var int
20+
* @var int<0, max>
2821
*/
2922
public const VERSION_ISO_C11 = 201112;
3023

3124
/**
32-
* @var int
25+
* @var int<0, max>
3326
*/
3427
public const VERSION_ISO_C18 = 201710;
3528
}
-10
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
<?php
22

3-
/**
4-
* This file is part of FFI package.
5-
*
6-
* For the full copyright and license information, please view the LICENSE
7-
* file that was distributed with this source code.
8-
*/
9-
103
declare(strict_types=1);
114

125
namespace FFI\Preprocessor\Environment;
@@ -15,8 +8,5 @@
158

169
interface EnvironmentInterface
1710
{
18-
/**
19-
* @param PreprocessorInterface $pre
20-
*/
2111
public function applyTo(PreprocessorInterface $pre): void;
2212
}

0 commit comments

Comments
 (0)