-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
Allow Symfony 5 #44
Allow Symfony 5 #44
Conversation
d637c91
to
bcb19a7
Compare
Register the command automatically from the bundle
Codecov Report
@@ Coverage Diff @@
## master #44 +/- ##
===========================================
- Coverage 98.74% 90.2% -8.54%
- Complexity 191 242 +51
===========================================
Files 8 12 +4
Lines 478 582 +104
===========================================
+ Hits 472 525 +53
- Misses 6 57 +51
Continue to review full report at Codecov.
|
73ff0f2
to
4b9f264
Compare
} | ||
} | ||
|
||
return parent::render($name, $context); |
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.
Reference to undeclared class \Twig\Environment
(Did you mean class \Pug\Twig\Environment)
|
||
$this->classNames[$name] = $cls; | ||
|
||
return parent::loadTemplate($cls, $name, $index); |
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.
Reference to undeclared class \Twig\Environment
(Did you mean class \Pug\Twig\Environment)
return strtr(file_get_contents($templateFile), $replacements); | ||
} | ||
|
||
$html = parent::compileSource($source); |
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.
Reference to undeclared class \Twig\Environment
(Did you mean class \Pug\Twig\Environment)
'[/* {{debugInfo}} */]' => var_export($debugInfo, true), | ||
]; | ||
|
||
if ($this->isDebug()) { |
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.
Call to undeclared method \Pug\Twig\EnvironmentBase::isDebug
|
||
$fileName = $this->isDebug() ? 'PugDebugTemplateTemplate' : 'PugTemplateTemplate'; | ||
$templateFile = __DIR__ . "/../../../cache-templates/$fileName.php"; | ||
$name = $source->getName(); |
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.
Call to method getName
from undeclared class \Twig\Source
} | ||
} | ||
|
||
$fileName = $this->isDebug() ? 'PugDebugTemplateTemplate' : 'PugTemplateTemplate'; |
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.
Call to undeclared method \Pug\Twig\EnvironmentBase::isDebug
|
||
if ($this->isDebug()) { | ||
$preRenderLinesCount = $this->pugSymfonyEngine->getPreRenderLinesCount(); | ||
$formatter = $pug->getCompiler()->getFormatter(); |
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.
Call to method getCompiler
from undeclared class \Pug\Pug
$debugInfo = [$codeFirstLine => $templateLine]; | ||
$lines = explode("\n", $php); | ||
|
||
if ($this->isDebug()) { |
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.
Call to undeclared method \Pug\Twig\EnvironmentBase::isDebug
$pug = $this->pugSymfonyEngine->getEngine(); | ||
$code = $source->getCode(); | ||
$php = $pug->compile($code, $path); | ||
$codeFirstLine = $this->isDebug() ? 31 : 25; |
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.
Call to undeclared method \Pug\Twig\EnvironmentBase::isDebug
if ($this->pugSymfonyEngine->supports($path)) { | ||
$pug = $this->pugSymfonyEngine->getEngine(); | ||
$code = $source->getCode(); | ||
$php = $pug->compile($code, $path); |
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.
Call to method compile
from undeclared class \Pug\Pug
5e6f28c
to
0d55e37
Compare
|
||
if ($this->pugSymfonyEngine->supports($path)) { | ||
$pug = $this->pugSymfonyEngine->getEngine(); | ||
$code = $source->getCode(); |
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.
Call to method getCode
from undeclared class \Twig\Source
|
||
public function compileSourceBase(Source $source) | ||
{ | ||
$path = $source->getPath(); |
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.
Call to method getPath
from undeclared class \Twig\Source
unset($extensions[$key]); | ||
} | ||
|
||
$twig->setExtensions($extensions); |
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.
Call to undeclared method \Pug\Twig\EnvironmentBase::setExtensions
|
||
$extensions = $baseTwig->getExtensions(); | ||
|
||
foreach (array_keys($twig->getExtensions()) as $key) { |
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.
Call to undeclared method \Pug\Twig\EnvironmentBase::getExtensions
|
||
$twig->setPugSymfonyEngine($pugSymfonyEngine); | ||
|
||
$extensions = $baseTwig->getExtensions(); |
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.
Call to method getExtensions
from undeclared class \Twig\Environment
(Did you mean class \Pug\Twig\Environment)
|
||
if (version_compare(Environment::VERSION, '3.0.0-dev', '>=') && | ||
!isset($extensions['Symfony\\Bridge\\Twig\\Extension\\AssetExtension'])) { | ||
$assetExtension = new AssetExtension(new Packages(new Package(new EmptyVersionStrategy()))); |
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.
Call to method __construct
from undeclared class \Symfony\Component\Asset\Packages
'cache' => $baseTwig->getCache(true), | ||
'auto_reload' => $baseTwig->isAutoReload(), | ||
'optimizations' => static::getPrivateProperty( | ||
$baseTwig->getExtension('Twig\\Extension\\OptimizerExtension'), |
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.
Call to method getExtension
from undeclared class \Twig\Environment
(Did you mean class \Pug\Twig\Environment)
'defaultStrategy' | ||
), | ||
'cache' => $baseTwig->getCache(true), | ||
'auto_reload' => $baseTwig->isAutoReload(), |
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.
Call to method isAutoReload
from undeclared class \Twig\Environment
(Did you mean class \Pug\Twig\Environment)
$baseTwig->getExtension('Twig\\Extension\\EscaperExtension'), | ||
'defaultStrategy' | ||
), | ||
'cache' => $baseTwig->getCache(true), |
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.
Call to method getCache
from undeclared class \Twig\Environment
(Did you mean class \Pug\Twig\Environment)
@@ -19,7 +19,7 @@ trait Filters | |||
*/ | |||
public function filter($name, $filter) | |||
{ | |||
$this->jade->filter($name, $filter); | |||
$this->pug->filter($name, $filter); |
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.
Call to method filter
from undeclared class \Pug\Pug
|
||
if (version_compare(Environment::VERSION, '3.0.0-dev', '>=') && | ||
!isset($extensions['Symfony\\Bridge\\Twig\\Extension\\AssetExtension'])) { | ||
$assetExtension = new AssetExtension(new Packages(new Package(new EmptyVersionStrategy()))); |
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.
Call to method __construct
from undeclared class \Symfony\Bridge\Twig\Extension\AssetExtension
'charset' => $baseTwig->getCharset(), | ||
'strict_variables' => $baseTwig->isStrictVariables(), | ||
'autoescape' => static::getPrivateProperty( | ||
$baseTwig->getExtension('Twig\\Extension\\EscaperExtension'), |
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.
Call to method getExtension
from undeclared class \Twig\Environment
(Did you mean class \Pug\Twig\Environment)
$twig = new static($baseTwig->getLoader(), [ | ||
'debug' => $baseTwig->isDebug(), | ||
'charset' => $baseTwig->getCharset(), | ||
'strict_variables' => $baseTwig->isStrictVariables(), |
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.
Call to method isStrictVariables
from undeclared class \Twig\Environment
(Did you mean class \Pug\Twig\Environment)
{ | ||
$twig = new static($baseTwig->getLoader(), [ | ||
'debug' => $baseTwig->isDebug(), | ||
'charset' => $baseTwig->getCharset(), |
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.
Call to method getCharset
from undeclared class \Twig\Environment
(Did you mean class \Pug\Twig\Environment)
@@ -131,7 +212,17 @@ protected function getTwig(ContainerInterface $container) | |||
{ | |||
$twig = $container->has('twig') ? $container->get('twig') : null; | |||
|
|||
return ($twig instanceof \Twig_Environment || $twig instanceof \Twig\Environment) ? $twig : null; | |||
$twig = ($twig instanceof \Twig_Environment || $twig instanceof \Twig\Environment) ? $twig : null; |
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.
Checking instanceof against undeclared class \Twig_Environment
public static function fromTwigEnvironment(TwigEnvironment $baseTwig, PugSymfonyEngine $pugSymfonyEngine) | ||
{ | ||
$twig = new static($baseTwig->getLoader(), [ | ||
'debug' => $baseTwig->isDebug(), |
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.
Call to method isDebug
from undeclared class \Twig\Environment
(Did you mean class \Pug\Twig\Environment)
|
||
public static function fromTwigEnvironment(TwigEnvironment $baseTwig, PugSymfonyEngine $pugSymfonyEngine) | ||
{ | ||
$twig = new static($baseTwig->getLoader(), [ |
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.
Call to method getLoader
from undeclared class \Twig\Environment
(Did you mean class \Pug\Twig\Environment)
|
||
public function __construct(LoaderInterface $loader, $options = []) | ||
{ | ||
parent::__construct($loader, $options); |
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.
Reference to undeclared class \Twig\Environment
(Did you mean class \Pug\Twig\Environment)
/** | ||
* @codeCoverageIgnore | ||
*/ | ||
abstract class EnvironmentBase extends TwigEnvironment |
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.
Class extends undeclared class \Twig\Environment
(Did you mean class \Pug\Twig\Environment)
require_once __DIR__ . '/../../../polyfill/Pug/Twig/EnvironmentTwig' . TwigEnvironment::MAJOR_VERSION . '.php'; | ||
class_alias('Pug\\Twig\\EnvironmentTwig' . TwigEnvironment::MAJOR_VERSION, 'Pug\\Twig\\EnvironmentTwigPolyfill'); | ||
|
||
class Environment extends EnvironmentTwigPolyfill |
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.
Class extends undeclared class \Pug\Twig\EnvironmentTwigPolyfill
|
||
// @codeCoverageIgnoreStart | ||
require_once __DIR__ . '/../../../polyfill/Pug/Twig/EnvironmentTwig' . TwigEnvironment::MAJOR_VERSION . '.php'; | ||
class_alias('Pug\\Twig\\EnvironmentTwig' . TwigEnvironment::MAJOR_VERSION, 'Pug\\Twig\\EnvironmentTwigPolyfill'); |
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.
Reference to constant MAJOR_VERSION
from undeclared class \Twig\Environment
(Did you mean class \Pug\Twig\Environment)
use Twig\Environment as TwigEnvironment; | ||
|
||
// @codeCoverageIgnoreStart | ||
require_once __DIR__ . '/../../../polyfill/Pug/Twig/EnvironmentTwig' . TwigEnvironment::MAJOR_VERSION . '.php'; |
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.
Reference to constant MAJOR_VERSION
from undeclared class \Twig\Environment
(Did you mean class \Pug\Twig\Environment)
$node = $nodeEvent->getNode(); | ||
|
||
if ($node instanceof ImportNode && $node->getName() === 'include') { | ||
$code = new TextNode($node->getToken()); |
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.
Call to method getToken
from undeclared class \Phug\Parser\Node\ImportNode
|
||
// @codeCoverageIgnoreStart | ||
require_once __DIR__ . '/../../../polyfill/Pug/Twig/EnvironmentTwig' . TwigEnvironment::MAJOR_VERSION . '.php'; | ||
class_alias('Pug\\Twig\\EnvironmentTwig' . TwigEnvironment::MAJOR_VERSION, 'Pug\\Twig\\EnvironmentTwigPolyfill'); |
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.
Reference to constant MAJOR_VERSION
from undeclared class \Twig\Environment
(Did you mean class \Pug\Twig\Environment)
use Twig\Environment as TwigEnvironment; | ||
|
||
// @codeCoverageIgnoreStart | ||
require_once __DIR__ . '/../../../polyfill/Pug/Twig/EnvironmentTwig' . TwigEnvironment::MAJOR_VERSION . '.php'; |
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.
Reference to constant MAJOR_VERSION
from undeclared class \Twig\Environment
(Did you mean class \Pug\Twig\Environment)
@@ -88,6 +88,16 @@ public function setOptions(array $options) | |||
*/ | |||
public function setCustomOptions(array $options) | |||
{ | |||
return $this->jade->setCustomOptions($options); | |||
return $this->pug->setCustomOptions($options); |
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.
Call to method setCustomOptions
from undeclared class \Pug\Pug
@@ -73,7 +73,7 @@ public function setOption($name, $value) | |||
*/ | |||
public function setOptions(array $options) | |||
{ | |||
return $this->jade->setOptions($options); | |||
return $this->pug->setOptions($options); |
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.
Call to method setOptions
from undeclared class \Pug\Pug
$node = $nodeEvent->getNode(); | ||
|
||
if ($node instanceof ImportNode && $node->getName() === 'include') { | ||
$code = new TextNode($node->getToken()); |
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.
Call to method getToken
from undeclared class \Phug\Parser\Node\ImportNode
|
||
// @codeCoverageIgnoreStart | ||
require_once __DIR__ . '/../../../polyfill/Pug/Twig/EnvironmentTwig' . TwigEnvironment::MAJOR_VERSION . '.php'; | ||
class_alias('Pug\\Twig\\EnvironmentTwig' . TwigEnvironment::MAJOR_VERSION, 'Pug\\Twig\\EnvironmentTwigPolyfill'); |
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.
Reference to constant MAJOR_VERSION
from undeclared class \Twig\Environment
(Did you mean class \Pug\Twig\Environment)
use Twig\Environment as TwigEnvironment; | ||
|
||
// @codeCoverageIgnoreStart | ||
require_once __DIR__ . '/../../../polyfill/Pug/Twig/EnvironmentTwig' . TwigEnvironment::MAJOR_VERSION . '.php'; |
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.
Reference to constant MAJOR_VERSION
from undeclared class \Twig\Environment
(Did you mean class \Pug\Twig\Environment)
@@ -88,6 +88,16 @@ public function setOptions(array $options) | |||
*/ | |||
public function setCustomOptions(array $options) | |||
{ | |||
return $this->jade->setCustomOptions($options); | |||
return $this->pug->setCustomOptions($options); |
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.
Call to method setCustomOptions
from undeclared class \Pug\Pug
@@ -73,7 +73,7 @@ public function setOption($name, $value) | |||
*/ | |||
public function setOptions(array $options) | |||
{ | |||
return $this->jade->setOptions($options); | |||
return $this->pug->setOptions($options); |
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.
Call to method setOptions
from undeclared class \Pug\Pug
Code Climate has analyzed commit d72382a and detected 145 issues on this pull request. Here's the issue category breakdown:
Note: there are 85 critical issues. The test coverage on the diff in this pull request is 68.7% (80% is the threshold). This pull request will bring the total coverage in the repository to 89.9% (-10.0% change). View more on Code Climate. |
0bd4c9e
to
03420ca
Compare
Fix #39
Fix #41