Skip to content

Commit 2eefa42

Browse files
author
catch
committed
Issue #3444020 by andypost, smustgrave: [8.4] Fix implicitly nullable type declarations in composer plugin
(cherry picked from commit 031b4907aa402bac3d38809e073b6162c15630bf)
1 parent 1ba9de7 commit 2eefa42

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

Operations/AppendOp.php

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,21 @@ class AppendOp extends AbstractOperation {
5959
/**
6060
* Constructs an AppendOp.
6161
*
62-
* @param \Drupal\Composer\Plugin\Scaffold\ScaffoldFilePath $prepend_path
63-
* The relative path to the prepend file.
64-
* @param \Drupal\Composer\Plugin\Scaffold\ScaffoldFilePath $append_path
65-
* The relative path to the append file.
62+
* @param \Drupal\Composer\Plugin\Scaffold\ScaffoldFilePath|null $prepend_path
63+
* (optional) The relative path to the prepend file.
64+
* @param \Drupal\Composer\Plugin\Scaffold\ScaffoldFilePath|null $append_path
65+
* (optional) The relative path to the append file.
6666
* @param bool $force_append
67-
* TRUE if is okay to append to a file that was not scaffolded.
68-
* @param \Drupal\Composer\Plugin\Scaffold\ScaffoldFilePath $default_path
69-
* The relative path to the default data.
67+
* (optional) TRUE if is okay to append to a file that was not scaffolded.
68+
* @param \Drupal\Composer\Plugin\Scaffold\ScaffoldFilePath|null $default_path
69+
* (optional) The relative path to the default data.
7070
*/
71-
public function __construct(ScaffoldFilePath $prepend_path = NULL, ScaffoldFilePath $append_path = NULL, $force_append = FALSE, ScaffoldFilePath $default_path = NULL) {
71+
public function __construct(
72+
?ScaffoldFilePath $prepend_path = NULL,
73+
?ScaffoldFilePath $append_path = NULL,
74+
$force_append = FALSE,
75+
?ScaffoldFilePath $default_path = NULL,
76+
) {
7277
$this->forceAppend = $force_append;
7378
$this->prepend = $prepend_path;
7479
$this->append = $append_path;

Operations/OperationFactory.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,13 @@ protected function createAppendOp(PackageInterface $package, OperationData $oper
122122
/**
123123
* Checks to see if the specified scaffold file exists and has content.
124124
*
125-
* @param \Drupal\Composer\Plugin\Scaffold\ScaffoldFilePath $file
126-
* Scaffold file to check.
125+
* @param \Drupal\Composer\Plugin\Scaffold\ScaffoldFilePath|null $file
126+
* (optional) Scaffold file to check.
127127
*
128128
* @return bool
129129
* True if the file exists and has content.
130130
*/
131-
protected function hasContent(ScaffoldFilePath $file = NULL) {
131+
protected function hasContent(?ScaffoldFilePath $file = NULL) {
132132
if (!$file) {
133133
return FALSE;
134134
}

0 commit comments

Comments
 (0)