Implement.php in Drupal 7 to 8/9 Module Upgrader 8
File
src/Plugin/DMU/Fixer/Implement.php
View source
<?php
namespace Drupal\drupalmoduleupgrader\Plugin\DMU\Fixer;
use Drupal\drupalmoduleupgrader\FixerBase;
use Pharborist\DocCommentNode;
use Pharborist\Objects\ClassMethodNode;
class Implement extends FixerBase {
public function execute() {
$class = $this->target
->getIndexer('class')
->get($this->configuration['target']);
list($interface, $method) = explode('::', $this->configuration['definition']);
$interface = new \ReflectionClass($interface);
$method = $interface
->getMethod($method);
$node = ClassMethodNode::create($method
->getName());
$node
->setDocComment(DocCommentNode::create('@inheritdoc'));
$class
->appendMethod($node);
$node
->matchReflector($method);
$this->target
->save($class);
}
}
Classes
Name |
Description |
Implement |
Plugin annotation
@Fixer(
id = "implement"
) |