mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-01 00:40:52 +00:00
fix cs
This commit is contained in:
parent
604d4cb521
commit
4d931010d0
|
@ -11,7 +11,7 @@ use Rector\Contract\Rector\RectorInterface;
|
||||||
abstract class AbstractRector extends NodeVisitorAbstract implements DeprecationInterface, RectorInterface
|
abstract class AbstractRector extends NodeVisitorAbstract implements DeprecationInterface, RectorInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @return int|null|Node
|
* @return null|int|Node
|
||||||
*/
|
*/
|
||||||
public function enterNode(Node $node)
|
public function enterNode(Node $node)
|
||||||
{
|
{
|
||||||
|
|
|
@ -33,7 +33,7 @@ final class FormCallbackRector extends NodeVisitorAbstract implements Deprecatio
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return int|null|Node
|
* @return null|int|Node
|
||||||
*/
|
*/
|
||||||
public function enterNode(Node $node)
|
public function enterNode(Node $node)
|
||||||
{
|
{
|
||||||
|
@ -42,16 +42,7 @@ final class FormCallbackRector extends NodeVisitorAbstract implements Deprecatio
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Array_([
|
return $this->createShortArray($node);
|
||||||
new ArrayItem($node->var),
|
|
||||||
new ArrayItem(
|
|
||||||
new String_(
|
|
||||||
(string) $node->name
|
|
||||||
)
|
|
||||||
)
|
|
||||||
], [
|
|
||||||
'kind' => Array_::KIND_SHORT
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->previousNode = $node;
|
$this->previousNode = $node;
|
||||||
|
@ -80,4 +71,18 @@ final class FormCallbackRector extends NodeVisitorAbstract implements Deprecatio
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function createShortArray(Node $node): Array_
|
||||||
|
{
|
||||||
|
return new Array_([
|
||||||
|
new ArrayItem($node->var),
|
||||||
|
new ArrayItem(
|
||||||
|
new String_(
|
||||||
|
(string) $node->name
|
||||||
|
)
|
||||||
|
)
|
||||||
|
], [
|
||||||
|
'kind' => Array_::KIND_SHORT
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,9 @@ namespace Rector\Rector\Contrib\Nette;
|
||||||
|
|
||||||
use PhpParser\Node;
|
use PhpParser\Node;
|
||||||
use PhpParser\Node\Expr\ClassConstFetch;
|
use PhpParser\Node\Expr\ClassConstFetch;
|
||||||
|
use PhpParser\Node\Scalar\String_;
|
||||||
use Rector\Deprecation\SetNames;
|
use Rector\Deprecation\SetNames;
|
||||||
use Rector\Rector\AbstractRector;
|
use Rector\Rector\AbstractRector;
|
||||||
use PhpParser\Node\Scalar\String_;
|
|
||||||
|
|
||||||
final class RemoveConfiguratorConstantsRector extends AbstractRector
|
final class RemoveConfiguratorConstantsRector extends AbstractRector
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,7 +5,6 @@ namespace Rector\Testing\Application;
|
||||||
use PhpParser\Lexer;
|
use PhpParser\Lexer;
|
||||||
use PhpParser\NodeTraverser;
|
use PhpParser\NodeTraverser;
|
||||||
use PhpParser\Parser;
|
use PhpParser\Parser;
|
||||||
use Rector\NodeTraverser\StateHolder;
|
|
||||||
use Rector\Printer\FormatPerservingPrinter;
|
use Rector\Printer\FormatPerservingPrinter;
|
||||||
use SplFileInfo;
|
use SplFileInfo;
|
||||||
|
|
||||||
|
@ -31,23 +30,16 @@ final class FileReconstructor
|
||||||
*/
|
*/
|
||||||
private $nodeTraverser;
|
private $nodeTraverser;
|
||||||
|
|
||||||
/**
|
|
||||||
* @var StateHolder
|
|
||||||
*/
|
|
||||||
private $stateHolder;
|
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
Parser $parser,
|
Parser $parser,
|
||||||
FormatPerservingPrinter $codeStyledPrinter,
|
FormatPerservingPrinter $codeStyledPrinter,
|
||||||
Lexer $lexer,
|
Lexer $lexer,
|
||||||
NodeTraverser $nodeTraverser,
|
NodeTraverser $nodeTraverser
|
||||||
StateHolder $stateHolder
|
|
||||||
) {
|
) {
|
||||||
$this->parser = $parser;
|
$this->parser = $parser;
|
||||||
$this->codeStyledPrinter = $codeStyledPrinter;
|
$this->codeStyledPrinter = $codeStyledPrinter;
|
||||||
$this->lexer = $lexer;
|
$this->lexer = $lexer;
|
||||||
$this->nodeTraverser = $nodeTraverser;
|
$this->nodeTraverser = $nodeTraverser;
|
||||||
$this->stateHolder = $stateHolder;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ref: https://github.com/nikic/PHP-Parser/issues/344#issuecomment-298162516
|
// ref: https://github.com/nikic/PHP-Parser/issues/344#issuecomment-298162516
|
||||||
|
|
|
@ -12,7 +12,7 @@ final class Test extends AbstractReconstructorTestCase
|
||||||
__DIR__ . '/wrong/wrong.php.inc',
|
__DIR__ . '/wrong/wrong.php.inc',
|
||||||
__DIR__ . '/correct/correct.php.inc'
|
__DIR__ . '/correct/correct.php.inc'
|
||||||
);
|
);
|
||||||
// $this->doTestFileMatchesExpectedContent(
|
// $this->doTestFileMatchesExpectedContent(
|
||||||
// __DIR__ . '/wrong/wrong2.php.inc',
|
// __DIR__ . '/wrong/wrong2.php.inc',
|
||||||
// __DIR__ . '/correct/correct2.php.inc'
|
// __DIR__ . '/correct/correct2.php.inc'
|
||||||
// );
|
// );
|
||||||
|
|
Loading…
Reference in New Issue
Block a user