mirror of
https://github.com/rectorphp/rector.git
synced 2025-02-24 03:35:01 +01:00
wontfix test case
This commit is contained in:
parent
d9ee3a4322
commit
58113c74f3
@ -115,9 +115,7 @@ final class PhpDocInfoPrinter
|
||||
$this->removedNodePositions = [];
|
||||
|
||||
$phpDocString = $this->printPhpDocNode($this->attributeAwarePhpDocNode);
|
||||
|
||||
// replace extra space after *
|
||||
$phpDocString = Strings::replace($phpDocString, '#([^*])\*[ \t]+$#sm', '$1*');
|
||||
$phpDocString = $this->removeExtraSpacesAfterAsterisk($phpDocString);
|
||||
|
||||
// hotfix of extra space with callable ()
|
||||
return Strings::replace($phpDocString, '#callable(\s+)\(#', 'callable(');
|
||||
@ -297,9 +295,8 @@ final class PhpDocInfoPrinter
|
||||
private function printAttributeWithAsterisk(AttributeAwareNodeInterface $attributeAwareNode): string
|
||||
{
|
||||
$content = (string) $attributeAwareNode;
|
||||
$content = explode(PHP_EOL, $content);
|
||||
|
||||
return implode(self::NEWLINE_ASTERISK, $content);
|
||||
return $this->explodeAndImplode($content, PHP_EOL, self::NEWLINE_ASTERISK);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -380,4 +377,20 @@ final class PhpDocInfoPrinter
|
||||
|
||||
return (bool) $attributeAwarePhpDocTagNode->value->description;
|
||||
}
|
||||
|
||||
private function explodeAndImplode(string $content, string $explodeChar, string $implodeChar): string
|
||||
{
|
||||
$content = explode($explodeChar, $content);
|
||||
|
||||
if (! is_array($content)) {
|
||||
throw new ShouldNotHappenException();
|
||||
}
|
||||
|
||||
return implode($implodeChar, $content);
|
||||
}
|
||||
|
||||
private function removeExtraSpacesAfterAsterisk(string $phpDocString): string
|
||||
{
|
||||
return Strings::replace($phpDocString, '#([^*])\*[ \t]+$#sm', '$1*');
|
||||
}
|
||||
}
|
||||
|
@ -21,8 +21,10 @@ final class SpacePatternFactory
|
||||
|
||||
// we have to match exact @param space, in case of multiple @param s
|
||||
if ($phpDocTagNode->value instanceof AttributeAwareParamTagValueNode) {
|
||||
$spacePattern = $this->createSpacePatternForParamTagValueNode($phpDocTagNode->value, $spacePattern);
|
||||
} elseif ($phpDocTagNode->value instanceof AttributeAwareGenericTagValueNode) {
|
||||
return $this->createSpacePatternForParamTagValueNode($phpDocTagNode->value, $spacePattern);
|
||||
}
|
||||
|
||||
if ($phpDocTagNode->value instanceof AttributeAwareGenericTagValueNode) {
|
||||
$originalValue = $phpDocTagNode->value->getAttribute('original_value') ?? $phpDocTagNode->value->value;
|
||||
|
||||
// break by line break, to prevent false content positive
|
||||
@ -56,6 +58,7 @@ final class SpacePatternFactory
|
||||
|
||||
$spacePattern .= preg_quote($attributeAwareParamTagValueNode->parameterName, '#');
|
||||
}
|
||||
return $spacePattern;
|
||||
|
||||
return '#' . $spacePattern . '#';
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,11 @@
|
||||
/**
|
||||
* ```
|
||||
* SomeClass::someMethod('default'
|
||||
* );
|
||||
* ```
|
||||
*
|
||||
* ```
|
||||
* SomeClass::someMethod(
|
||||
* );
|
||||
* ```
|
||||
*/
|
Loading…
x
Reference in New Issue
Block a user