Skip to content

Commit

Permalink
This parameter is not necessary. phpdoc.
Browse files Browse the repository at this point in the history
  • Loading branch information
yunosh committed Mar 3, 2017
1 parent de3d8f3 commit ffb54d5
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions framework/Refactor/lib/Horde/Refactor/Rule/FileLevelDocBlock.php
Expand Up @@ -72,6 +72,8 @@ public function __construct($file, Config\Base $config)
public function run()
{
$this->_tokens->rewind();

// Check if we have DocBlocks at all.
if (!$this->_tokens->find(
T_DOC_COMMENT,
null,
Expand All @@ -82,7 +84,6 @@ public function run()
}

$firstPos = $this->_tokens->key();
$first = $this->_tokens->current();
$this->_tokens->skipWhitespace();
while ($this->_tokens->matches(T_NAMESPACE) ||
$this->_tokens->matches(T_USE) ||
Expand All @@ -93,12 +94,15 @@ public function run()
$this->_tokens->find(';');
$this->_tokens->skipWhitespace();
}

// We have two DocBlocks, check for correctness.
if ($this->_tokens->matches(T_DOC_COMMENT)) {
$this->_checkDocBlocks($first, $this->_tokens->current());
return;
}

$this->_createFileLevelBlock($first, $firstPos);
// The file-level DocBlock is missing, create one.
$this->_createFileLevelBlock($firstPos);
}

/**
Expand Down Expand Up @@ -141,12 +145,12 @@ protected function _addEmptyBlocks()
/**
* Creates a file-level DocBlock based on the first existing DocBlock.
*
* @param array $first The token of the first existing DocBlock.
* @param integer $pos The position of the first existing DocBlock.
*/
protected function _createFileLevelBlock($first, $pos)
protected function _createFileLevelBlock($pos)
{
$classDocBlock = new DocBlock($first[1]);
$this->_tokens->seek($pos);
$classDocBlock = new DocBlock($this->current()[1]);
if ($license = $classDocBlock->getTagsByName('license')) {
$license = explode(' ', $license[0]->getContent(), 2);
if (count($license) == 2) {
Expand All @@ -163,7 +167,6 @@ protected function _createFileLevelBlock($first, $pos)
}
$fileDocBlock = $this->_getFileLevelDocBlock($tags);
$serializer = new Serializer();
$this->_tokens->seek($pos);
$this->_tokens = $this->_tokens->insert(array(
$serializer->getDocComment($fileDocBlock),
"\n\n"
Expand Down

0 comments on commit ffb54d5

Please sign in to comment.