Skip to content

Comments

Prepared configuration for Ibexa Annotation to Attribute Constraints#45

Open
alongosz wants to merge 5 commits intomainfrom
configure-ibexa-constraints-for-annotation-to-attribute
Open

Prepared configuration for Ibexa Annotation to Attribute Constraints#45
alongosz wants to merge 5 commits intomainfrom
configure-ibexa-constraints-for-annotation-to-attribute

Conversation

@alongosz
Copy link
Member

@alongosz alongosz commented Jan 14, 2026

🎫 Issue n/a

Related PRs:

Description:

This is a follow up to a merge-up issue where I forgot to refactor Symfony <=5 constraint annotations to Symfony 7 constraint attributes.

The main drawback of the existing rector is that it's an allow-list-based, meaning each specific constraint needs to be configured manually. So this will not protect us from a case where a new custom constraint annotation is added in 4.6, if we forgot to add it to the list here. We should rather consider writing our own rector that would:

  1. check if a given annotation is an class
  2. check if that class is an attribute with proper context target ideally
  3. refactor it in a generic way

For now, the proposed changes protect from regressions when using existing Ibexa constraints. I've extracted that list to an IbexaSymfonyConstraintList enum.

alongosz and others added 2 commits January 14, 2026 16:04
Co-authored-by: Konrad Oboza <konrad.oboza@ibexa.co>
Co-authored-by: Konrad Oboza <konrad.oboza@ibexa.co>
);
$rectorConfig->ruleWithConfiguration(
AnnotationToAttributeRector::class,
iterator_to_array((new AnnotationToAttributeConfigurationBuilder())->build())
Copy link
Contributor

Choose a reason for hiding this comment

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

Well, that kinda sucks.

How about we enable other attributes though? From Symfony Validator, routing, etc.?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants