Skip to content

Commit

Permalink
[CMS-1147] PHP 8.2 compatibility (#2414)
Browse files Browse the repository at this point in the history
* Try testing in 8.2.

* Fix PHP 8.2 deprecation.

* Bump consolidation/robo.

* Bump consolidation/robo.

* Remove tests from 8.1.

* Avoid dynamic property memberships.

* Avoid dynamic property environment_metrics.

* Avoid dynamic property memberships.

* Maybe protected?

* It should be public.

* Avoid dynamic property memberships for user.

* Avoid dynamic property memberships for site tags.

* Avoid dynamic property memberships for user upstreams.

* Add some debugging.

* Do not stop on failure to get all errors at once.

* Lift max php version to 8.2.

* Revert "Do not stop on failure to get all errors at once."

This reverts commit e782a8f.

* Force running 8.2 to get deprecation messages.

* Only log if there is something in output.

* Fix coding standards.

* Undo github actions config changes. [skip ci]
  • Loading branch information
kporras07 committed Dec 15, 2022
1 parent 0945305 commit e9666f0
Show file tree
Hide file tree
Showing 10 changed files with 56 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/3x.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
strategy:
matrix:
operating-system: [ 'macos-latest' ]
php-versions: [ '7.4', '8.1' ]
php-versions: [ '7.4', '8.2' ]
max-parallel: 1
env:
TERMINUS_TOKEN: ${{ secrets.TERMINUS_TOKEN }}
Expand Down
6 changes: 3 additions & 3 deletions bin/terminus
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ if (version_compare(PHP_VERSION, '7.4.0', '<') === true) {
exit(1);
}

if (!getenv('TERMINUS_ALLOW_UNSUPPORTED_NEWER_PHP') && version_compare(PHP_VERSION, '8.2.0', '>=') === true) {
if (!getenv('TERMINUS_ALLOW_UNSUPPORTED_NEWER_PHP') && version_compare(PHP_VERSION, '8.3.0', '>=') === true) {
echo "\n";
echo 'PHP 8.2+ is not supported by this version of Terminus.' . "\n";
echo 'PHP 8.3+ 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";
echo 'Set environment variable TERMINUS_ALLOW_UNSUPPORTED_NEWER_PHP to try continuing anyway.' . "\n";
Expand All @@ -32,7 +32,7 @@ if (!getenv('TERMINUS_ALLOW_UNSUPPORTED_NEWER_PHP') && version_compare(PHP_VERSI

// This variable is automatically managed via updateDependenciesversion() in /RoboFile.php,
// which is run after every call to composer update.
$terminusPluginsDependenciesVersion = '6d4a6b25a9';
$terminusPluginsDependenciesVersion = '19d217d1ab';

// Cannot use $_SERVER superglobal since that's empty during phpunit testing
// getenv('HOME') isn't set on Windows and generates a Notice.
Expand Down
24 changes: 12 additions & 12 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/Commands/Env/CloneContentCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ private function cloneFiles()
private function emitNotice($element)
{
$this->log()->notice(
"Cloning ${element} from {source} environment to {target} environment",
"Cloning {$element} from {source} environment to {target} environment",
['source' => $this->source_env->getName(), 'target' => $this->target_env->getName(),]
);
}
Expand Down
4 changes: 3 additions & 1 deletion src/Commands/Self/Plugin/CreateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ public function create(string $path, $options = [
$project_name = $options['project-name'];
if (!file_exists($path)) {
$results = $this->doCreate($path, $project_name);
$this->log()->notice($results['output']);
if (!empty($results['output'])) {
$this->log()->notice($results['output']);
}
} else {
throw new TerminusException(self::EXISTING_FOLDER_MESSAGE);
}
Expand Down
5 changes: 5 additions & 0 deletions src/Models/Environment.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ class Environment extends TerminusModel implements ContainerAwareInterface, Site
*/
private $workflows;

/**
* @var EnvironmentMetrics
*/
private $environment_metrics;

/**
* Apply upstream updates
*
Expand Down
7 changes: 7 additions & 0 deletions src/Models/Organization.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ class Organization extends TerminusModel implements
*/
private $workflows;

/**
* @var SiteOrganizationMemberships
*
* Set by OrganizationJoinTrait.
*/
public $memberships;

/**
* @return string
*/
Expand Down
12 changes: 12 additions & 0 deletions src/Models/Site.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,18 @@ class Site extends TerminusModel implements ContainerAwareInterface, Organizatio
*/
private $workflows;

/**
* @var SiteOrganizationMemberships
*
* Set by SiteJoinTrait.
*/
public $memberships;

/**
* @var Pantheon\Terminus\Collections\Tags
*/
public $tags;

/**
* Add a payment method to the given site
*
Expand Down
11 changes: 11 additions & 0 deletions src/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,17 @@ class User extends TerminusModel implements
* @var Workflows
*/
private $workflows;
/**
* @var Upstreams
*/
private $upstreams;

/**
* @var SiteOrganizationMemberships
*
* Set by UserJoinTrait.
*/
public $memberships;

/**
* Provides Pantheon Dashboard URL for this user
Expand Down
2 changes: 1 addition & 1 deletion tests/config/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
);
if (0 !== $code) {
/** @noinspection PhpUnhandledExceptionInspection */
throw new Exception(sprintf('Command "%s" exited with non-zero code (%d)', $createMdCommand, $code));
throw new Exception(sprintf('Command "%s" exited with non-zero code (%d). Output: %s', $createMdCommand, $code, implode("\n", $output)));
}

TerminusTestBase::setMdEnv($multidev);
Expand Down

0 comments on commit e9666f0

Please sign in to comment.