Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indent docblocks in DocComment test #9156

Merged
merged 1 commit into from
Jan 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
146 changes: 80 additions & 66 deletions tests/DocCommentTest.php
Expand Up @@ -36,17 +36,19 @@ public function testNewLineIsAddedBetweenAnnotationsByDefault(): void
],
);

$expectedDoc = '/**
* some desc
*
* @param string $bli
* @param int $bla
*
* @throws \Exception
*
* @return bool
*/
';
$expectedDoc = <<<'PHP'
/**
* some desc
*
* @param string $bli
* @param int $bla
*
* @throws \Exception
*
* @return bool
*/

PHP;

$this->assertSame($expectedDoc, $docComment->render(''));
}
Expand Down Expand Up @@ -74,15 +76,17 @@ public function testNewLineIsNotAddedBetweenAnnotationsIfDisabled(): void
],
);

$expectedDoc = '/**
* some desc
*
* @param string $bli
* @param int $bla
* @throws \Exception
* @return bool
*/
';
$expectedDoc = <<<'PHP'
/**
* some desc
*
* @param string $bli
* @param int $bla
* @throws \Exception
* @return bool
*/

PHP;

$this->assertSame($expectedDoc, $docComment->render(''));
}
Expand Down Expand Up @@ -110,17 +114,19 @@ public function testNewLineIsAddedBetweenAnnotationsIfEnabled(): void
],
);

$expectedDoc = '/**
* some desc
*
* @param string $bli
* @param int $bla
*
* @throws \Exception
*
* @return bool
*/
';
$expectedDoc = <<<'PHP'
/**
* some desc
*
* @param string $bli
* @param int $bla
*
* @throws \Exception
*
* @return bool
*/

PHP;

$this->assertSame($expectedDoc, $docComment->render(''));
}
Expand All @@ -129,17 +135,19 @@ public function testParsingRoundtrip(): void
{
ParsedDocblock::addNewLineBetweenAnnotations(true);

$expectedDoc = '/**
* some desc
*
* @param string $bli
* @param int $bla
*
* @throws \Exception
*
* @return bool
*/
';
$expectedDoc = <<<'PHP'
/**
* some desc
*
* @param string $bli
* @param int $bla
*
* @throws \Exception
*
* @return bool
*/

PHP;
$docComment = DocComment::parsePreservingLength(
new Doc($expectedDoc),
);
Expand All @@ -151,17 +159,21 @@ public function testParsingWithIndentation(): void
{
ParsedDocblock::addNewLineBetweenAnnotations(true);

$expectedDoc = '/**
* some desc
*
* @param string $bli
* @param int $bla
*
* @throws \Exception
*
* @return bool
*/
';
$expectedDoc = <<<'PHP'
/**
* some desc
*
* @param string $bli
* @param int $bla
*
* @throws \Exception
*
* @return bool
*/

PHP
. " ";

$docComment = DocComment::parsePreservingLength(
new Doc($expectedDoc),
);
Expand All @@ -173,19 +185,21 @@ public function testParsingWithCommonPrefixes(): void
{
ParsedDocblock::addNewLineBetweenAnnotations(true);

$expectedDoc = '/**
* some self-referential desc with " * @return bool
* " as part of it.
*
* @param string $bli
* @param string $bli_this_suffix_is_kept
* @param int $bla
*
* @throws \Exception
*
* @return bool
*/
';
$expectedDoc = <<<'PHP'
/**
* some self-referential desc with " * @return bool
* " as part of it.
*
* @param string $bli
* @param string $bli_this_suffix_is_kept
* @param int $bla
*
* @throws \Exception
*
* @return bool
*/

PHP;
$docComment = DocComment::parsePreservingLength(
new Doc($expectedDoc),
);
Expand Down