Skip to content

Commit

Permalink
Merge pull request #936 from Quetzacoalt91/bring-back-twig
Browse files Browse the repository at this point in the history
Bring back twig in project dependencies
  • Loading branch information
M0rgan01 authored Oct 3, 2024
2 parents 7420c95 + 82b2a7d commit e71541d
Show file tree
Hide file tree
Showing 6 changed files with 99 additions and 6 deletions.
2 changes: 0 additions & 2 deletions ajax-upgradetab.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@
* Calling it from the module/autoupgrade folder will have unwanted consequences on the upgrade and your shop.
*/
require_once realpath(dirname(__FILE__) . '/../../modules/autoupgrade') . '/ajax-upgradetabconfig.php';
// TODO: We need to remove this in the future and add Twig into the module dependencies.
require_once realpath(dirname(__FILE__) . '/../../vendor/autoload.php');
$container = autoupgrade_init_container(dirname(__FILE__));

(new \PrestaShop\Module\AutoUpgrade\ErrorHandler($container->getLogger()))->enable();
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"segmentio/analytics-php": "^1.8",
"symfony/dotenv": "^4.4",
"symfony/http-foundation": "^4.4",
"symfony/console": "^3.4"
"symfony/console": "^3.4",
"twig/twig": "^2.16"
},
"require-dev": {
"phpunit/phpunit": "^5",
Expand Down
82 changes: 81 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions tests/phpstan/forceAutoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,19 @@
use Symfony\Component\Console\Output\Output;

class_exists(Output::class);

// We load Twig classes to avoid conflicts with old versions of PrestaShop providing old versions of the library.
// Avoid Reflection error: Circular reference to class "Twig_Environment"
require_once __DIR__ . '/../../vendor/twig/twig/src/Environment.php';

// Avoid Reflection error: Circular reference to class "Twig\Error\Error"
require_once __DIR__ . '/../../vendor/twig/twig/src/Error/Error.php';

// Avoid Reflection error: Circular reference to class "Twig_ExtensionInterface"
require_once __DIR__ . '/../../vendor/twig/twig/src/Extension/ExtensionInterface.php';
require_once __DIR__ . '/../../vendor/twig/twig/src/Extension/AbstractExtension.php';

// Avoid Reflection error: Circular reference to class "Twig_LoaderInterface"
require_once __DIR__ . '/../../vendor/twig/twig/src/Loader/LoaderInterface.php';
require_once __DIR__ . '/../../vendor/twig/twig/src/Loader/ExistsLoaderInterface.php';
require_once __DIR__ . '/../../vendor/twig/twig/src/Loader/SourceContextLoaderInterface.php';
1 change: 0 additions & 1 deletion tests/phpstan/phpstan-8.0.0.neon
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ parameters:
- '#Method PrestaShop\\Module\\AutoUpgrade\\UpgradeTools\\SymfonyAdapter::initKernel\(\) has invalid return type AdminKernel.#'
- '#Instantiated class AdminKernel not found\.#'
- "#^Parameter \\#1 \\$callback of function array_map expects \\(callable\\(int\\)\\: mixed\\)\\|null, 'add_quotes' given\\.$#"
- '#Call to method render\(\) on an unknown class Twig_Environment#'
-
identifier: booleanAnd.rightAlwaysTrue
path: ./../../classes/UpgradeSelfCheck.php
Expand Down
1 change: 0 additions & 1 deletion tests/phpstan/phpstan-latest.neon
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ parameters:
- '#Method PrestaShop\\Module\\AutoUpgrade\\UpgradeTools\\SymfonyAdapter::initKernel\(\) has invalid return type AdminKernel.#'
- '#Instantiated class AdminKernel not found\.#'
- "#^Parameter \\#1 \\$callback of function array_map expects \\(callable\\(int\\)\\: mixed\\)\\|null, 'add_quotes' given\\.$#"
- '#Call to method render\(\) on an unknown class Twig_Environment#'
-
identifier: booleanAnd.rightAlwaysTrue
path: ./../../classes/UpgradeSelfCheck.php
Expand Down

0 comments on commit e71541d

Please sign in to comment.