Skip to content

Commit 228d9d7

Browse files
committed
Change minimum PHP to 7.2.5
1 parent 6555461 commit 228d9d7

17 files changed

+23
-228
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,19 @@ jobs:
1616
strategy:
1717
matrix:
1818
php-version:
19-
- '5.3'
20-
- '5.4'
21-
- '5.5'
22-
- '5.6'
23-
- '7.0'
24-
- '7.1'
25-
- '7.2'
26-
- '7.3'
27-
- '7.4'
28-
- '8.0'
29-
- '8.1'
19+
- "7.2"
20+
- "7.3"
21+
- "7.4"
22+
- "8.0"
23+
- "8.1"
3024
os: [ubuntu-latest]
3125
include:
32-
- php-version: '5.3'
26+
- php-version: "7.2"
3327
os: windows-latest
34-
- php-version: '8.1'
28+
- php-version: "8.1"
3529
os: windows-latest
30+
- php-version: "8.2"
31+
os: ubuntu-latest
3632

3733
steps:
3834
- name: Checkout
@@ -44,11 +40,6 @@ jobs:
4440
coverage: none
4541
php-version: ${{ matrix.php-version }}
4642

47-
- name: Remove PHPStan if unsupported
48-
# Do this first to diffentiate cache keys
49-
if: ${{ matrix.php-version < '7.1' }}
50-
run: composer remove phpstan/phpstan phpstan/phpstan-strict-rules --dev --no-update
51-
5243
- name: Get composer cache directory
5344
id: composercache
5445
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

.github/workflows/lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ jobs:
1313
strategy:
1414
matrix:
1515
php-version:
16-
- '5.3'
17-
- '8.1'
16+
- "7.2"
17+
- "latest"
1818

1919
steps:
2020
- name: Checkout

.github/workflows/phpstan.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
strategy:
1717
matrix:
1818
php-version:
19-
- '8.1'
19+
- "8.1"
2020

2121
steps:
2222
- name: Checkout

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@
1818
"issues": "https://github.com/composer/xdebug-handler/issues"
1919
},
2020
"require": {
21-
"php": "^5.3.2 || ^7.0 || ^8.0",
21+
"php": "^7.2.5 || ^8.0",
2222
"psr/log": "^1 || ^2 || ^3",
2323
"composer/pcre": "^1"
2424
},
2525
"require-dev": {
26-
"symfony/phpunit-bridge": "^4.2 || ^5.0 || ^6.0",
26+
"symfony/phpunit-bridge": "^6.0",
2727
"phpstan/phpstan": "^1.0",
2828
"phpstan/phpstan-strict-rules": "^1.1"
2929
},
@@ -38,7 +38,7 @@
3838
}
3939
},
4040
"scripts": {
41-
"test": "vendor/bin/simple-phpunit",
42-
"phpstan": "vendor/bin/phpstan analyse"
41+
"test": "@php vendor/bin/simple-phpunit",
42+
"phpstan": "@php vendor/bin/phpstan analyse"
4343
}
4444
}

phpstan.neon.dist

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,8 @@ parameters:
88
paths:
99
- src
1010
- tests
11-
excludePaths:
12-
- tests/Helpers/LegacyLogger.php
1311
ignoreErrors:
1412
# strict-rules errors
1513
- message: "#^Call to function is_string\\(\\) with string will always evaluate to true.#"
1614
count: 1
1715
path: src/XdebugHandler.php
18-
19-
- message: "#^Call to function method_exists\\(\\) with .* and 'expectException' will always evaluate to true.#"
20-
count: 1
21-
path: tests/ClassTest.php

phpunit.xml.dist

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,9 @@
99
stopOnFailure="false"
1010
bootstrap="vendor/autoload.php"
1111
>
12-
<php>
13-
<ini name="date.timezone" value="UTC" />
14-
</php>
15-
1612
<testsuites>
1713
<testsuite name="XdebugHandler Test Suite">
1814
<directory>tests</directory>
1915
</testsuite>
2016
</testsuites>
21-
22-
<filter>
23-
<whitelist>
24-
<directory>src</directory>
25-
</whitelist>
26-
</filter>
2717
</phpunit>

src/XdebugHandler.php

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -367,12 +367,8 @@ private function prepareRestart()
367367

368368
if (!$this->cli) {
369369
$error = 'Unsupported SAPI: '.PHP_SAPI;
370-
} elseif (!defined('PHP_BINARY')) {
371-
$error = 'PHP version is too old: '.PHP_VERSION;
372370
} elseif (!$this->checkConfiguration($info)) {
373371
$error = $info;
374-
} elseif (!$this->checkScanDirConfig()) {
375-
$error = 'PHP version does not report scanned inis: '.PHP_VERSION;
376372
} elseif (!$this->checkMainScript()) {
377373
$error = 'Unable to access main script: '.$this->script;
378374
} elseif (!$this->writeTmpIni($iniFiles, $tmpDir, $error)) {
@@ -610,24 +606,6 @@ private function syncSettings(array $settings)
610606
$this->notify(Status::INFO, 'Process called with existing restart settings');
611607
}
612608

613-
/**
614-
* Returns true if there are scanned inis and PHP is able to report them
615-
*
616-
* php_ini_scanned_files will fail when PHP_CONFIG_FILE_SCAN_DIR is empty.
617-
* Fixed in 7.1.13 and 7.2.1
618-
*
619-
* @return bool
620-
*/
621-
private function checkScanDirConfig()
622-
{
623-
if (PHP_VERSION_ID >= 70113 && PHP_VERSION_ID !== 70200) {
624-
return true;
625-
}
626-
627-
return ((string) getenv('PHP_INI_SCAN_DIR') === '')
628-
|| PHP_CONFIG_FILE_SCAN_DIR !== '';
629-
}
630-
631609
/**
632610
* Returns true if there are no known configuration issues
633611
*

tests/ClassTest.php

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
namespace Composer\XdebugHandler\Tests;
1313

1414
use Composer\XdebugHandler\Tests\Helpers\BaseTestCase;
15-
use Composer\XdebugHandler\Tests\Helpers\LoggerFactory;
15+
use Composer\XdebugHandler\Tests\Helpers\Logger;
1616
use Composer\XdebugHandler\XdebugHandler;
1717

1818
class ClassTest extends BaseTestCase
@@ -22,7 +22,7 @@ class ClassTest extends BaseTestCase
2222
*/
2323
public function testConstructorThrowsOnEmptyEnvPrefix()
2424
{
25-
$this->setException('RuntimeException');
25+
$this->expectException('RuntimeException');
2626
new XdebugHandler('');
2727
}
2828

@@ -31,7 +31,7 @@ public function testConstructorThrowsOnEmptyEnvPrefix()
3131
*/
3232
public function testConstructorThrowsOnInvalidEnvPrefix()
3333
{
34-
$this->setException('RuntimeException');
34+
$this->expectException('RuntimeException');
3535
/** @phpstan-ignore-next-line */
3636
new XdebugHandler(array('name'));
3737
}
@@ -59,7 +59,7 @@ public function setterProvider()
5959
{
6060
// $setter, $value
6161
return array(
62-
'setLogger' => array('setLogger', LoggerFactory::createLogger()),
62+
'setLogger' => array('setLogger', new Logger()),
6363
'setMainScript' => array('setMainScript', '--'),
6464
'setPersistent' => array('setPersistent', null),
6565
);
@@ -68,8 +68,7 @@ public function setterProvider()
6868
/**
6969
* Test compatibility with 1.x for extending classes
7070
*
71-
* @requires PHP 7.1
72-
* @dataProvider methodProvider *
71+
* @dataProvider methodProvider
7372
* @param string $method
7473
*
7574
* @return void
@@ -94,20 +93,4 @@ public function methodProvider()
9493
array('restart'),
9594
);
9695
}
97-
98-
/**
99-
* @param string $exception
100-
* @phpstan-param class-string<\Exception> $exception
101-
*
102-
* @return void
103-
*/
104-
private function setException($exception)
105-
{
106-
if (method_exists($this, 'expectException')) {
107-
$this->expectException($exception);
108-
} else {
109-
/** @phpstan-ignore-next-line */
110-
$this->setExpectedException($exception);
111-
}
112-
}
11396
}

tests/EnvironmentTest.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@
1616
use Composer\XdebugHandler\Tests\Mocks\PartialMock;
1717

1818
/**
19-
* We use PHP_BINARY which only became available in PHP 5.4
20-
*
21-
* @requires PHP 5.4
2219
* @phpstan-import-type envTestData from EnvHelper
2320
*/
2421
class EnvironmentTest extends BaseTestCase
@@ -37,10 +34,6 @@ class EnvironmentTest extends BaseTestCase
3734
*/
3835
public function testEnvAllowBeforeRestart($iniFunc, $scanDir, $phprc)
3936
{
40-
if (($message = EnvHelper::shouldSkipTest($scanDir)) !== null) {
41-
self::markTestSkipped($message);
42-
}
43-
4437
$ini = EnvHelper::setInis($iniFunc, $scanDir, $phprc);
4538
$loaded = true;
4639

@@ -81,10 +74,6 @@ public function envAllowBeforeProvider()
8174
*/
8275
public function testEnvironmentBeforeRestart($iniFunc, $scanDir, $phprc, $standard)
8376
{
84-
if (($message = EnvHelper::shouldSkipTest($scanDir)) !== null) {
85-
self::markTestSkipped($message);
86-
}
87-
8877
$ini = EnvHelper::setInis($iniFunc, $scanDir, $phprc);
8978
$loaded = true;
9079

tests/Helpers/EnvHelper.php

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -56,42 +56,4 @@ public static function dataProvider()
5656
'scanned dir false' => array('setScannedInis', $scanDir, false),
5757
);
5858
}
59-
60-
/**
61-
* Checks if php_ini_scanned_files is supported.
62-
*
63-
* The process will not be restarted if there are scanned inis but PHP
64-
* is unable to list them. See https://bugs.php.net/73124
65-
*
66-
* This method tests the behaviour of XdebugHandler::checkScanDirConfig by
67-
* checking each requirement separately.
68-
*
69-
* @param mixed $scanDir Initial value for PHP_INI_SCAN_DIR
70-
*
71-
* @return null|string The skip message
72-
*/
73-
public static function shouldSkipTest($scanDir)
74-
{
75-
// Not relevant if no scan dir or it has been overriden
76-
if ($scanDir === false || $scanDir === '') {
77-
return null;
78-
}
79-
80-
// Not relevant if --with-config-file-scan-dir was used
81-
if (PHP_CONFIG_FILE_SCAN_DIR !== '') {
82-
return null;
83-
}
84-
85-
// Bug fixed in 7.1.13
86-
if (PHP_VERSION_ID >= 70113 && PHP_VERSION_ID < 70200) {
87-
return null;
88-
}
89-
90-
// Bug fixed in 7.2.1
91-
if (PHP_VERSION_ID >= 70201) {
92-
return null;
93-
}
94-
95-
return 'php_ini_scanned_files not functional on '.PHP_VERSION;
96-
}
9759
}

0 commit comments

Comments
 (0)