Skip to content
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

Merged
merged 34 commits into from
Jan 14, 2020
Merged

Allow Symfony 5 #44

merged 34 commits into from
Jan 14, 2020

Conversation

kylekatarnls
Copy link
Member

Fix #39
Fix #41

@kylekatarnls kylekatarnls added this to the 2.8 milestone Dec 1, 2019
@kylekatarnls kylekatarnls self-assigned this Dec 1, 2019
@codecov
Copy link

codecov bot commented Dec 1, 2019

Codecov Report

Merging #44 into master will decrease coverage by 8.53%.
The diff coverage is 69.23%.

Impacted file tree graph

@@             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
Impacted Files Coverage Δ Complexity Δ
...Jade/JadeSymfonyBundle/Command/PugAwareCommand.php 0% <0%> (ø) 1 <1> (?)
...JadeSymfonyBundle/Command/AssetsPublishCommand.php 100% <100%> (ø) 14 <0> (+1) ⬆️
src/Jade/Exceptions/ReservedVariable.php 100% <100%> (ø) 1 <1> (?)
...rc/Jade/Symfony/Traits/PrivatePropertyAccessor.php 100% <100%> (ø) 1 <1> (?)
src/Jade/Symfony/Traits/Filters.php 100% <100%> (ø) 3 <0> (ø) ⬇️
src/Jade/Symfony/MixedLoader.php 100% <100%> (+66.66%) 0 <0> (ø) ⬇️
src/Jade/Symfony/Traits/Installer.php 91.7% <15%> (-8.3%) 71 <4> (+6)
src/Jade/Symfony/Traits/Options.php 83.33% <71.42%> (-16.67%) 7 <1> (+1)
src/Jade/Symfony/Traits/HelpersHandler.php 90.51% <72.5%> (-9.49%) 58 <16> (+14)
src/Jade/JadeSymfonyEngine.php 87.77% <75.29%> (-12.23%) 77 <37> (+20)
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e92778a...03420ca. Read the comment docs.

@pug-php pug-php deleted a comment from codeclimate bot Dec 2, 2019
@pug-php pug-php deleted a comment from codeclimate bot Dec 2, 2019
@pug-php pug-php deleted a comment from codeclimate bot Dec 2, 2019
@pug-php pug-php deleted a comment from codeclimate bot Dec 2, 2019
@pug-php pug-php deleted a comment from codeclimate bot Dec 2, 2019
@pug-php pug-php deleted a comment from codeclimate bot Dec 2, 2019
@pug-php pug-php deleted a comment from codeclimate bot Dec 2, 2019
@pug-php pug-php deleted a comment from codeclimate bot Dec 2, 2019
@pug-php pug-php deleted a comment from codeclimate bot Dec 2, 2019
}
}

return parent::render($name, $context);
Copy link

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);
Copy link

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);
Copy link

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()) {
Copy link

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();
Copy link

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';
Copy link

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();
Copy link

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()) {
Copy link

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;
Copy link

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);
Copy link

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


if ($this->pugSymfonyEngine->supports($path)) {
$pug = $this->pugSymfonyEngine->getEngine();
$code = $source->getCode();
Copy link

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();
Copy link

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);
Copy link

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) {
Copy link

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();
Copy link

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())));
Copy link

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'),
Copy link

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(),
Copy link

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),
Copy link

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);
Copy link

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())));
Copy link

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'),
Copy link

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(),
Copy link

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(),
Copy link

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;
Copy link

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(),
Copy link

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(), [
Copy link

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);
Copy link

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
Copy link

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
Copy link

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');
Copy link

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';
Copy link

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)

@pug-php pug-php deleted a comment from codeclimate bot Dec 14, 2019
@pug-php pug-php deleted a comment from codeclimate bot Dec 14, 2019
@pug-php pug-php deleted a comment from codeclimate bot Dec 14, 2019
$node = $nodeEvent->getNode();

if ($node instanceof ImportNode && $node->getName() === 'include') {
$code = new TextNode($node->getToken());
Copy link

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');
Copy link

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';
Copy link

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);
Copy link

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);
Copy link

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());
Copy link

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');
Copy link

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';
Copy link

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);
Copy link

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);
Copy link

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

@codeclimate
Copy link

codeclimate bot commented Dec 15, 2019

Code Climate has analyzed commit d72382a and detected 145 issues on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 13
Style 21
Bug Risk 95
Clarity 16

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.

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

Successfully merging this pull request may close these issues.

Allow twig file imports Allow Symfony 5
1 participant