From 2935796e0e61879e023fc531be4f054ea261c4f9 Mon Sep 17 00:00:00 2001 From: Markus Poerschke Date: Tue, 31 Mar 2020 15:01:10 +0200 Subject: [PATCH] Support Twig v3 only * drop support for PHP 7.2 * drop support for Twig v2 --- .travis.yml | 19 +++++-------------- CHANGELOG.md | 11 +++++++++++ composer.json | 4 ++-- src/Describer/FilterDescriber.php | 4 ++-- src/Describer/FunctionDescriber.php | 4 ++-- 5 files changed, 22 insertions(+), 20 deletions(-) diff --git a/.travis.yml b/.travis.yml index 558627e..4a68032 100644 --- a/.travis.yml +++ b/.travis.yml @@ -49,21 +49,15 @@ jobs: - <<: *lint_php name: Lint PHP 7.3 php: 7.3 - - <<: *lint_php - name: Lint PHP 7.2 - php: 7.2 - <<: *editor_config name: Lint Editorconfig php: 7.4 - - <<: *psalm - name: Psalm (PHP 7.3) - php: 7.3 - <<: *psalm name: Psalm (PHP 7.4) php: 7.4 - <<: *psalm - name: Psalm (PHP 7.2) - php: 7.2 + name: Psalm (PHP 7.3) + php: 7.3 - <<: *unit_tests name: Unit Tests (PHP 7.4, highest) php: 7.4 @@ -71,13 +65,10 @@ jobs: name: Unit Tests (PHP 7.3, highest) php: 7.3 - <<: *unit_tests - name: Unit Tests (PHP 7.2, highest) - php: 7.2 + name: Unit Tests (PHP 7.4, lowest) + php: 7.4 + env: dependencies=lowest - <<: *unit_tests name: Unit Tests (PHP 7.3, lowest) php: 7.3 env: dependencies=lowest - - <<: *unit_tests - name: Unit Tests (PHP 7.2, lowest) - php: 7.2 - env: dependencies=lowest diff --git a/CHANGELOG.md b/CHANGELOG.md index 9bf7479..9e4bf4b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,17 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## 0.2.0 + +### Changed + +* Support Twig v3 only + +### Removed + +* Support PHP 7.2 +* Support Twig v2 + ## 0.1.0 ### Added diff --git a/composer.json b/composer.json index 538be72..f955fff 100644 --- a/composer.json +++ b/composer.json @@ -23,8 +23,8 @@ } ], "require": { - "php": ">=7.2", - "twig/twig": "^2.0", + "php": ">=7.3", + "twig/twig": "^3.0", "phpdocumentor/reflection-docblock": "^4.3" }, "require-dev": { diff --git a/src/Describer/FilterDescriber.php b/src/Describer/FilterDescriber.php index 5f37f43..176f429 100644 --- a/src/Describer/FilterDescriber.php +++ b/src/Describer/FilterDescriber.php @@ -18,8 +18,8 @@ final class FilterDescriber extends AbstractDescriber { public function describe(TwigFilter $filter): FilterDescription { - $skipParameters = $filter->needsContext() + $filter->needsEnvironment(); - $description = $this->describeCallable(new FilterDescription($filter->getName()), $filter->getCallable(), $skipParameters); + $numberOfSkippedParameters = intval($filter->needsContext()) + intval($filter->needsEnvironment()); + $description = $this->describeCallable(new FilterDescription($filter->getName()), $filter->getCallable(), $numberOfSkippedParameters); assert($description instanceof FilterDescription); return $description; diff --git a/src/Describer/FunctionDescriber.php b/src/Describer/FunctionDescriber.php index 3021fd2..92b9a05 100644 --- a/src/Describer/FunctionDescriber.php +++ b/src/Describer/FunctionDescriber.php @@ -18,8 +18,8 @@ final class FunctionDescriber extends AbstractDescriber { public function describe(TwigFunction $function): FunctionDescription { - $skipParameters = $function->needsContext() + $function->needsEnvironment(); - $description = $this->describeCallable(new FunctionDescription($function->getName()), $function->getCallable(), $skipParameters); + $numberOfSkippedParameters = intval($function->needsContext()) + intval($function->needsEnvironment()); + $description = $this->describeCallable(new FunctionDescription($function->getName()), $function->getCallable(), $numberOfSkippedParameters); assert($description instanceof FunctionDescription); return $description;