-
-
Notifications
You must be signed in to change notification settings - Fork 738
Closed
Description
Question
I have been playing with this nice library: good job by the way 👏
Trying to create my own custom rule that adds a namespace to a class if non is set.. But I couldn't figure it out sofar...
The file I have:
<?php
class MyClass extends SecureControllerAction {
...
}The results I expect:
<?php
namespace App\Controller;
class MyClass extends SecureControllerAction {
...
}My current rule
/**
* @return string[]
*/
public function getNodeTypes(): array
{
return [
Name::class,
Class_::class,
Namespace_::class,
];
}
/**
* @param Class_ $node
*/
public function refactor(Node $node): ?Node
{
// Here I'am stuck as the file itself doesn't have a namespace node!
}Any help would be appreciated 🙏
Metadata
Metadata
Assignees
Labels
No labels