-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Define DefinitionConfigurator generic type for AbstractBundle #61805
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Member
nicolas-grekas
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest going with this instead:
--- a/src/Symfony/Component/Config/Definition/Configurator/DefinitionConfigurator.php
+++ b/src/Symfony/Component/Config/Definition/Configurator/DefinitionConfigurator.php
@@ -17,7 +17,7 @@ use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\Loader\DefinitionFileLoader;
/**
- * @template T of 'array'|'variable'|'scalar'|'string'|'boolean'|'integer'|'float'|'enum'
+ * @template T of 'array'|'variable'|'scalar'|'string'|'boolean'|'integer'|'float'|'enum' = 'array'
*
* @author Yonel Ceruto <[email protected]>
GromNaN
approved these changes
Sep 22, 2025
2730e64 to
0aaf5ca
Compare
0aaf5ca to
d067cb3
Compare
Member
|
Thank you @alexander-schranz. |
nicolas-grekas
added a commit
that referenced
this pull request
Dec 5, 2025
…ander-schranz) This PR was squashed before being merged into the 7.4 branch. Discussion ---------- [Config] Define `TreeBuilder` default generic type | Q | A | ------------- | --- | Branch? | 7.4 | Bug fix? | yes | New feature? | no <!-- if yes, also update src/**/CHANGELOG.md --> | Deprecations? | no <!-- if yes, also update UPGRADE-*.md and src/**/CHANGELOG.md --> | Issues | Fix #... <!-- prefix each issue number with "Fix #"; no need to create an issue if none exists, explain below --> | License | MIT The generics make sense internal but are very confusing for all people not knowing about internal behaviours and hard to guess whats corrct so we should provide defaults for them. Similar to #61805 add some defaults. Stumbled over this during upgrade StofDoctrineExtensionBundle: ``` 14 Method Stof\DoctrineExtensionsBundle\DependencyInjection\Configuration::getConfigTreeBuilder() return type with generic class Symfony\Component\Config\Definition\Builder\TreeBuilder does not specify its types: T 🪪 missingType.generics 40 Method Stof\DoctrineExtensionsBundle\DependencyInjection\Configuration::getVendorNode() return type with generic class Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition does not specify its types: TParent 🪪 missingType.generics 67 Method Stof\DoctrineExtensionsBundle\DependencyInjection\Configuration::getClassNode() return type with generic class Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition does not specify its types: TParent 🪪 missingType.generics 121 Method Stof\DoctrineExtensionsBundle\DependencyInjection\Configuration::getSoftDeleteableNode() return type with generic class Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition does not specify its types: TParent 🪪 missingType.generics 136 Method Stof\DoctrineExtensionsBundle\DependencyInjection\Configuration::getUploadableNode() return type with generic class Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition does not specify its types: TParent 🪪 missingType.generics ``` Commits ------- d21ad61 [Config] Define `TreeBuilder` default generic type
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why?
Currently all
AbstractBundlerun into:I not even sure what is the correct generic type here. If it is
'scalar'or'array'so I think lot of people are not able to guess the correct one. So we should define the correct one for the AbstractBundle already.PHPDoc was added in 8099cda by @nicolas-grekas