Skip to content

Commit da604d6

Browse files
Fix Terminus for PHP 5.5, 5.6, and 7.0 (#2264)
* Test on PHP 5.5, 5.6, and 7.0 * Remove return typehint for compatibility with older versions of PHP * Fix plugin discovery for PHP 5.5 * Reformat const strings for compatibility with older versions of php. * Disable long line checks in code lint * Update to newer version of consolidation/self-update * Moar string changes for old PHP versions * Update README with supported PHP versions
1 parent 448f49a commit da604d6

File tree

7 files changed

+17
-28
lines changed

7 files changed

+17
-28
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
strategy:
5454
matrix:
5555
operating-system: ['ubuntu-latest', 'macos-latest']
56-
php-versions: ['7.2', '7.3', '7.4']
56+
php-versions: ['5.5', '5.6', '7.0', '7.2', '7.3', '7.4']
5757
env:
5858
TERMINUS_TOKEN: ${{ secrets.TERMINUS_TOKEN }}
5959
TERMINUS_WP_SITE: ${{ secrets.TERMINUS_WP_SITE }}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Our documentation is kept in the Terminus Manual, located here: https://pantheon
1717
## Dependencies
1818
### Required
1919
- A command-line client
20-
- PHP version 5.6.40 or later recommended (5.5.38 minimum)
20+
- PHP version 7.2 or later recommended. Any 7.x version, plus 5.6.40 and 5.5.38 are supported. Upgrade to Terminus 3 for PHP 8 support.
2121
- [PHP-CLI](https://www.php-cli.com/)
2222
- [PHP-CURL](https://php.net/manual/curl.setup.php)
2323
- [PHP-XML](https://php.net/manual/book.xml.php)

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"cbf": "phpcbf --standard=tests/config/linting_ruleset.xml tests/unit_tests/* bin/terminus src/*",
4949
"clover": "phpunit -c tests/config/phpunit.xml.dist --coverage-clover tests/logs/clover.xml",
5050
"coveralls": "php vendor/bin/php-coveralls -v -c tests/config/coveralls.yml",
51-
"cs": "phpcs --standard=tests/config/linting_ruleset.xml tests/unit_tests bin/terminus src",
51+
"cs": "phpcs --standard=tests/config/linting_ruleset.xml --exclude=Generic.Files.LineLength tests/unit_tests bin/terminus src",
5252
"docs": "php scripts/make-docs.php",
5353
"lint": "@cs",
5454
"phpunit": "SHELL_INTERACTIVE=true phpunit --colors=always -c tests/config/phpunit.xml.dist --debug",

composer.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Models/Environment.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ public function databaseConnectionInfo()
292292
*
293293
* @return \Pantheon\Terminus\Models\Binding|null
294294
*/
295-
private function getBinding(array $bindings): ?Binding
295+
private function getBinding(array $bindings)
296296
{
297297
foreach ($bindings as $binding) {
298298
if (!$binding instanceof Binding) {

src/Plugins/PluginDiscovery.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,6 @@ class PluginDiscovery implements LoggerAwareInterface
1515
{
1616
use LoggerAwareTrait;
1717

18-
/**
19-
* List of all Terminus plugins that have been rolled into Terminus core.
20-
*/
21-
const BLACKLIST = [
22-
'pantheon-systems/terminus-aliases-plugin'
23-
];
24-
2518
/**
2619
* @var string The path to the directory to search for plugins.
2720
*/
@@ -44,6 +37,9 @@ public function __construct($path)
4437
*/
4538
public function discover()
4639
{
40+
$blacklist = [
41+
'pantheon-systems/terminus-aliases-plugin'
42+
];
4743
$out = [];
4844
try {
4945
$di = new \DirectoryIterator($this->directory_path);
@@ -56,7 +52,7 @@ public function discover()
5652
if ($dir->isDir() && !$dir->isDot() && $dir->isReadable()) {
5753
try {
5854
$plugin = new PluginInfo($dir->getPathname());
59-
if (!in_array($plugin->getName(), self::BLACKLIST)) {
55+
if (!in_array($plugin->getName(), $blacklist)) {
6056
$out[] = $plugin;
6157
}
6258
} catch (TerminusException $e) {

src/Update/UpdateChecker.php

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,9 @@ class UpdateChecker implements
2929
use LoggerAwareTrait;
3030

3131
const DEFAULT_COLOR = "\e[0m";
32-
const UPDATE_COMMAND = 'You can update Terminus by running `composer update` or using the Terminus installer:'
33-
. PHP_EOL
34-
. 'curl -O https://raw.githubusercontent.com/pantheon-systems/terminus-installer/master/builds/installer.phar '
35-
. '&& php installer.phar update';
36-
const UPDATE_COMMAND_PHAR = 'You can update Terminus by running:' . PHP_EOL . 'terminus self:update';
37-
const UPDATE_NOTICE = 'A new Terminus version v{latest_version} is available.'
38-
. PHP_EOL
39-
. 'You are currently using version v{running_version}.'
40-
. PHP_EOL
41-
. '{update_command}';
32+
const UPDATE_COMMAND = "You can update Terminus by running `composer update` or using the Terminus installer:\ncurl -O https://raw.githubusercontent.com/pantheon-systems/terminus-installer/master/builds/installer.phar && php installer.phar update";
33+
const UPDATE_COMMAND_PHAR = "You can update Terminus by running:\nterminus self:update";
34+
const UPDATE_NOTICE = "A new Terminus version v{latest_version} is available.\nYou are currently using version v{running_version}.\n{update_command}";
4235
const UPDATE_NOTICE_COLOR = "\e[38;5;33m";
4336
const UPDATE_VARS_COLOR = "\e[38;5;45m";
4437

0 commit comments

Comments
 (0)