-
Notifications
You must be signed in to change notification settings - Fork 93
Added Symfony 4 compatibility and refactored code #345
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
Conversation
Replaced Symfony\Bundle\FrameworkBundle\Controller\Controller with Symfony\Bundle\FrameworkBundle\Controller\AbstractController Added proper return type and type hints Updated php doc-blocks
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.
Thanks for your first contribution. :) It looks great. 👍
Could you please update CS?
You will need to replace the |
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.
Please run cs-fixer to clean PHPDoc blocs ;)
Thanks for your contribution
Controller/EditInPlaceController.php
Outdated
{ | ||
/** | ||
* @param Request $request | ||
* @param string $configName | ||
* @param string $locale |
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.
cs-fixer should remove those PHPDoc lines since they are redundant with type hinting.
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.
#342 also has the commits that fix cs, but these did not make it to master
yet
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.
Ok, let's merge #342 and this one. 👍
+ Removed $this-get calls in the controller and injected appropriate dependencies via constructor + cs-fixes + Added proper type-hints and return types + Added ext-json in the composer.json file
@odolbeau Updated the PR with CS-fixes and more changes. Could you please have a look. |
@junaidbinfarooq Much better indeed. Still, those changes will only work if you have autowire enabled. So you'll have to create |
Oh! yeah. Done now. Please have a look. |
Resources/config/services.yml
Outdated
@@ -1,3 +1,6 @@ | |||
imports: | |||
- { resource: controller.yml } |
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.
Being a bundle, it would be better to move the import to TranslationExtension
. See https://github.com/php-translation/symfony-bundle/blob/master/DependencyInjection/TranslationExtension.php#L42
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.
Did see this before but still thought of importing the services as we do in the applications. Anyways, this is done now.
Resources/config/controller.yml
Outdated
@@ -0,0 +1,9 @@ | |||
services: | |||
_defaults: |
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 _defaults
section needs to be removed. Autowire must be enabled in your own application and not in a bundle.
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.
Done.
@@ -22,7 +22,8 @@ | |||
"php-translation/symfony-storage": "^1.0", | |||
"php-translation/extractor": "^1.6", | |||
"nyholm/nsa": "^1.1", | |||
"twig/twig": "^1.42 || ^2.11" | |||
"twig/twig": "^1.42 || ^2.11", | |||
"ext-json": "*" |
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.
Is this change required?
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.
Added this after encountering few usages of json_encode/decode functions. PhpStorm does show a warning for this.
@junaidbinfarooq Almost done :) |
Resources/config/controller.yml
Outdated
autoconfigure: true | ||
public: true | ||
|
||
Translation\Bundle\Controller\: |
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.
You will need to inject all the services into the constructor, so the controllers can work without autowire.
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.
Have indeed used constructor injection.
…Extension + Renamed controller.yml to controllers.yml + Removed a few non-existent class usages
@junaidbinfarooq Hi, as #342 is now merged in master, could you fix conflicts due to the merge (#342 (comment)). |
Done. Could you please have a look. |
Looks good in general. Just some tests need to be fixed. |
@odolbeau Couldn't you have created a fork of my branch and update the tests instead of creating another PR and closing this one? |
I tried but I finally choose to create a new branch for several reasons. |
Replaced Symfony\Bundle\FrameworkBundle\Controller\Controller with Symfony\Bundle\FrameworkBundle\Controller\AbstractController
Added proper return type and type hints
Updated php doc-blocks