Skip to content

Conversation

@bocharsky-bw
Copy link
Member

Fixes #436

These changes allow us to keep the profiler feature enabled by default in the recipe: https://github.com/symfony/recipes-contrib/blob/ff7313b337a4c0ec894684f71b62240a31816e9f/php-translation/symfony-bundle/0.10/config/packages/dev/php_translation.yaml#L3 to have good discoverability of the feature for those who have the symfony/web-profiler-bundle installed but won't throw an exception if the symfony/web-profiler-bundle is missing in the project on composer require php-translation/symfony-bundle. If somehow this feature will be tried to use - we will show a clear user-friendly message about requiring symfony/web-profiler-bundle dependency first.

@bocharsky-bw
Copy link
Member Author

I see some tests failed on new Symfony 5.3 :/

Any ideas on how to fix them?

- '@profiler'
- '%php_translation.toolbar.allow_edit%'
calls:
- setProfiler: ['@?profiler']
Copy link
Member

Choose a reason for hiding this comment

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

Will this throw an exception in combination with the non-nullable typehint on the setter?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good question! I tried this when was coding and no exception was thrown. It looks like Symfony just does not call that setProfiler() method at all if the @profiler service unavailable

@bocharsky-bw bocharsky-bw merged commit 44fb606 into php-translation:master Jun 10, 2021
@bocharsky-bw bocharsky-bw deleted the optional-profiler branch June 10, 2021 08:28
@bocharsky-bw
Copy link
Member Author

Thank you for the review!

After #443 tests should be green here, let's push the #443 now

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

Labels

3 participants