Skip to content

Commit 16e2738

Browse files
🔧 Allow symfony 5
1 parent ae56751 commit 16e2738

File tree

4 files changed

+166
-158
lines changed

4 files changed

+166
-158
lines changed

.circleci/config.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version: 2.1
33
executors:
44
php:
55
docker:
6-
- image: circleci/php:7.1
6+
- image: circleci/php:7.2
77
environment:
88
TZ: '/usr/share/zoneinfo/Europe/Paris'
99
working_directory: ~/Symfony-custom-coding-standard
@@ -24,9 +24,18 @@ jobs:
2424
paths:
2525
- vendor
2626
key: v1-dependencies-{{ checksum "composer.lock" }}
27+
lowest:
28+
executor: php
29+
steps:
30+
- checkout
31+
- run: sudo apt-get update
32+
- run: sudo apt-get install -y ant
33+
- composer update --prefer-lowest
34+
- run: ant phpunit
2735

2836
workflows:
2937
version: 2
3038
check:
3139
jobs:
3240
- test
41+
- lowest

TwigCS/Environment/StubbedEnvironment.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,20 @@ public function __construct()
4444
$this->addTokenParser(new DumpTokenParser());
4545
$this->addTokenParser(new FormThemeTokenParser());
4646
$this->addTokenParser(new StopwatchTokenParser(false));
47-
$this->addTokenParser(new TransChoiceTokenParser());
4847
$this->addTokenParser(new TransDefaultDomainTokenParser());
4948
$this->addTokenParser(new TransTokenParser());
49+
50+
if (class_exists(TransChoiceTokenParser::class)) {
51+
$this->addTokenParser(new TransChoiceTokenParser());
52+
}
5053
}
5154

5255
/**
5356
* @param string $name
5457
*
5558
* @return TwigFilter
5659
*/
57-
public function getFilter($name)
60+
public function getFilter($name): ?TwigFilter
5861
{
5962
if (!isset($this->stubFilters[$name])) {
6063
$this->stubFilters[$name] = new TwigFilter('stub');
@@ -68,7 +71,7 @@ public function getFilter($name)
6871
*
6972
* @return TwigFunction
7073
*/
71-
public function getFunction($name)
74+
public function getFunction($name): ?TwigFunction
7275
{
7376
if (!isset($this->stubFunctions[$name])) {
7477
$this->stubFunctions[$name] = new TwigFunction('stub');
@@ -82,7 +85,7 @@ public function getFunction($name)
8285
*
8386
* @return TwigTest
8487
*/
85-
public function getTest($name)
88+
public function getTest($name): ?TwigTest
8689
{
8790
if (!isset($this->stubTests[$name])) {
8891
$this->stubTests[$name] = new TwigTest('stub');

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
],
1818
"bin": ["bin/twigcs"],
1919
"require": {
20-
"php": ">=7.1",
20+
"php": ">=7.2",
2121
"squizlabs/php_codesniffer": "3.5.*",
22-
"symfony/console": "^3.0 || ^4.0",
23-
"symfony/finder": "^3.0 || ^4.0",
24-
"symfony/twig-bridge": "^3.0 || ^4.0",
22+
"symfony/console": "^3.0 || ^4.0 || ^5.0",
23+
"symfony/finder": "^3.0 || ^4.0 || ^5.0",
24+
"symfony/twig-bridge": "^3.0 || ^4.0 || ^5.0",
2525
"twig/twig": "^2.0 || ^3.0"
2626
},
2727
"require-dev": {

0 commit comments

Comments
 (0)