Skip to content

Commit 703bb1d

Browse files
authored
Merge pull request #11 from php-etl/fix/composer-require
Fixed the composer require command : escape shell arg
2 parents e1084b7 + f15cebe commit 703bb1d

14 files changed

+35
-14
lines changed

src/Dockerfile/Copy.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66

77
final readonly class Copy implements LayerInterface, \Stringable
88
{
9-
public function __construct(private string $source, private string $destination) {}
9+
public function __construct(private string $source, private string $destination)
10+
{
11+
}
1012

1113
/** @return \Iterator|self[] */
1214
public static function directory(string $sourcePath, string $destinationPath): \Iterator

src/Dockerfile/From.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66

77
final readonly class From implements LayerInterface, \Stringable
88
{
9-
public function __construct(private string $source) {}
9+
public function __construct(private string $source)
10+
{
11+
}
1012

1113
public function __toString(): string
1214
{

src/Dockerfile/Label.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66

77
final readonly class Label implements LayerInterface, \Stringable
88
{
9-
public function __construct(private string $key, private string $value) {}
9+
public function __construct(private string $key, private string $value)
10+
{
11+
}
1012

1113
public function __toString(): string
1214
{

src/Dockerfile/Maintainer.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66

77
final readonly class Maintainer implements LayerInterface, \Stringable
88
{
9-
public function __construct(private string $name, private string $email) {}
9+
public function __construct(private string $name, private string $email)
10+
{
11+
}
1012

1113
public function __toString(): string
1214
{

src/Dockerfile/Run.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66

77
final readonly class Run implements LayerInterface, \Stringable
88
{
9-
public function __construct(private string $command) {}
9+
public function __construct(private string $command)
10+
{
11+
}
1012

1113
public function __toString(): string
1214
{

src/Dockerfile/Workdir.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66

77
final readonly class Workdir implements LayerInterface, \Stringable
88
{
9-
public function __construct(private string $path) {}
9+
public function __construct(private string $path)
10+
{
11+
}
1012

1113
public function __toString(): string
1214
{

src/PHP/ComposerAddComposerRepository.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
public function __construct(
1212
private string $name,
1313
private string $url
14-
) {}
14+
) {
15+
}
1516

1617
public function __toString(): string
1718
{

src/PHP/ComposerAddGithubRepository.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
public function __construct(
1212
private string $name,
1313
private string $url
14-
) {}
14+
) {
15+
}
1516

1617
public function __toString(): string
1718
{

src/PHP/ComposerAddVcsRepository.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
public function __construct(
1212
private string $name,
1313
private string $url
14-
) {}
14+
) {
15+
}
1516

1617
public function __toString(): string
1718
{

src/PHP/ComposerAuthenticationToken.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
public function __construct(
1212
private string $url,
1313
private string $token,
14-
) {}
14+
) {
15+
}
1516

1617
public function __toString(): string
1718
{

src/PHP/ComposerAutoload.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ public function __construct(
1313
* @param array<string, array<string, string|list<string>>> $autoloads
1414
*/
1515
private array $autoloads
16-
) {}
16+
) {
17+
}
1718

1819
private static function command(string ...$command): string
1920
{

src/PHP/ComposerInit.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88

99
final readonly class ComposerInit implements Dockerfile\LayerInterface, \Stringable
1010
{
11-
public function __construct(private string $name) {}
11+
public function __construct(private string $name)
12+
{
13+
}
1214

1315
public function __toString(): string
1416
{

src/PHP/ComposerMinimumStability.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88

99
final readonly class ComposerMinimumStability implements Dockerfile\LayerInterface, \Stringable
1010
{
11-
public function __construct(private string $minimumStability) {}
11+
public function __construct(private string $minimumStability)
12+
{
13+
}
1214

1315
public function __toString(): string
1416
{

src/PHP/ComposerRequire.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ public function __toString(): string
2020
return (string) new Dockerfile\Run(sprintf(<<<'RUN'
2121
set -ex \
2222
&& composer require --prefer-dist --no-progress --prefer-stable --sort-packages --optimize-autoloader --with-dependencies %s
23-
RUN, implode(' ', $this->packages)));
23+
RUN, implode(' ', array_map(fn (string $package) => escapeshellarg($package), $this->packages))));
2424
}
2525
}

0 commit comments

Comments
 (0)