ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
RemoveRequiresAndIncludesRector.php
Go to the documentation of this file.
1 <?php
2 
19 namespace ILIAS\CI\Rector;
20 
21 use PhpParser\Node;
26 
27 final class RemoveRequiresAndIncludesRector extends AbstractRector
28 {
29  public function getNodeTypes(): array
30  {
31  return [\PhpParser\Node\Expr\Include_::class];
32  }
33 
37  public function refactor(Node $node): ?Node
38  {
39  if (!$this->isObjectType($node, new ObjectType(Node\Expr\Assign::class))) {
40  $this->nodeRemover->removeNode($node);
41  }
42 
43  return $node;
44  }
45 
46  public function getRuleDefinition(): RuleDefinition
47  {
48  return new RuleDefinition(
49  'Remove requires and includes',
50  [
51  new CodeSample(
52  // code before
53  'require_once "./..."',
54  // code after
55  ''
56  ),
57  ]
58  );
59  }
60 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...