Skip to content

Commit

Permalink
Bump symfony/finder ^6.0 (#107)
Browse files Browse the repository at this point in the history
  • Loading branch information
zingimmick authored Dec 2, 2021
1 parent e5e6f87 commit bd350e0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"require-dev": {
"phpunit/phpunit": "^7.0 || ^8.0 || ^9.0",
"roave/security-advisories": "dev-master",
"symfony/finder": "^4.4 || ^5.0"
"symfony/finder": "^4.4 || ^5.0 || ^6.0"
},
"autoload": {
"psr-4": {
Expand Down
11 changes: 5 additions & 6 deletions src/Printer.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Zing\CodingStandard;

use Nette\Utils\Strings;
use PhpParser\Node\Expr\ArrayItem;
use PhpParser\Node\Expr\Closure;
use PhpParser\Node\Expr\MethodCall;
Expand All @@ -16,7 +15,7 @@ final class Printer extends Standard
{
protected function pStmt_Declare(Declare_ $node): string
{
return Strings::replace(parent::pStmt_Declare($node), '#\\s+#', '');
return preg_replace('#\\s+#', '', parent::pStmt_Declare($node));
}

protected function hasNodeWithComments(array $nodes): bool
Expand Down Expand Up @@ -46,15 +45,15 @@ protected function hasNodeWithComments(array $nodes): bool

protected function pExpr_MethodCall(MethodCall $node): string
{
$nextCallIndentReplacement = ')' . PHP_EOL . Strings::indent('->', 8, ' ');
$nextCallIndentReplacement = ')' . PHP_EOL . preg_replace('#(?:^|[\\r\\n]+)(?=[^\\r\\n])#', '$0' . \str_repeat(' ', 8), '->');
$content = parent::pExpr_MethodCall($node);
$content = Strings::replace($content, '#\\n#', PHP_EOL . str_repeat(' ', 4));
$content = preg_replace('#\\n#', PHP_EOL . str_repeat(' ', 4), $content);

return Strings::replace($content, '#\)->#', $nextCallIndentReplacement);
return preg_replace('#\)->#', $nextCallIndentReplacement, $content);
}

protected function pExpr_Closure(Closure $node): string
{
return Strings::replace(parent::pExpr_Closure($node), '#\) : void#', '): void');
return preg_replace('#\) : void#', '): void', parent::pExpr_Closure($node));
}
}

0 comments on commit bd350e0

Please sign in to comment.