Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"doctrine/inflector": "^2.1",
"illuminate/container": "12.39.*",
"nette/utils": "^4.1",
"nikic/php-parser": "^5.6.2",
"nikic/php-parser": "^5.7",
"ondram/ci-detector": "^4.2",
"phpstan/phpdoc-parser": "^2.3",
"phpstan/phpstan": "^2.1.33",
Expand Down
17 changes: 0 additions & 17 deletions src/PhpParser/Printer/BetterStandardPrinter.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
use PhpParser\Node\Expr\Instanceof_;
use PhpParser\Node\Expr\Match_;
use PhpParser\Node\Expr\MethodCall;
use PhpParser\Node\Expr\New_;
use PhpParser\Node\Expr\Ternary;
use PhpParser\Node\Expr\Yield_;
use PhpParser\Node\InterpolatedStringPart;
Expand All @@ -30,7 +29,6 @@
use PhpParser\Node\Stmt\Nop;
use PhpParser\PrettyPrinter\Standard;
use PhpParser\Token;
use PHPStan\Node\AnonymousClassNode;
use PHPStan\Node\Expr\AlwaysRememberedExpr;
use Rector\Configuration\Option;
use Rector\Configuration\Parameter\SimpleParameterProvider;
Expand All @@ -39,7 +37,6 @@
use Rector\PhpParser\Node\CustomNode\FileWithoutNamespace;
use Rector\Util\NewLineSplitter;
use Rector\Util\Reflection\PrivatesAccessor;
use Rector\Util\StringUtils;

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

/**
* @see https://regex101.com/r/UluSYL/1
* @var string
*/
private const SPACED_NEW_START_REGEX = '#^new\s+#';

public function __construct(
private readonly ExprAnalyzer $exprAnalyzer,
private readonly PrivatesAccessor $privatesAccessor,
Expand Down Expand Up @@ -159,14 +150,6 @@ protected function p(

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

/** @todo remove once fix https://github.com/nikic/PHP-Parser/commit/232169fd7972e018e3d7adbcaa235a2eaa2440c4 is released */
if ($node instanceof New_ && $node->class instanceof AnonymousClassNode && ! StringUtils::isMatch(
$content,
self::SPACED_NEW_START_REGEX
)) {
$content = 'new ' . $content;
}

if ($node instanceof CallLike) {
$this->cleanVariadicPlaceHolderTrailingComma($node);
}
Expand Down