iBet uBet web content aggregator. Adding the entire web to your favor.
iBet uBet web content aggregator. Adding the entire web to your favor.



Link to original content: https://github.com/symfony/symfony/pull/44110
[FrameworkBundle] Fix default PHP attributes support in validation and serializer configuration when doctrine/annotations is not installed with PHP 8 by fancyweb · Pull Request #44110 · symfony/symfony · GitHub
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

[FrameworkBundle] Fix default PHP attributes support in validation and serializer configuration when doctrine/annotations is not installed with PHP 8 #44110

Merged
merged 1 commit into from
Nov 18, 2021

Conversation

fancyweb
Copy link
Contributor

Q A
Branch? 5.3
Bug fix? yes
New feature? no
Deprecations? no
Tickets -
License MIT
Doc PR -

Afrer upgrading to PHP 8 and using real PHP attributes, I noticed there were no validation metadata for my classes anymore.

Before:

  • Full default FWB validator config
  • PHP 7.4
  • Constraints in my code are declared as PHPDoc annotation (the old way)
  • doctrine/annotations is required in composer.json

After:

  • Full default FWB validator config
  • PHP 8.0
  • Constraints in my code are declared as real PHP attributes
  • doctrine/annotations has been removed from composer.json because I don't need it anymore

I expect the migration to be transparent, ie not having to do any change in the config to switch from PHPDoc annotations to real PHP attributes. However, validation.enable_annotations does not default to true anymore after the migration so here is the fix. WDYT?

…d serializer configuration when doctrine/annotations is not installed with PHP 8
@@ -942,8 +942,8 @@ private function addValidationSection(ArrayNodeDefinition $rootNode, callable $e

private function addAnnotationsSection(ArrayNodeDefinition $rootNode, callable $willBeAvailable)
{
$doctrineCache = $willBeAvailable('doctrine/cache', Cache::class, 'doctrine/annotation');
$psr6Cache = $willBeAvailable('symfony/cache', PsrCachedReader::class, 'doctrine/annotation');
$doctrineCache = $willBeAvailable('doctrine/cache', Cache::class, 'doctrine/annotations');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is totally unrelated but that's surely a mistake?

Copy link
Member

@stof stof Nov 18, 2021

Choose a reason for hiding this comment

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

that's part of fixing the code, as doctrine/annotations is the right package name

@fabpot
Copy link
Member

fabpot commented Nov 18, 2021

Thank you @fancyweb.

@fabpot fabpot merged commit a09c139 into symfony:5.3 Nov 18, 2021
@fancyweb fancyweb deleted the fwb/fix-annot-default-support-php8 branch November 18, 2021 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants