Skip to content

Commit e316649

Browse files
authored
Merge pull request #10 from acquia/ACMS-1866
ACMS-1866: Fixed the PHP 8.2 deprecation notices.
2 parents 50b547e + c9291ab commit e316649

File tree

3 files changed

+17
-38
lines changed

3 files changed

+17
-38
lines changed

src/Config/ConfigInitializer.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class ConfigInitializer {
2828
/**
2929
* Processor.
3030
*
31-
* @var Acquia\Drupal\RecommendedSettings\Config\YamlConfigProcessor
31+
* @var \Acquia\Drupal\RecommendedSettings\Config\YamlConfigProcessor
3232
*/
3333
protected $processor;
3434

src/Config/SettingsConfig.php

+8-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@
1111
*/
1212
class SettingsConfig extends Config {
1313

14+
/**
15+
* Holds the YamlExpander class object.
16+
*
17+
* @var \Grasmash\YamlExpander\YamlExpander
18+
*/
19+
protected $expander;
20+
1421
/**
1522
* Config Constructor.
1623
*
@@ -29,7 +36,7 @@ public function __construct(array $data = []) {
2936
* @param string $filename
3037
* The file in which placeholders should be expanded.
3138
*/
32-
public function expandFileProperties($filename) {
39+
public function expandFileProperties(string $filename) {
3340
$expanded_contents = $this->expander->expandArrayProperties(file($filename), $this->export());
3441
file_put_contents($filename, implode("", $expanded_contents));
3542
}

src/Plugin.php

+8-36
Original file line numberDiff line numberDiff line change
@@ -36,26 +36,18 @@ class Plugin implements PluginInterface, EventSubscriberInterface {
3636
protected $io;
3737

3838
/**
39-
* The Composer Scaffold handler.
39+
* Stores this plugin package object.
4040
*
41-
* @var \Drupal\Composer\Plugin\Scaffold\Handler
41+
* @var mixed|null
4242
*/
43-
protected $handler;
44-
45-
/**
46-
* Record whether the 'require' command was called.
47-
*
48-
* @var bool
49-
*/
50-
protected $drsIncluded;
43+
protected $settingsPackage;
5144

5245
/**
5346
* {@inheritdoc}
5447
*/
5548
public function activate(Composer $composer, IOInterface $io) {
5649
$this->composer = $composer;
5750
$this->io = $io;
58-
$this->drsIncluded = FALSE;
5951
}
6052

6153
/**
@@ -83,7 +75,7 @@ public static function getSubscribedEvents() {
8375
}
8476

8577
/**
86-
* Marks Acquia Drupal Recommended Settings to be processed after an install or update command.
78+
* Marks this plugin to be processed after package install or update event.
8779
*
8880
* @param \Composer\Installer\PackageEvent $event
8981
* Event.
@@ -98,13 +90,14 @@ public function onPostPackageEvent(PackageEvent $event) {
9890
}
9991

10092
/**
101-
* Execute Acquia Drupal Recommended Settings drs:update after update command has been executed.
93+
* Includes Acquia recommended settings post composer update/install command.
10294
*
10395
* @throws \Exception
10496
*/
10597
public function onPostCmdEvent() {
106-
// Only install the template files if acquia/drupal-recommended-settings was installed.
107-
if (isset($this->settingsPackage)) {
98+
// Only install the template files, if the drupal-recommended-settings
99+
// plugin is installed.
100+
if ($this->settingsPackage) {
108101
$settings = new Settings($this->composer, $this->io, $this->settingsPackage);
109102
$settings->hashSalt();
110103
$settings->generateSettings();
@@ -133,25 +126,4 @@ protected function getSettingsPackage(OperationInterface $operation) {
133126
return NULL;
134127
}
135128

136-
/**
137-
* Hook for pre-package install.
138-
*/
139-
public function prePackageInstall(PackageEvent $event) {
140-
if (!$this->drsIncluded) {
141-
$operations = $event->getOperations();
142-
foreach ($operations as $operation) {
143-
if ($operation instanceof InstallOperation) {
144-
$package = $operation->getPackage();
145-
}
146-
elseif ($operation instanceof UpdateOperation) {
147-
$package = $operation->getTargetPackage();
148-
}
149-
if (isset($package) && $package instanceof PackageInterface && $package->getName() == 'acquia/drupal-recommended-settings') {
150-
$this->drsIncluded = TRUE;
151-
break;
152-
}
153-
}
154-
}
155-
}
156-
157129
}

0 commit comments

Comments
 (0)