Skip to content

Commit e9666f0

Browse files
authored
[CMS-1147] PHP 8.2 compatibility (#2414)
* 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]
1 parent 0945305 commit e9666f0

File tree

10 files changed

+56
-19
lines changed

10 files changed

+56
-19
lines changed

.github/workflows/3x.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
strategy:
4949
matrix:
5050
operating-system: [ 'macos-latest' ]
51-
php-versions: [ '7.4', '8.1' ]
51+
php-versions: [ '7.4', '8.2' ]
5252
max-parallel: 1
5353
env:
5454
TERMINUS_TOKEN: ${{ secrets.TERMINUS_TOKEN }}

bin/terminus

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ if (version_compare(PHP_VERSION, '7.4.0', '<') === true) {
2020
exit(1);
2121
}
2222

23-
if (!getenv('TERMINUS_ALLOW_UNSUPPORTED_NEWER_PHP') && version_compare(PHP_VERSION, '8.2.0', '>=') === true) {
23+
if (!getenv('TERMINUS_ALLOW_UNSUPPORTED_NEWER_PHP') && version_compare(PHP_VERSION, '8.3.0', '>=') === true) {
2424
echo "\n";
25-
echo 'PHP 8.2+ is not supported by this version of Terminus.' . "\n";
25+
echo 'PHP 8.3+ is not supported by this version of Terminus.' . "\n";
2626
echo 'Check for new versions at https://github.com/pantheon-systems/terminus/releases' . "\n";
2727
echo "\n";
2828
echo 'Set environment variable TERMINUS_ALLOW_UNSUPPORTED_NEWER_PHP to try continuing anyway.' . "\n";
@@ -32,7 +32,7 @@ if (!getenv('TERMINUS_ALLOW_UNSUPPORTED_NEWER_PHP') && version_compare(PHP_VERSI
3232

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

3737
// Cannot use $_SERVER superglobal since that's empty during phpunit testing
3838
// getenv('HOME') isn't set on Windows and generates a Notice.

composer.lock

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

src/Commands/Env/CloneContentCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ private function cloneFiles()
150150
private function emitNotice($element)
151151
{
152152
$this->log()->notice(
153-
"Cloning ${element} from {source} environment to {target} environment",
153+
"Cloning {$element} from {source} environment to {target} environment",
154154
['source' => $this->source_env->getName(), 'target' => $this->target_env->getName(),]
155155
);
156156
}

src/Commands/Self/Plugin/CreateCommand.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ public function create(string $path, $options = [
4040
$project_name = $options['project-name'];
4141
if (!file_exists($path)) {
4242
$results = $this->doCreate($path, $project_name);
43-
$this->log()->notice($results['output']);
43+
if (!empty($results['output'])) {
44+
$this->log()->notice($results['output']);
45+
}
4446
} else {
4547
throw new TerminusException(self::EXISTING_FOLDER_MESSAGE);
4648
}

src/Models/Environment.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ class Environment extends TerminusModel implements ContainerAwareInterface, Site
6363
*/
6464
private $workflows;
6565

66+
/**
67+
* @var EnvironmentMetrics
68+
*/
69+
private $environment_metrics;
70+
6671
/**
6772
* Apply upstream updates
6873
*

src/Models/Organization.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ class Organization extends TerminusModel implements
5252
*/
5353
private $workflows;
5454

55+
/**
56+
* @var SiteOrganizationMemberships
57+
*
58+
* Set by OrganizationJoinTrait.
59+
*/
60+
public $memberships;
61+
5562
/**
5663
* @return string
5764
*/

src/Models/Site.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,18 @@ class Site extends TerminusModel implements ContainerAwareInterface, Organizatio
9090
*/
9191
private $workflows;
9292

93+
/**
94+
* @var SiteOrganizationMemberships
95+
*
96+
* Set by SiteJoinTrait.
97+
*/
98+
public $memberships;
99+
100+
/**
101+
* @var Pantheon\Terminus\Collections\Tags
102+
*/
103+
public $tags;
104+
93105
/**
94106
* Add a payment method to the given site
95107
*

src/Models/User.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,17 @@ class User extends TerminusModel implements
6767
* @var Workflows
6868
*/
6969
private $workflows;
70+
/**
71+
* @var Upstreams
72+
*/
73+
private $upstreams;
74+
75+
/**
76+
* @var SiteOrganizationMemberships
77+
*
78+
* Set by UserJoinTrait.
79+
*/
80+
public $memberships;
7081

7182
/**
7283
* Provides Pantheon Dashboard URL for this user

tests/config/bootstrap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
);
7575
if (0 !== $code) {
7676
/** @noinspection PhpUnhandledExceptionInspection */
77-
throw new Exception(sprintf('Command "%s" exited with non-zero code (%d)', $createMdCommand, $code));
77+
throw new Exception(sprintf('Command "%s" exited with non-zero code (%d). Output: %s', $createMdCommand, $code, implode("\n", $output)));
7878
}
7979

8080
TerminusTestBase::setMdEnv($multidev);

0 commit comments

Comments
 (0)