-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Twig] Decouple Twig commands from the Famework #9855
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 1 commit
8861f9c
b8bd4aa
1124bb6
d500749
678eddf
a8fd92e
b008f49
3696d04
c244b14
3d0f93c
08759f0
eb831e7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,18 +22,6 @@ class LintCommand extends BaseLintCommand implements ContainerAwareInterface | |
*/ | ||
private $container; | ||
|
||
/** | ||
* @return ContainerInterface | ||
*/ | ||
protected function getContainer() | ||
{ | ||
if (null === $this->container) { | ||
$this->container = $this->getApplication()->getKernel()->getContainer(); | ||
} | ||
|
||
return $this->container; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
|
@@ -47,6 +35,10 @@ public function setContainer(ContainerInterface $container = null) | |
*/ | ||
public function getTwigEnvironment() | ||
{ | ||
return $this->getContainer()->get('twig'); | ||
if (null === $this->container) { | ||
$this->container = $this->getApplication()->getKernel()->getContainer(); | ||
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. Afaik, container can't be null,as it's set by setContainer during initialization? 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. Exact, I took that portion of code from |
||
} | ||
|
||
return $this->container->get('twig'); | ||
} | ||
} |
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.
This should be protected like the one in the Bridge.
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.
Fixed.