-
Notifications
You must be signed in to change notification settings - Fork 93
Simplify extractor service configuration #396
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
b384fff
d8bbd3d
9da14db
e761adf
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 |
---|---|---|
@@ -1,111 +1,76 @@ | ||
services: | ||
Translation\Extractor\FileExtractor\PHPFileExtractor: | ||
tags: | ||
- { name: 'php_translation.extractor', type: 'php' } | ||
_defaults: | ||
autowire: true | ||
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. As discussed in #372 we should not use 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. Will remove it from the defaults 👍 The bundle currently has 4 occurences of using autowiring, so moving it to the level of the service itself seems ok: https://github.com/php-translation/symfony-bundle/search?q=autowire%3A+true&unscoped_q=autowire%3A+true |
||
bind: | ||
$metadataFactory: '@validator' | ||
|
||
Translation\Extractor\FileExtractor\TwigFileExtractor: | ||
arguments: ["@twig"] | ||
tags: | ||
- { name: 'php_translation.extractor', type: 'twig' } | ||
_instanceof: | ||
PhpParser\NodeVisitor: | ||
tags: | ||
- { name: 'php_translation.visitor', type: 'php' } | ||
|
||
# PHP Visitors: | ||
Translation\Extractor\Visitor\Php\Symfony\ContainerAwareTrans: | ||
tags: | ||
- { name: 'php_translation.visitor', type: 'php' } | ||
Translation\Extractor\FileExtractor\PHPFileExtractor: | ||
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. Could we / should we use the same logic for extractors or does it makes no sense? 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 logic are you referring to? |
||
tags: | ||
- { name: 'php_translation.extractor', type: 'php' } | ||
|
||
Translation\Extractor\Visitor\Php\Symfony\ContainerAwareTransChoice: | ||
tags: | ||
- { name: 'php_translation.visitor', type: 'php' } | ||
Translation\Extractor\FileExtractor\TwigFileExtractor: | ||
tags: | ||
- { name: 'php_translation.extractor', type: 'twig' } | ||
|
||
Translation\Extractor\Visitor\Php\Symfony\FlashMessage: | ||
tags: | ||
- { name: 'php_translation.visitor', type: 'php' } | ||
# PHP Visitors: | ||
Translation\Extractor\Visitor\Php\Symfony\: | ||
resource: "%extractor_vendor_dir%/Visitor/Php/Symfony/*" | ||
|
||
Translation\Extractor\Visitor\Php\Symfony\FormTypeChoices: | ||
tags: | ||
- { name: 'php_translation.visitor', type: 'php' } | ||
Translation\Extractor\Visitor\Php\SourceLocationContainerVisitor: ~ | ||
odolbeau marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Translation\Extractor\Visitor\Php\Symfony\FormTypeEmptyValue: | ||
tags: | ||
- { name: 'php_translation.visitor', type: 'php' } | ||
# Twig Visitors: | ||
Translation\Extractor\Visitor\Twig\TwigVisitor: | ||
tags: | ||
- { name: 'php_translation.visitor', type: 'twig' } | ||
|
||
Translation\Extractor\Visitor\Php\Symfony\FormTypeHelp: | ||
tags: | ||
- { name: 'php_translation.visitor', type: 'php' } | ||
|
||
Translation\Extractor\Visitor\Php\Symfony\FormTypeInvalidMessage: | ||
tags: | ||
- { name: 'php_translation.visitor', type: 'php' } | ||
|
||
Translation\Extractor\Visitor\Php\Symfony\FormTypeLabelExplicit: | ||
tags: | ||
- { name: 'php_translation.visitor', type: 'php' } | ||
|
||
Translation\Extractor\Visitor\Php\Symfony\FormTypeLabelImplicit: | ||
tags: | ||
- { name: 'php_translation.visitor', type: 'php' } | ||
|
||
Translation\Extractor\Visitor\Php\Symfony\FormTypePlaceholder: | ||
tags: | ||
- { name: 'php_translation.visitor', type: 'php' } | ||
|
||
Translation\Extractor\Visitor\Php\Symfony\ValidationAnnotation: | ||
arguments: ['@validator'] | ||
tags: | ||
- { name: 'php_translation.visitor', type: 'php' } | ||
|
||
Translation\Extractor\Visitor\Php\SourceLocationContainerVisitor: | ||
tags: | ||
- { name: 'php_translation.visitor', type: 'php' } | ||
|
||
# Twig Visitors: | ||
Translation\Extractor\Visitor\Twig\TwigVisitor: | ||
tags: | ||
- { name: 'php_translation.visitor', type: 'twig' } | ||
|
||
# To remove in next major release | ||
php_translation.extractor.php: | ||
parent: Translation\Extractor\FileExtractor\PHPFileExtractor | ||
deprecated: 'The "%service_id%" service is deprecated. You should stop using it, as it will be removed in the future.' | ||
php_translation.extractor.twig: | ||
parent: Translation\Extractor\FileExtractor\TwigFileExtractor | ||
deprecated: 'The "%service_id%" service is deprecated. You should stop using it, as it will be removed in the future.' | ||
php_translation.extractor.php.visitor.ContainerAwareTrans: | ||
parent: Translation\Extractor\Visitor\Php\Symfony\ContainerAwareTrans | ||
deprecated: 'The "%service_id%" service is deprecated. You should stop using it, as it will be removed in the future.' | ||
php_translation.extractor.php.visitor.ContainerAwareTransChoice: | ||
parent: Translation\Extractor\Visitor\Php\Symfony\ContainerAwareTransChoice | ||
deprecated: 'The "%service_id%" service is deprecated. You should stop using it, as it will be removed in the future.' | ||
php_translation.extractor.php.visitor.FlashMessage: | ||
parent: Translation\Extractor\Visitor\Php\Symfony\FlashMessage | ||
deprecated: 'The "%service_id%" service is deprecated. You should stop using it, as it will be removed in the future.' | ||
php_translation.extractor.php.visitor.FormTypeChoices: | ||
parent: Translation\Extractor\Visitor\Php\Symfony\FormTypeChoices | ||
deprecated: 'The "%service_id%" service is deprecated. You should stop using it, as it will be removed in the future.' | ||
php_translation.extractor.php.visitor.FormTypeEmptyValue: | ||
parent: Translation\Extractor\Visitor\Php\Symfony\FormTypeEmptyValue | ||
deprecated: 'The "%service_id%" service is deprecated. You should stop using it, as it will be removed in the future.' | ||
php_translation.extractor.php.visitor.FormTypeHelp: | ||
parent: Translation\Extractor\Visitor\Php\Symfony\FormTypeHelp | ||
deprecated: 'The "%service_id%" service is deprecated. You should stop using it, as it will be removed in the future.' | ||
php_translation.extractor.php.visitor.FormTypeInvalidMessage: | ||
parent: Translation\Extractor\Visitor\Php\Symfony\FormTypeInvalidMessage | ||
deprecated: 'The "%service_id%" service is deprecated. You should stop using it, as it will be removed in the future.' | ||
php_translation.extractor.php.visitor.FormTypeLabelExplicit: | ||
parent: Translation\Extractor\Visitor\Php\Symfony\FormTypeLabelExplicit | ||
deprecated: 'The "%service_id%" service is deprecated. You should stop using it, as it will be removed in the future.' | ||
php_translation.extractor.php.visitor.FormTypeLabelImplicit: | ||
parent: Translation\Extractor\Visitor\Php\Symfony\FormTypeLabelImplicit | ||
deprecated: 'The "%service_id%" service is deprecated. You should stop using it, as it will be removed in the future.' | ||
php_translation.extractor.php.visitor.FormTypePlaceholder: | ||
parent: Translation\Extractor\Visitor\Php\Symfony\FormTypePlaceholder | ||
deprecated: 'The "%service_id%" service is deprecated. You should stop using it, as it will be removed in the future.' | ||
php_translation.extractor.php.visitor.ValidationAnnotation: | ||
parent: Translation\Extractor\Visitor\Php\Symfony\ValidationAnnotation | ||
deprecated: 'The "%service_id%" service is deprecated. You should stop using it, as it will be removed in the future.' | ||
php_translation.extractor.php.visitor.SourceLocationContainerVisitor: | ||
parent: Translation\Extractor\Visitor\Php\SourceLocationContainerVisitor | ||
deprecated: 'The "%service_id%" service is deprecated. You should stop using it, as it will be removed in the future.' | ||
php_translation.extractor.twig.factory.twig: | ||
parent: Translation\Extractor\Visitor\Twig\TwigVisitor | ||
deprecated: 'The "%service_id%" service is deprecated. You should stop using it, as it will be removed in the future.' | ||
# To remove in next major release | ||
php_translation.extractor.php: | ||
alias: Translation\Extractor\FileExtractor\PHPFileExtractor | ||
deprecated: 'The "%service_id%" service is deprecated. You should use "%alias_id%" instead, as it will be removed in the future.' | ||
php_translation.extractor.twig: | ||
alias: Translation\Extractor\FileExtractor\TwigFileExtractor | ||
deprecated: 'The "%service_id%" service is deprecated. You should use "%alias_id%" instead, as it will be removed in the future.' | ||
php_translation.extractor.php.visitor.ContainerAwareTrans: | ||
alias: Translation\Extractor\Visitor\Php\Symfony\ContainerAwareTrans | ||
deprecated: 'The "%service_id%" service is deprecated. You should use "%alias_id%" instead, as it will be removed in the future.' | ||
php_translation.extractor.php.visitor.ContainerAwareTransChoice: | ||
alias: Translation\Extractor\Visitor\Php\Symfony\ContainerAwareTransChoice | ||
deprecated: 'The "%service_id%" service is deprecated. You should use "%alias_id%" instead, as it will be removed in the future.' | ||
php_translation.extractor.php.visitor.FlashMessage: | ||
alias: Translation\Extractor\Visitor\Php\Symfony\FlashMessage | ||
deprecated: 'The "%service_id%" service is deprecated. You should use "%alias_id%" instead, as it will be removed in the future.' | ||
php_translation.extractor.php.visitor.FormTypeChoices: | ||
alias: Translation\Extractor\Visitor\Php\Symfony\FormTypeChoices | ||
deprecated: 'The "%service_id%" service is deprecated. You should use "%alias_id%" instead, as it will be removed in the future.' | ||
php_translation.extractor.php.visitor.FormTypeEmptyValue: | ||
alias: Translation\Extractor\Visitor\Php\Symfony\FormTypeEmptyValue | ||
deprecated: 'The "%service_id%" service is deprecated. You should use "%alias_id%" instead, as it will be removed in the future.' | ||
php_translation.extractor.php.visitor.FormTypeHelp: | ||
alias: Translation\Extractor\Visitor\Php\Symfony\FormTypeHelp | ||
deprecated: 'The "%service_id%" service is deprecated. You should use "%alias_id%" instead, as it will be removed in the future.' | ||
php_translation.extractor.php.visitor.FormTypeInvalidMessage: | ||
alias: Translation\Extractor\Visitor\Php\Symfony\FormTypeInvalidMessage | ||
deprecated: 'The "%service_id%" service is deprecated. You should use "%alias_id%" instead, as it will be removed in the future.' | ||
php_translation.extractor.php.visitor.FormTypeLabelExplicit: | ||
alias: Translation\Extractor\Visitor\Php\Symfony\FormTypeLabelExplicit | ||
deprecated: 'The "%service_id%" service is deprecated. You should use "%alias_id%" instead, as it will be removed in the future.' | ||
php_translation.extractor.php.visitor.FormTypeLabelImplicit: | ||
alias: Translation\Extractor\Visitor\Php\Symfony\FormTypeLabelImplicit | ||
deprecated: 'The "%service_id%" service is deprecated. You should use "%alias_id%" instead, as it will be removed in the future.' | ||
php_translation.extractor.php.visitor.FormTypePlaceholder: | ||
alias: Translation\Extractor\Visitor\Php\Symfony\FormTypePlaceholder | ||
deprecated: 'The "%service_id%" service is deprecated. You should use "%alias_id%" instead, as it will be removed in the future.' | ||
php_translation.extractor.php.visitor.ValidationAnnotation: | ||
alias: Translation\Extractor\Visitor\Php\Symfony\ValidationAnnotation | ||
deprecated: 'The "%service_id%" service is deprecated. You should use "%alias_id%" instead, as it will be removed in the future.' | ||
php_translation.extractor.php.visitor.SourceLocationContainerVisitor: | ||
alias: Translation\Extractor\Visitor\Php\SourceLocationContainerVisitor | ||
deprecated: 'The "%service_id%" service is deprecated. You should use "%alias_id%" instead, as it will be removed in the future.' | ||
php_translation.extractor.twig.factory.twig: | ||
alias: Translation\Extractor\Visitor\Twig\TwigVisitor | ||
deprecated: 'The "%service_id%" service is deprecated. You should use "%alias_id%" instead, as it will be removed in the future.' |
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.
Won't it be problematic in some edge cases?
For example, if you use a deployment server to warmup the cache before deploying , as the
dirname
function use the absolute path, it will be problematic if your project is not on the same location on your deployment server & your production server.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.
The reason why I used
FormTypeChoices
is because that class already was in code, and thereby already is loadable. IfFormTypeChoices
would not be supported anymore in the future, more functionality will break. As the extension only runs on compilation of the container, this will keep working.Related to the
dirname
function; Wouldn't the composer autoload then also break? The warmup will lead to a compiled container, so the path only is used to locate the classes in a resource. Afterwards, on runtime the composer autoloader will take over again.