Skip to content

Commit

Permalink
Revert "[CMS-459] Add php 8.1 support (#2284)"
Browse files Browse the repository at this point in the history
This reverts commit 6584f0a.
  • Loading branch information
greg-1-anderson committed Dec 18, 2021
1 parent 6584f0a commit e7b3c4a
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 44 deletions.
17 changes: 2 additions & 15 deletions .github/workflows/3x.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
name: Terminus 3.x
on:
push:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
inputs:
functional_tests_all:
description: Run all functional tests
required: true
default: '1'
on: push
jobs:
# Checkout in separate job because docker image is alpine based and checkout action doesn't work.
checkout_build:
Expand Down Expand Up @@ -46,7 +37,7 @@ jobs:
strategy:
matrix:
operating-system: [ 'macos-latest' ]
php-versions: [ '8.0', '8.1' ]
php-versions: [ '8.0' ]
max-parallel: 1
env:
TERMINUS_TOKEN: ${{ secrets.TERMINUS_TOKEN }}
Expand Down Expand Up @@ -75,11 +66,7 @@ jobs:
- name: Install Composer Dependencies
run: composer install --no-interaction --prefer-dist
- name: Functional Tests (short)
if: ${{ github.event_name == 'push' }}
run: composer test:short
- name: Functional Tests (long)
if: ${{ github.event_name == 'schedule' || github.event.inputs.functional_tests_all == '1' }}
run: composer test:long
- name: Coverage Report
run: composer coverage
- name: Save coverage as artifact
Expand Down
11 changes: 9 additions & 2 deletions bin/terminus
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,15 @@ if (version_compare(PHP_VERSION, '7.4.0', '<') === true) {
echo 'Upgrade to PHP 7.4 or newer to use Terminus 3. For PHP versions prior to 7.4, downgrade to Terminus 2.x.'; echo "\n\n";
exit(1);
} elseif (version_compare(PHP_VERSION, '8.1.0', '>=') === true) {
// Prevent outputting PHP deprecation messages produced by vendors.
error_reporting(error_reporting() & ~E_DEPRECATED);
echo "\n";
echo 'PHP 8.1+ is not supported by this version of Terminus.' . "\n";
echo 'Check for new versions at https://github.com/pantheon-systems/terminus/releases' . "\n";
echo "\n";
if (!getenv('TERMINUS_ALLOW_UNSUPPORTED_NEWER_PHP')) {
echo 'Set environment variable TERMINUS_ALLOW_UNSUPPORTED_NEWER_PHP to try continuing anyway.' . "\n";
echo "Stopping.\n\n";
exit(1);
}
}

// This variable is automatically managed via updateDependenciesversion() in /RoboFile.php,
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
"SHELL_INTERACTIVE=true TERMINUS_TEST_MODE=1 behat --colors --config tests/config/behat.yml --stop-on-failure --suite=default"
],
"test:short": [
"XDEBUG_MODE=coverage vendor/bin/phpunit --colors=always -c ./phpunit.xml --debug --group=short --do-not-cache-result --verbose --stop-on-failure"
"XDEBUG_MODE=coverage vendor/bin/phpunit --colors=always -c ./phpunit.xml --debug --group=short --do-not-cache-result --verbose"
],
"test:long": [
"XDEBUG_MODE=coverage vendor/bin/phpunit --colors=always -c ./phpunit.xml --debug --group=long --do-not-cache-result --verbose"
Expand Down
2 changes: 1 addition & 1 deletion src/Collections/OrganizationOwnedCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ public function __construct($options = [])
public function getUrl()
{
// Replace the {organization_id} token with the actual organization id.
return str_replace('{organization_id}', $this->getOrganization()->id ?? '', parent::getUrl());
return str_replace('{organization_id}', $this->getOrganization()->id, parent::getUrl());
}
}
2 changes: 1 addition & 1 deletion src/Collections/SiteOwnedCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ public function __construct($options = [])
*/
public function getUrl()
{
return str_replace('{site_id}', $this->getSite()->id ?? '', parent::getUrl());
return str_replace('{site_id}', $this->getSite()->id, parent::getUrl());
}
}
2 changes: 1 addition & 1 deletion src/Collections/UserOwnedCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ public function __construct($options = [])
public function getUrl()
{
// Replace the {user_id} token with the actual user id.
return str_replace('{user_id}', $this->getUser()->id ?? '', parent::getUrl());
return str_replace('{user_id}', $this->getUser()->id, parent::getUrl());
}
}
2 changes: 1 addition & 1 deletion src/Friends/SiteTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function getSite()
*/
public function getUrl()
{
return str_replace('{site_id}', $this->getSite()->id ?? '', parent::getUrl());
return str_replace('{site_id}', $this->getSite()->id, parent::getUrl());
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Helpers/LocalMachineHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class LocalMachineHelper implements ConfigAwareInterface, ContainerAwareInterfac
use ContainerAwareTrait;
use IO;
use CommandExecutorTrait {
CommandExecutorTrait::execute as executeUnbuffered;
execute as executeUnbuffered;
}

/**
Expand Down Expand Up @@ -165,7 +165,7 @@ public function writeFile($filename, $content)
protected function fixFilename($filename)
{
$config = $this->getConfig();
return $config->fixDirectorySeparators(str_replace('~', $config->get('user_home') ?? '', $filename));
return $config->fixDirectorySeparators(str_replace('~', $config->get('user_home'), $filename));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Models/TerminusModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public function getReferences()
*/
public function getUrl()
{
return str_replace('{id}', $this->id ?? '', $this->url);
return str_replace('{id}', $this->id, $this->url);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Plugins/PluginInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public function getLatestVersion()
{
$command = str_replace(
'{package}',
$this->getName() ?? '',
$this->getName(),
self::GET_LATEST_AVAILABLE_VERSION
);
$results = $this->runCommand($command);
Expand Down Expand Up @@ -223,7 +223,7 @@ public static function checkWhetherPackagistProject($project_name, LocalMachineH
// Search for the Packagist project.
$command = str_replace(
'{project}',
$project_name ?? '',
$project_name,
self::VALIDATION_COMMAND
);
$results = $local_machine_helper->exec($command);
Expand Down
19 changes: 11 additions & 8 deletions src/Request/RequestOperationResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,33 +65,36 @@ public function setStatusCodeReason(string $status_code_reason): void
}

/**
* @inheritdoc
* @param mixed $offset
* @return bool
*/
public function offsetExists(mixed $offset): bool
public function offsetExists($offset)
{
return isset($this->{$offset});
}

/**
* @inheritdoc
* @param mixed $offset
* @return mixed|null
*/
public function offsetGet(mixed $offset): mixed
public function offsetGet($offset)
{
return $this->{$offset} ?? null;
}

/**
* @inheritdoc
* @param mixed $offset
* @param mixed $value
*/
public function offsetSet(mixed $offset, mixed $value): void
public function offsetSet($offset, $value)
{
$this->{$offset} = $value;
}

/**
* @inheritdoc
* @param mixed $offset
*/
public function offsetUnset(mixed $offset): void
public function offsetUnset($offset)
{
unset($this->{$offset});
}
Expand Down
11 changes: 2 additions & 9 deletions tests/config/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,7 @@

if (!getenv('TERMINUS_TESTING_RUNTIME_ENV')) {
// Create a testing runtime multidev environment.
$sitename = (new class {
use TerminusTestTrait;

})::getSiteName();

$sitename = TerminusTestTrait::getSiteName();
$multidev = sprintf('test-%s', substr(uniqid(), -6, 6));
$createMdCommand = sprintf('multidev:create %s.dev %s', $sitename, $multidev);
exec(
Expand All @@ -80,10 +76,7 @@
throw new Exception(sprintf('Command "%s" exited with non-zero code (%d)', $createMdCommand, $code));
}

(new class {
use TerminusTestTrait;

})::setMdEnv($multidev);
TerminusTestTrait::setMdEnv($multidev);

register_shutdown_function(function () use ($sitename, $multidev) {
// Delete a testing runtime multidev environment.
Expand Down

0 comments on commit e7b3c4a

Please sign in to comment.