From 518c469045ca8d56305b81071237be0d4f948867 Mon Sep 17 00:00:00 2001 From: jurgenhaas <juergen@paragon-es.de> Date: Fri, 17 Jul 2020 15:59:27 +0200 Subject: [PATCH] Get ready for composer 2 --- composer.json | 8 ++++---- src/Handler.php | 15 +++++++++------ src/Plugin.php | 6 +++--- src/UpdateCommand.php | 6 +++--- 4 files changed, 19 insertions(+), 16 deletions(-) diff --git a/composer.json b/composer.json index d1c9d20..f06714d 100644 --- a/composer.json +++ b/composer.json @@ -26,15 +26,15 @@ "require": { "ext-json": "*", "php": ">=7.2", - "composer-plugin-api": "^1.0.0", + "composer-plugin-api": "^1||^2", "lakedrops/composer-json-utils": "^1.5.0", "lakedrops/docker-traefik": "^1.2.0", "lakedrops/dotenv": "^1.2.2", - "twig/twig": "^1.23.1||^2.12" + "twig/twig": "^1.23.1" }, "require-dev": { - "composer/composer": "^1.5.0", - "phpunit/phpunit": "^4.8.0" + "composer/composer": "^1||^2", + "phpunit/phpunit": "^8.4" }, "minimum-stability": "dev", "prefer-stable": true, diff --git a/src/Handler.php b/src/Handler.php index 67ee29f..9b58f83 100644 --- a/src/Handler.php +++ b/src/Handler.php @@ -2,11 +2,14 @@ namespace LakeDrops\Docker4Drupal; +use Exception; use LakeDrops\Component\Composer\BaseHandler; use LakeDrops\Component\Dotenv\Dotenv; use LakeDrops\DockerTraefik\Traefik; use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\Yaml\Yaml; +use Twig_Environment; +use Twig_Loader_Array; /** * Class Handler. @@ -26,9 +29,9 @@ class Handler extends BaseHandler { * @param bool $overwrite * Whether to overwrite existing config files. * - * @throws \Twig_Error_Loader - * @throws \Twig_Error_Runtime - * @throws \Twig_Error_Syntax + * @throws \Twig\Error\LoaderError + * @throws \Twig\Error\RuntimeError + * @throws \Twig\Error\SyntaxError */ public function configureProject($overwrite = FALSE) { @@ -75,8 +78,8 @@ class Handler extends BaseHandler { } // Provide all the required files. - $twig_loader = new \Twig_Loader_Array([]); - $twig = new \Twig_Environment($twig_loader); + $twig_loader = new Twig_Loader_Array([]); + $twig = new Twig_Environment($twig_loader); $options['webRoot'] = $webRoot . '/'; $orig_ignored = FALSE; foreach ($this->getFiles($projectRoot, $webRoot, $settingsPath, $options) as $template => $def) { @@ -405,7 +408,7 @@ class Handler extends BaseHandler { exec('docker container inspect ' . $id, $output); return json_decode(implode('', $output), TRUE)[0]; } - catch (\Exception $ex) { + catch (Exception $ex) { // Ignore. } return [ diff --git a/src/Plugin.php b/src/Plugin.php index 5a8fdbc..74e3325 100644 --- a/src/Plugin.php +++ b/src/Plugin.php @@ -44,9 +44,9 @@ class Plugin extends BasePlugin { * @param \Composer\Script\Event $event * The event that triggered the call of this function. * - * @throws \Twig_Error_Loader - * @throws \Twig_Error_Runtime - * @throws \Twig_Error_Syntax + * @throws \Twig\Error\LoaderError + * @throws \Twig\Error\RuntimeError + * @throws \Twig\Error\SyntaxError */ public function configureProject(Event $event) { /** @var Handler $handler */ diff --git a/src/UpdateCommand.php b/src/UpdateCommand.php index 951bc54..0f2664b 100644 --- a/src/UpdateCommand.php +++ b/src/UpdateCommand.php @@ -26,9 +26,9 @@ class UpdateCommand extends BaseCommand { /** * {@inheritdoc} * - * @throws \Twig_Error_Loader - * @throws \Twig_Error_Runtime - * @throws \Twig_Error_Syntax + * @throws \Twig\Error\LoaderError + * @throws \Twig\Error\RuntimeError + * @throws \Twig\Error\SyntaxError */ protected function execute(InputInterface $input, OutputInterface $output) { parent::execute($input, $output); -- GitLab