Skip to content

Commit 00d3158

Browse files
authored
Downgrade circleci image to PHP 5.6 (#86)
1 parent a31046c commit 00d3158

File tree

6 files changed

+61
-6
lines changed

6 files changed

+61
-6
lines changed

.circleci/config.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ version: 2
22
jobs:
33
build:
44
docker:
5-
- image: circleci/php:7.0-apache-stretch-node-browsers
5+
- image: circleci/php:5.6.40-zts-stretch-node-browsers-legacy
66
steps:
77
- checkout
8-
- run: composer install
9-
- run: composer test
8+
- run: COMPOSER=composer.circleci.json composer install
9+
- run: COMPOSER=composer.circleci.json composer test

VariableAnalysis/Sniffs/CodeAnalysis/VariableAnalysisSniff.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1059,7 +1059,12 @@ protected function processScopeCloseForVariable($phpcsFile, $varInfo, $scopeInfo
10591059
// the purposes of "unused variable" warnings.
10601060
return;
10611061
}
1062-
$stackPtr = $varInfo->firstDeclared ?? $varInfo->firstInitialized ?? null;
1062+
$stackPtr = null;
1063+
if (!empty($varInfo->firstDeclared)) {
1064+
$stackPtr = $varInfo->firstDeclared;
1065+
} elseif (!empty($varInfo->firstInitialized)) {
1066+
$stackPtr = $varInfo->firstInitialized;
1067+
}
10631068
if ($stackPtr) {
10641069
Helpers::debug("variable {$varInfo->name} at end of scope looks undefined");
10651070
$phpcsFile->addWarning(

VariableAnalysis/Tests/BaseTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
class BaseTestCase extends TestCase {
1010
public function prepareLocalFileForSniffs($sniffFiles, $fixtureFile) {
11-
$config = new Config();
11+
$config = new Config(['--standard=VariableAnalysis']);
1212
$ruleset = new Ruleset($config);
1313
if (! is_array($sniffFiles)) {
1414
$sniffFiles = [$sniffFiles];

composer.circleci.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"name": "sirbrillig/phpcs-variable-analysis",
3+
"description": "A PHPCS sniff to detect problems with variables.",
4+
"type": "phpcodesniffer-standard",
5+
"license": "BSD-2-Clause",
6+
"authors": [
7+
{
8+
"name": "Sam Graham",
9+
"email": "[email protected]"
10+
},
11+
{
12+
"name": "Payton Swick",
13+
"email": "[email protected]"
14+
}
15+
],
16+
"support" : {
17+
"issues": "https://github.com/sirbrillig/phpcs-variable-analysis/issues",
18+
"wiki" : "https://github.com/sirbrillig/phpcs-variable-analysis/wiki",
19+
"source": "https://github.com/sirbrillig/phpcs-variable-analysis"
20+
},
21+
"config": {
22+
"sort-order": true
23+
},
24+
"autoload": {
25+
"psr-4": {
26+
"VariableAnalysis\\": "VariableAnalysis/"
27+
}
28+
},
29+
"minimum-stability": "dev",
30+
"prefer-stable": true,
31+
"scripts": {
32+
"test": "./vendor/bin/phpunit --configuration phpunit.circleci.xml"
33+
},
34+
"require" : {
35+
"php" : ">=5.6.0"
36+
},
37+
"require-dev": {
38+
"phpunit/phpunit": "^5.0",
39+
"squizlabs/php_codesniffer": "^3.1"
40+
}
41+
}

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"lint": "./vendor/bin/phpcs -s -p VariableAnalysis/Sniffs VariableAnalysis/Lib"
3434
},
3535
"require" : {
36-
"php" : ">=5.4.0"
36+
"php" : ">=5.6.0"
3737
},
3838
"require-dev": {
3939
"dealerdirect/phpcodesniffer-composer-installer": "^0.4.4",

phpunit.circleci.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<phpunit
2+
bootstrap="VariableAnalysis/Tests/bootstrap.php"
3+
>
4+
<testsuites>
5+
<testsuite>
6+
<directory>VariableAnalysis/Tests</directory>
7+
</testsuite>
8+
</testsuites>
9+
</phpunit>

0 commit comments

Comments
 (0)