5 * Contains \Drupal\drupalmoduleupgrader\Plugin\DMU\Fixer\FormCallbackToMethod.
8 namespace Drupal\drupalmoduleupgrader\Plugin\DMU\Fixer;
10 use Drupal\drupalmoduleupgrader\FixerBase;
14 * id = "form_callback_to_method"
17 class FormCallbackToMethod extends FixerBase {
19 public function execute() {
20 /** @var \Pharborist\Functions\FunctionDeclarationNode $callback */
23 ->getIndexer('function')
24 ->get($this->configuration['callback']);
26 list ($class, $method_name) = explode('::', $this->configuration['destination']);
27 /** @var \Pharborist\Objects\ClassNode $class */
33 $method = $callback->cloneAsMethodOf($class)->setName($method_name);
35 $form_interface = new \ReflectionClass('\Drupal\Core\Form\FormInterface');
36 if ($form_interface->hasMethod($method_name)) {
37 $method->matchReflector($form_interface->getMethod($method_name));
40 $this->target->save($method);