-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
rectorphp/rector
#7Description
With format-perserving printer [#344] I came across weird bug.
I have 2 visitor modifying the code:
This is error output from Travis Report:
- I make property private - doesn't work 👎
- I add argument to constructor - works 👍
- I add assignment in constuctor method - 👎
declare (strict_types=1);\nis added instead of it
- private $property;\n
+ public $property;\n
/**\n
* @var DateTimeInterface\n
*/\n
- private $otherProperty;\n
+ public $otherProperty;\n
public function __construct(stdClass $property, DateTimeInterface $otherProperty)\n
{\n
- $this->property = $property;\n
- $this->otherProperty = $otherProperty;\n
+ declare (strict_types=1);\n
+ declare (strict_types=1);\n
}\n
}\nreturn $this->codeStyledPrinter->printToString($newStmts, $oldStmts, $oldTokens);This would be understandable from some point, but...
But when I switch first 2 arguments, this NodeVisitor works but the other doesn't.
return $this->codeStyledPrinter->printToString($oldStmts, $newStmts, $oldTokens);In this case, afterTraverse() isn't taken into account.
class ClassWithNamedService extends Controller\n
{\n
- /**\n
- * @var stdClass\n
- */\n
- private $stdClass;\n
- public function __construct(stdClass $stdClass)\n
- {\n
- $this->stdClass = $stdClass;\n
- }\n
public function render()\n
{\n
$this->stdClass->render();\n
}\n
}\nReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels