Skip to content

Commit 4dcf7f4

Browse files
Merge pull request #82 from VincentLanglet/symfony5
🔧 Allow symfony 5
2 parents ae56751 + 6665c88 commit 4dcf7f4

File tree

5 files changed

+174
-163
lines changed

5 files changed

+174
-163
lines changed

.circleci/config.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,42 @@ 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
1010

11+
commands:
12+
start:
13+
steps:
14+
- checkout
15+
- run: sudo apt-get update
16+
- run: sudo apt-get install -y ant
17+
1118
jobs:
1219
test:
1320
executor: php
1421
steps:
15-
- checkout
22+
- start
1623
- restore_cache:
1724
keys:
1825
- v1-dependencies-{{ checksum "composer.lock" }}
1926
- v1-dependencies-
20-
- run: sudo apt-get update
21-
- run: sudo apt-get install -y ant
2227
- run: ant test
2328
- save_cache:
2429
paths:
2530
- vendor
2631
key: v1-dependencies-{{ checksum "composer.lock" }}
32+
lowest:
33+
executor: php
34+
steps:
35+
- start
36+
- run: composer update --prefer-lowest
37+
- run: ant phpunit
2738

2839
workflows:
2940
version: 2
3041
check:
3142
jobs:
3243
- test
44+
- lowest

SymfonyCustom/Sniffs/Namespaces/UnusedUseSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public function process(File $phpcsFile, $stackPtr)
135135
// Handle comment tag as @Route(..) or @ORM\Id
136136
if (preg_match('/^@'.$lowerClassName.'(?![a-zA-Z])/i', $token['content']) === 1) {
137137
return;
138-
};
138+
}
139139
}
140140

141141
// Check for @param Truc or @return Machin

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: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
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",
25-
"twig/twig": "^2.0 || ^3.0"
22+
"symfony/console": "^3.4 || ^4.3 || ^5.0",
23+
"symfony/finder": "^3.4 || ^4.3 || ^5.0",
24+
"symfony/twig-bridge": "^3.4 || ^4.3 || ^5.0",
25+
"twig/twig": "^2.7 || ^3.0"
2626
},
2727
"require-dev": {
2828
"phpunit/phpunit": "^7.0"

0 commit comments

Comments
 (0)