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
@@ -0,0 +1,46 @@
<?php

namespace Rector\PHPUnit\Tests\AnnotationsToAttributes\Rector\ClassMethod\DataProviderAnnotationToAttributeRector\Fixture;

class WithCommentAbove extends \PHPUnit\Framework\TestCase
{
/**
* This is a useless test to demonstrate a problem.
*
* @dataProvider dataProvider
*/
public function testProvider(bool $expected): void
{
self::assertSame($expected, $expected);
}

public static function dataProvider(): iterable
{
yield [true];
}
}

?>
-----
<?php

namespace Rector\PHPUnit\Tests\AnnotationsToAttributes\Rector\ClassMethod\DataProviderAnnotationToAttributeRector\Fixture;

class WithCommentAbove extends \PHPUnit\Framework\TestCase
{
/**
* This is a useless test to demonstrate a problem.
*/
#[\PHPUnit\Framework\Attributes\DataProvider('dataProvider')]
public function testProvider(bool $expected): void
{
self::assertSame($expected, $expected);
}

public static function dataProvider(): iterable
{
yield [true];
}
}

?>
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php

namespace Rector\PHPUnit\Tests\AnnotationsToAttributes\Rector\ClassMethod\DataProviderAnnotationToAttributeRector\Fixture;

class WithCommentBelow extends \PHPUnit\Framework\TestCase
{
/**
* @dataProvider dataProvider
*
* This is a useless test to demonstrate a problem.
*/
public function testProvider(bool $expected): void
{
self::assertSame($expected, $expected);
}

public static function dataProvider(): iterable
{
yield [true];
}
}

?>
-----
<?php

namespace Rector\PHPUnit\Tests\AnnotationsToAttributes\Rector\ClassMethod\DataProviderAnnotationToAttributeRector\Fixture;

class WithCommentBelow extends \PHPUnit\Framework\TestCase
{
#[\PHPUnit\Framework\Attributes\DataProvider('dataProvider')]
public function testProvider(bool $expected): void
{
self::assertSame($expected, $expected);
}

public static function dataProvider(): iterable
{
yield [true];
}
}

?>
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public function refactor(Node $node): ?Node

$originalAttributeValue = $desiredTagValueNode->value->value;

$node->attrGroups[] = $this->createAttributeGroup($originalAttributeValue);
$node->attrGroups[] = $this->createAttributeGroup(strtok($originalAttributeValue, " \t\n\r\0\x0B"));

// cleanup
$this->phpDocTagRemover->removeTagValueFromNode($phpDocInfo, $desiredTagValueNode);
Expand Down