Skip to content

Commit 00b4fa3

Browse files
committed
Downgrade requirements from PHP 5.6 to 5.4 (#191)
Backported from 3.0
1 parent 4a60e8b commit 00b4fa3

File tree

5 files changed

+48
-11
lines changed

5 files changed

+48
-11
lines changed

.circleci/config.yml

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
version: 2
22
jobs:
3-
build_php7:
3+
build_php7.4:
4+
docker:
5+
- image: circleci/php:7.4.6
6+
steps:
7+
- checkout
8+
- run: COMPOSER=composer.json composer install
9+
- run: COMPOSER=composer.json composer test
10+
- run: COMPOSER=composer.json composer phpstan
11+
- run: COMPOSER=composer.json composer lint
12+
build_php7.3:
413
docker:
514
- image: circleci/php:7.3.1
615
steps:
@@ -9,16 +18,42 @@ jobs:
918
- run: COMPOSER=composer.json composer test
1019
- run: COMPOSER=composer.json composer phpstan
1120
- run: COMPOSER=composer.json composer lint
12-
build_php5:
21+
build_php5.6:
1322
docker:
1423
- image: circleci/php:5.6.40-zts-stretch-node-browsers-legacy
1524
steps:
1625
- checkout
1726
- run: COMPOSER=composer.circleci.json composer install
1827
- run: COMPOSER=composer.circleci.json composer test
28+
build_php5.4:
29+
docker:
30+
- image: lavoweb/php-5.4
31+
steps:
32+
- run:
33+
name: PHP version check
34+
command: php --version
35+
- run:
36+
name: Install system packages
37+
command: apt-get update && apt-get -y install git
38+
- checkout
39+
- run:
40+
name: Install composer
41+
command: |
42+
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
43+
php -r "if (hash_file('SHA384', 'composer-setup.php') === trim(file_get_contents('https://composer.github.io/installer.sig'))) { echo 'Installer verified'; } else { echo 'Installer invalid'; unlink('composer-setup.php'); } echo PHP_EOL;"
44+
php composer-setup.php
45+
php -r "unlink('composer-setup.php');"
46+
- run:
47+
name: Install dependencies
48+
command: COMPOSER=composer.circleci.json php composer.phar install
49+
- run:
50+
name: Run tests
51+
command: COMPOSER=composer.circleci.json php composer.phar test
1952
workflows:
2053
version: 2
2154
build_php_versions:
2255
jobs:
23-
- build_php5
24-
- build_php7
56+
- build_php5.4
57+
- build_php5.6
58+
- build_php7.3
59+
- build_php7.4

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ Plugin for PHP_CodeSniffer static analysis tool that adds analysis of problemati
1212

1313
### Requirements
1414

15-
VariableAnalysis requires PHP 5.6 or higher and [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) version **3.1.0** or higher.
15+
VariableAnalysis requires PHP 5.4 or higher and [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) version 3.1.0 or higher.
16+
1617

1718
### With PHPCS Composer Installer
1819

@@ -94,7 +95,7 @@ This was forked from the excellent work in https://github.com/illusori/PHP_Codes
9495

9596
Please open issues or PRs on this repository.
9697

97-
Any changes should be accompanied by tests and should pass linting and static analysis. Please use phpdoc (rather than actual types) for declaring types since this must run in PHP 5.6.
98+
Any changes should be accompanied by tests and should pass linting and static analysis. Please use phpdoc (rather than actual types) for declaring types since this must run in PHP 5.4.
9899

99100
To run tests, make sure composer is installed, then run:
100101

Tests/BaseTestCase.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,16 @@
88

99
class BaseTestCase extends TestCase {
1010
const STANDARD_NAME = 'VariableAnalysis';
11-
const SNIFF_FILE = __DIR__ . '/../VariableAnalysis/Sniffs/CodeAnalysis/VariableAnalysisSniff.php';
1211

1312
public function prepareLocalFileForSniffs($fixtureFile) {
13+
$sniffFile = __DIR__ . '/../VariableAnalysis/Sniffs/CodeAnalysis/VariableAnalysisSniff.php';
14+
1415
$config = new Config();
1516
$config->cache = false;
1617
$config->standards = [self::STANDARD_NAME];
1718
$config->ignored = [];
1819

19-
$sniffFiles = [realpath(self::SNIFF_FILE)];
20+
$sniffFiles = [realpath($sniffFile)];
2021
$ruleset = new Ruleset($config);
2122
$ruleset->registerSniffs($sniffFiles, [], []);
2223
$ruleset->populateTokenListeners();

composer.circleci.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@
3737
"test": "./vendor/bin/phpunit --configuration phpunit.circleci.xml"
3838
},
3939
"require" : {
40-
"php" : ">=5.6.0",
40+
"php" : ">=5.4.0",
4141
"squizlabs/php_codesniffer": "^3.1"
4242
},
4343
"require-dev": {
44-
"phpunit/phpunit": "^5.0 || ^6.5 || ^7.0 || ^8.0"
44+
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.5 || ^7.0 || ^8.0"
4545
}
4646
}

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"phpstan": "./vendor/bin/phpstan analyse"
4040
},
4141
"require" : {
42-
"php" : ">=5.6.0",
42+
"php" : ">=5.4.0",
4343
"squizlabs/php_codesniffer": "^3.1"
4444
},
4545
"require-dev": {

0 commit comments

Comments
 (0)