-
Notifications
You must be signed in to change notification settings - Fork 153
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
Upgrade to support 2.8 & 3.0 and fixed deprecations #80
Changes from 1 commit
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 |
---|---|---|
|
@@ -54,14 +54,12 @@ class DeviceView | |
*/ | ||
public function __construct(Container $serviceContainer) | ||
{ | ||
if (false === $serviceContainer->isScopeActive('request')) { | ||
if (!$this->request = $serviceContainer->get('request_stack')->getMasterRequest()) { | ||
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. This won't work in Symfony 2.3 or older as the request stack was introduced in Symfony 2.4. 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. A solution might be to register a request event listener which populates the current request to the 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'm wondering if it might be better / easier to break BC and bump the major version?
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. Well, Symfony 2.3 is still supported until May and will then receive security fixes for another year. So personally, I would not make that change yet. 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. Bumping the major version doesn't mean the (then) older major won't work on Symfony 2.3 anymore. If need be, we could even create a branch and release a patch on the (then) older major. I've seen a couple of bundles taking this approach to avoid the boilerplate code required to support both sf <= 2.3 and sf >= 2.4 at the same time. Plus, once sf 2.3 goes end-of-life, we'd have to go through our codebase (again) and explicitly remove the boilerplate code, which takes time (again). 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. Well put, a and is precisely why I made the suggestion.
|
||
$this->viewType = self::VIEW_NOT_MOBILE; | ||
|
||
return; | ||
} | ||
|
||
$this->request = $serviceContainer->get('request'); | ||
|
||
if ($this->request->query->has(self::SWITCH_PARAM)) { | ||
$this->viewType = $this->request->query->get(self::SWITCH_PARAM); | ||
} elseif ($this->request->cookies->has(self::COOKIE_KEY)) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,11 +13,12 @@ | |
], | ||
"require": { | ||
"php": ">=5.3.0", | ||
"symfony/framework-bundle": ">=2.3,<3.0", | ||
"symfony/framework-bundle": ">=2.3|~2.8|~3.0", | ||
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. you can simply use |
||
"mobiledetect/mobiledetectlib": "~2.8" | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "~4.1" | ||
"phpunit/phpunit": "~4.1", | ||
"symfony/phpunit-bridge": "^3.0" | ||
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. Should be |
||
}, | ||
"autoload": { | ||
"psr-0": { | ||
|
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 wouldn't add tests for these two versions as they already reached their end of maintenance (2.5 actually even reached its end of life). For the same reason you might want to drop the build for 2.4 too (the builds for 2.1 and 2.2 actually do not make much sense at all as the MobileDetectBundle already requires the version of the FrameworkBundle to be 2.3 or higher).