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 *********************************************************************/ 51 Node\Expr\Include_::class,
52 Node\Stmt\Use_::class,
53 Node\Stmt\Namespace_::class,
55 Node\Stmt\Class_::class,
56 Node\Stmt\Expression::class,
57 Node\Stmt\Declare_::class
62 $this->standard_comment =
new Comment($this->license_header_default);
71 Node\Stmt\Class_::class,
72 Node\Stmt\Interface_::class,
73 Node\Stmt\Trait_::class
82 if (preg_match(self::IGNORE_SUBPATHS, $this->file->getSmartFileInfo()->getPathname()) > 0) {
87 $previous = $node->getAttribute(AttributeKeys::PREVIOUS_NODE);
88 while (is_object($previous) && in_array(get_class($previous), $this->previous_search)) {
89 if ($previous instanceof \PhpParser\Node\Name) {
90 $previous = $previous->getAttribute(AttributeKeys::PARENT_NODE);
93 $current->setAttribute(
94 AttributeKeys::COMMENTS,
97 $previous = $current->getAttribute(AttributeKeys::PREVIOUS_NODE);
100 $current->setAttribute(AttributeKeys::COMMENTS, $this->
filterComments($current, [$this->standard_comment]));
111 foreach ($node->getComments() as
$comment) {
112 if (preg_match(self::EXISTING_LICENSE_PATTERN,
$comment->getText()) > 0) {
122 return new RuleDefinition(
123 '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...