Hoa central
Author.php
Go to the documentation of this file.
1 <?php
2 
38 
39 use SplFileInfo;
44 
53 class Author extends AbstractFixer
54 {
55  public function fix(SplFileInfo $file, $content)
56  {
57  $tokens = Tokens::fromCode($content);
58 
59  foreach ($tokens->findGivenKind(T_DOC_COMMENT) as $token) {
60  $docBlock = new DocBlock($token->getContent());
61  $annotations = $docBlock->getAnnotationsOfType('author');
62 
63  if (empty($annotations)) {
64  continue;
65  }
66 
67  foreach ($annotations as $annotation) {
68  $annotation->remove();
69  }
70 
71  $token->setContent($docBlock->getContent());
72  }
73 
74  return $tokens->generateCode();
75  }
76 
77  public function getDescription()
78  {
79  return 'Remove `@author`.';
80  }
81 
82  public function getName()
83  {
84  return 'author';
85  }
86 
87  public function getLevel()
88  {
89  return FixerInterface::CONTRIB_LEVEL;
90  }
91 }
fix(SplFileInfo $file, $content)
Definition: Author.php:55
$content
Definition: Hoa.php:119