Skip to content

Commit c793b84

Browse files
authored
Bump nikic/php-parser to ^5.7.0 (#7724)
* Bump nikic/php-parser to ^5.7.0 * remove Anonymous tweak on BetterStandardPrinter
1 parent c8d38dc commit c793b84

File tree

2 files changed

+1
-18
lines changed

2 files changed

+1
-18
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"doctrine/inflector": "^2.1",
2121
"illuminate/container": "12.39.*",
2222
"nette/utils": "^4.1",
23-
"nikic/php-parser": "^5.6.2",
23+
"nikic/php-parser": "^5.7",
2424
"ondram/ci-detector": "^4.2",
2525
"phpstan/phpdoc-parser": "^2.3",
2626
"phpstan/phpstan": "^2.1.33",

src/PhpParser/Printer/BetterStandardPrinter.php

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
use PhpParser\Node\Expr\Instanceof_;
2020
use PhpParser\Node\Expr\Match_;
2121
use PhpParser\Node\Expr\MethodCall;
22-
use PhpParser\Node\Expr\New_;
2322
use PhpParser\Node\Expr\Ternary;
2423
use PhpParser\Node\Expr\Yield_;
2524
use PhpParser\Node\InterpolatedStringPart;
@@ -30,7 +29,6 @@
3029
use PhpParser\Node\Stmt\Nop;
3130
use PhpParser\PrettyPrinter\Standard;
3231
use PhpParser\Token;
33-
use PHPStan\Node\AnonymousClassNode;
3432
use PHPStan\Node\Expr\AlwaysRememberedExpr;
3533
use Rector\Configuration\Option;
3634
use Rector\Configuration\Parameter\SimpleParameterProvider;
@@ -39,7 +37,6 @@
3937
use Rector\PhpParser\Node\CustomNode\FileWithoutNamespace;
4038
use Rector\Util\NewLineSplitter;
4139
use Rector\Util\Reflection\PrivatesAccessor;
42-
use Rector\Util\StringUtils;
4340

4441
/**
4542
* @see \Rector\Tests\PhpParser\Printer\BetterStandardPrinterTest
@@ -55,12 +52,6 @@ final class BetterStandardPrinter extends Standard
5552
*/
5653
private const EXTRA_SPACE_BEFORE_NOP_REGEX = '#^[ \t]+$#m';
5754

58-
/**
59-
* @see https://regex101.com/r/UluSYL/1
60-
* @var string
61-
*/
62-
private const SPACED_NEW_START_REGEX = '#^new\s+#';
63-
6455
public function __construct(
6556
private readonly ExprAnalyzer $exprAnalyzer,
6657
private readonly PrivatesAccessor $privatesAccessor,
@@ -159,14 +150,6 @@ protected function p(
159150

160151
$content = parent::p($node, $precedence, $lhsPrecedence, $parentFormatPreserved);
161152

162-
/** @todo remove once fix https://github.com/nikic/PHP-Parser/commit/232169fd7972e018e3d7adbcaa235a2eaa2440c4 is released */
163-
if ($node instanceof New_ && $node->class instanceof AnonymousClassNode && ! StringUtils::isMatch(
164-
$content,
165-
self::SPACED_NEW_START_REGEX
166-
)) {
167-
$content = 'new ' . $content;
168-
}
169-
170153
if ($node instanceof CallLike) {
171154
$this->cleanVariadicPlaceHolderTrailingComma($node);
172155
}

0 commit comments

Comments
 (0)