Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ public function fix(SplFileInfo $fileInfo, Tokens $tokens): void

$docblockLines = explode("\n", $originalDocContent);
foreach ($docblockLines as $key => $docblockLine) {
// drop articles, so "Get the API helper" still duplicates getApiHelper()
$docblockLine = Regex::replace($docblockLine, '#\b(?:a|an|the)\b#i', '');

$spacelessDocblockLine = Regex::replace($docblockLine, '#[\s\n]+#', '');

// ignore trailing sentence punctuation, e.g. "Set name." duplicates setName()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

namespace Symplify\CodingStandard\Tests\Fixer\Annotation\RemoveMethodNameDuplicateDescriptionFixer\Fixture;

final class WithArticles
{
/**
* Get the API helper.
*
* @return object
*/
public function getApiHelper()
{
}
}

?>
-----
<?php

namespace Symplify\CodingStandard\Tests\Fixer\Annotation\RemoveMethodNameDuplicateDescriptionFixer\Fixture;

final class WithArticles
{
/**
*
* @return object
*/
public function getApiHelper()
{
}
}

?>
7 changes: 7 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
declare(strict_types=1);

use Rector\Config\RectorConfig;
use Rector\DeadCode\Rector\ClassMethod\RemoveReturnTagIncompatibleWithNativeTypeRector;
use Rector\DeadCode\Rector\ConstFetch\RemovePhpVersionIdCheckRector;
use Rector\Php84\Rector\Class_\DeprecatedAnnotationToDeprecatedAttributeRector;

Expand Down Expand Up @@ -30,6 +31,12 @@
// conditional checks
RemovePhpVersionIdCheckRector::class,

// rector <= 2.5.6 misreads the @phpstan-type GitlabIssue array-shape alias
// as incompatible with the native "array" return type and strips the tag
RemoveReturnTagIncompatibleWithNativeTypeRector::class => [
__DIR__ . '/src/Console/Output/GitlabOutputFormatter.php',
],

DeprecatedAnnotationToDeprecatedAttributeRector::class => [
// avoid runtime reporting in output, only for the user
__DIR__ . '/src/ValueObject/Option.php',
Expand Down
Loading