creating a compound custom rule that modifies multiple nodes at a time #9059
-
|
Say I had this piece of code: $rsa = new \phpseclib\Crypt\RSA;
$rsa->loadKey('...');What kind of custom rule - if any - could convert that to this?: $rsa = new \phpseclib3\Crypt\PublicKeyLoader::load('...');Like I could probably get the Any ideas? Or is what I'm trying to do just not possible with Rector? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
Hi, you can do this even with single node. Hook into Check core rules that work with |
Beta Was this translation helpful? Give feedback.
Hi, you can do this even with single node.
Hook into
StmtsAwareInterfaceand look for current + previous stmt that matches your 2 nodes.Then remove those nodes and replace with a single one, the assignment.
Check core rules that work with
StmtsAwareInterfaceto get better understanding, how to handle this 👍