-
-
Notifications
You must be signed in to change notification settings - Fork 739
[Symfony] Set few default common service names for Symfony App Analyzer #1687
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,8 @@ final class DefaultAnalyzedSymfonyApplicationContainer implements AnalyzedApplic | |
| */ | ||
| private $commonNamesToTypes = [ | ||
| 'doctrine' => 'Doctrine\Bundle\DoctrineBundle\Registry', | ||
| 'doctrine.orm.entity_manager' => 'Doctrine\ORM\EntityManagerInterface', | ||
| 'doctrine.orm.default_entity_manager' => 'Doctrine\ORM\EntityManagerInterface', | ||
| ]; | ||
|
|
||
| /** | ||
|
|
@@ -35,14 +37,19 @@ final class DefaultAnalyzedSymfonyApplicationContainer implements AnalyzedApplic | |
| */ | ||
| private $containerFactory; | ||
|
|
||
| /** | ||
| * @param array<string, string> $commonNamesToTypes | ||
| */ | ||
| public function __construct( | ||
| ParameterProvider $parameterProvider, | ||
| SymfonyKernelParameterGuard $symfonyKernelParameterGuard, | ||
| ContainerFactory $containerFactory | ||
| ContainerFactory $containerFactory, | ||
| array $commonNamesToTypes = [] | ||
| ) { | ||
| $this->parameterProvider = $parameterProvider; | ||
| $this->symfonyKernelParameterGuard = $symfonyKernelParameterGuard; | ||
| $this->containerFactory = $containerFactory; | ||
| $this->commonNamesToTypes = array_merge($this->commonNamesToTypes, $commonNamesToTypes); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is this needed for? Default names should not depend on custom user input, but on default Symfony naming. The point is 0-configuration. So services are loaded from the App container itself and we don't bother user to basically copy-paste it to
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Problem is for example that by default container says that: This is just one example, if there is more edge cases (in big legacy like we have, we can occur them most likely), user is not able to have automatic fix for such cases and he/she will be forced to fix it manually. With this you can have most common known cases for replacement, but also user is able to not wait for new release of Rector if he/she finds another edge case.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I see. It makes sense now :) 👍 I miss this description on PR. Could you add it next time, so I can read the code with context of your intention? It would speed up the review |
||
| } | ||
|
|
||
| public function getTypeForName(string $name): ?string | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.