1919use PhpParser \Node \Expr \Instanceof_ ;
2020use PhpParser \Node \Expr \Match_ ;
2121use PhpParser \Node \Expr \MethodCall ;
22- use PhpParser \Node \Expr \New_ ;
2322use PhpParser \Node \Expr \Ternary ;
2423use PhpParser \Node \Expr \Yield_ ;
2524use PhpParser \Node \InterpolatedStringPart ;
3029use PhpParser \Node \Stmt \Nop ;
3130use PhpParser \PrettyPrinter \Standard ;
3231use PhpParser \Token ;
33- use PHPStan \Node \AnonymousClassNode ;
3432use PHPStan \Node \Expr \AlwaysRememberedExpr ;
3533use Rector \Configuration \Option ;
3634use Rector \Configuration \Parameter \SimpleParameterProvider ;
3937use Rector \PhpParser \Node \CustomNode \FileWithoutNamespace ;
4038use Rector \Util \NewLineSplitter ;
4139use 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