Skip to content

[Serializer] Skip test if symfony/property-info doesn't support phpstan/phpdoc-parser:2.0 yet #58997

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

Closed
Closed
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 @@ -11,6 +11,7 @@

namespace Symfony\Component\Serializer\Tests\Normalizer;

use Composer\InstalledVersions;
use Doctrine\Common\Annotations\AnnotationReader;
use PHPStan\PhpDocParser\Parser\PhpDocParser;
use PHPUnit\Framework\TestCase;
Expand Down Expand Up @@ -753,6 +754,15 @@ public function testDoesntHaveIssuesWithUnionConstTypes()
$this->markTestSkipped('phpstan/phpdoc-parser required for this test');
}

$versionRange = InstalledVersions::getVersionRanges('symfony/property-info');

if (
'5.4.x-dev' !== $versionRange && version_compare($versionRange, '5.4.47', '<')
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

version_compare() doesn't handle ".x-dev" versions well, thus the hard check

|| version_compare($versionRange, '6', '>=') && '6.4.x-dev' !== $versionRange && version_compare($versionRange, '6.4.15', '<')
) {
$this->markTestSkipped('PropertyInfo >= 5.4.47 or >= 6.4.15 is required for this test');
}

$extractor = new PropertyInfoExtractor([], [new PhpStanExtractor(), new PhpDocExtractor(), new ReflectionExtractor()]);
$normalizer = new ObjectNormalizer(null, null, null, $extractor);
$serializer = new Serializer([new ArrayDenormalizer(), new DateTimeNormalizer(), $normalizer]);
Expand Down