Skip to content

Commit

Permalink
fixup! fixup! fixup! Add test case for #3222
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed May 4, 2020
1 parent 330c14d commit 1950ded
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 14 deletions.
1 change: 0 additions & 1 deletion .github/inactive_workflows/update_documentation.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
name: Update Documentation


on:
push:
branches:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ public function createFromNode(Node $node): ?PhpDocInfo
if ($node->getComments() !== []) {
return null;
}
//
// create empty node
$content = '';
$tokens = [];
Expand All @@ -99,7 +98,6 @@ public function createFromNode(Node $node): ?PhpDocInfo
}

return $this->createFromPhpDocNode($phpDocNode, $content, $tokens, $node);

}

public function createEmpty(Node $node): PhpDocInfo
Expand Down Expand Up @@ -143,8 +141,12 @@ private function setPositionOfLastToken(AttributeAwarePhpDocNode $attributeAware
}
}

private function createFromPhpDocNode(AttributeAwarePhpDocNode $phpDocNode, string $content, array $tokens, Node $node): PhpDocInfo
{
private function createFromPhpDocNode(
AttributeAwarePhpDocNode $phpDocNode,
string $content,
array $tokens,
Node $node
): PhpDocInfo {
/** @var AttributeAwarePhpDocNode $phpDocNode */
$phpDocNode = $this->attributeAwareNodeFactory->createFromNode($phpDocNode, $content);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public function updateNodeWithPhpDocInfo(Node $node): void
if ($phpDoc === '') {
if ($phpDocInfo->getOriginalPhpDocNode()->children !== []) {
// all comments were removed → null
// $node->setAttribute('comments', null);
$node->setAttribute('comments', null);
}

return;
Expand Down
1 change: 0 additions & 1 deletion rules/dead-code/src/Rector/Stmt/RemoveDeadStmtRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use PhpParser\Node\Stmt\Expression;
use PhpParser\Node\Stmt\Nop;
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
use Rector\Core\Rector\AbstractRector;
use Rector\Core\RectorDefinition\CodeSample;
use Rector\Core\RectorDefinition\RectorDefinition;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
use PHPStan\Type\ArrayType;
use PHPStan\Type\MixedType;
use PHPStan\Type\StringType;
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
use Rector\BetterPhpDocParser\PhpDocNode\Gedmo\SlugTagValueNode;
use Rector\Core\PhpParser\Node\Manipulator\ClassInsertManipulator;
use Rector\Core\Rector\AbstractRector;
Expand All @@ -33,9 +32,8 @@ final class SluggableBehaviorRector extends AbstractRector
*/
private $classInsertManipulator;

public function __construct(
ClassInsertManipulator $classInsertManipulator
) {
public function __construct(ClassInsertManipulator $classInsertManipulator)
{
$this->classInsertManipulator = $classInsertManipulator;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use PhpParser\Node\Stmt\Class_;
use PhpParser\Node\Stmt\Namespace_;
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
use Rector\BetterPhpDocParser\PhpDocNode\Doctrine\Class_\EntityTagValueNode;
use Rector\BetterPhpDocParser\PhpDocNode\Gedmo\LocaleTagValueNode;
use Rector\BetterPhpDocParser\PhpDocNode\Gedmo\TranslatableTagValueNode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
use PhpParser\Node\Expr\Variable;
use PhpParser\Node\Stmt\Expression;
use PhpParser\Node\Stmt\Nop;
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
use Rector\Core\Rector\AbstractRector;
use Rector\Core\RectorDefinition\CodeSample;
use Rector\Core\RectorDefinition\RectorDefinition;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ private function replaceTemplateAnnotation(ClassMethod $classMethod): ?Node
private function classHasTemplateAnnotations(Class_ $node): bool
{
foreach ($node->getMethods() as $classMethod) {
/** @var PhpDocInfo|null $phpDocInfo */
$phpDocInfo = $classMethod->getAttribute(AttributeKey::PHP_DOC_INFO);
if ($phpDocInfo === null) {
continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ use Nette\Utils\Strings;
class ReplaceInArgs
{
// this prevents miss matching like "aMethoda"
/**
* @var string[]
*/
private const POSSIBLE_DELIMITERS = ['#', '~', '/'];
public function isRegexPattern(string $name): bool
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
use PhpParser\Node\Stmt\Return_;
use PHPStan\Type\ArrayType;
use PHPStan\Type\MixedType;
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
use Rector\Core\Rector\AbstractRector;
use Rector\Core\RectorDefinition\CodeSample;
use Rector\Core\RectorDefinition\RectorDefinition;
Expand Down

0 comments on commit 1950ded

Please sign in to comment.