26 use Rector\NodeTypeResolver\Node\AttributeKey as AttributeKeys;
33 * This file is part of ILIAS, a powerful learning management system 34 * published by ILIAS open source e-Learning e.V. 36 * ILIAS is licensed with the GPL-3.0, 37 * see https://www.gnu.org/licenses/gpl-3.0.en.html 38 * You should have received a copy of said license along with the 41 * If this is not the case or you just want to try ILIAS, you'll find 43 * https://www.ilias.de 44 * https://github.com/ILIAS-eLearning 46 *********************************************************************/ 52 Node\Expr\Empty_::class,
53 Node\Stmt\Global_::class,
54 Node\Expr\Include_::class,
55 Node\Stmt\Use_::class,
56 Node\Stmt\Namespace_::class,
58 Node\Stmt\Class_::class,
59 Node\Stmt\Expression::class,
60 Node\Stmt\Declare_::class,
65 $this->standard_comment =
new Comment($this->license_header_default);
74 Node\Stmt\Class_::class,
75 Node\Stmt\Interface_::class,
76 Node\Stmt\Trait_::class
85 if (preg_match(self::IGNORE_SUBPATHS, $this->file->getFilePath()) > 0) {
90 $previous = $node->getAttribute(AttributeKeys::PREVIOUS_NODE);
91 while (is_object($previous) && in_array($previous::class, $this->previous_search)) {
92 if ($previous instanceof \PhpParser\Node\Name) {
93 $previous = $previous->getAttribute(AttributeKeys::PARENT_NODE);
95 if ($previous instanceof Node\Expr\Empty_) {
96 $this->removeNode($previous);
99 $current->setAttribute(
100 AttributeKeys::COMMENTS,
103 $previous = $current->getAttribute(AttributeKeys::PREVIOUS_NODE);
106 $current->setAttribute(AttributeKeys::COMMENTS, $this->
filterComments($current, [$this->standard_comment]));
116 foreach ($node->getComments() as
$comment) {
117 if (preg_match(self::EXISTING_LICENSE_PATTERN,
$comment->getText()) > 0) {
127 return new RuleDefinition(
128 'Adds or replaces a license-header in each class-file',
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...