Skip to content

Commit 811011e

Browse files
authored
Trim trailing spaces in autoload files (composer#12459)
1 parent 7d78b92 commit 811011e

File tree

4 files changed

+23
-22
lines changed

4 files changed

+23
-22
lines changed

src/Composer/Autoload/AutoloadGenerator.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,6 +1201,7 @@ class ComposerStaticInit$suffix
12011201
]
12021202
);
12031203
$value = ltrim(Preg::replace('/^ */m', ' $0$0', $value));
1204+
$value = Preg::replace('/ +$/m', '', $value);
12041205

12051206
$file .= sprintf(" public static $%s = %s;\n\n", $prop, $value);
12061207
if ('files' !== $prop) {

tests/Composer/Test/Autoload/Fixtures/autoload_phar_static.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,68 +7,68 @@
77
class ComposerStaticInitPhar
88
{
99
public static $prefixLengthsPsr4 = array (
10-
'S' =>
10+
'S' =>
1111
array (
1212
'Sit\\' => 4,
1313
),
14-
'Q' =>
14+
'Q' =>
1515
array (
1616
'Qux\\' => 4,
1717
),
18-
'D' =>
18+
'D' =>
1919
array (
2020
'Dolor\\' => 6,
2121
),
22-
'B' =>
22+
'B' =>
2323
array (
2424
'Baz\\' => 4,
2525
),
2626
);
2727

2828
public static $prefixDirsPsr4 = array (
29-
'Sit\\' =>
29+
'Sit\\' =>
3030
array (
3131
0 => 'phar://' . __DIR__ . '/..' . '/a/a/dir/sit.phar/src',
3232
),
33-
'Qux\\' =>
33+
'Qux\\' =>
3434
array (
3535
0 => 'phar://' . __DIR__ . '/../..' . '/dir/qux.phar/src',
3636
),
37-
'Dolor\\' =>
37+
'Dolor\\' =>
3838
array (
3939
0 => 'phar://' . __DIR__ . '/..' . '/a/a/dolor.phar',
4040
),
41-
'Baz\\' =>
41+
'Baz\\' =>
4242
array (
4343
0 => 'phar://' . __DIR__ . '/../..' . '/baz.phar',
4444
),
4545
);
4646

4747
public static $prefixesPsr0 = array (
48-
'L' =>
48+
'L' =>
4949
array (
50-
'Lorem' =>
50+
'Lorem' =>
5151
array (
5252
0 => 'phar://' . __DIR__ . '/..' . '/a/a/lorem.phar',
5353
),
5454
),
55-
'I' =>
55+
'I' =>
5656
array (
57-
'Ipsum' =>
57+
'Ipsum' =>
5858
array (
5959
0 => 'phar://' . __DIR__ . '/..' . '/a/a/dir/ipsum.phar/src',
6060
),
6161
),
62-
'F' =>
62+
'F' =>
6363
array (
64-
'Foo' =>
64+
'Foo' =>
6565
array (
6666
0 => 'phar://' . __DIR__ . '/../..' . '/foo.phar',
6767
),
6868
),
69-
'B' =>
69+
'B' =>
7070
array (
71-
'Bar' =>
71+
'Bar' =>
7272
array (
7373
0 => 'phar://' . __DIR__ . '/../..' . '/dir/bar.phar/src',
7474
),

tests/Composer/Test/Autoload/Fixtures/autoload_static_include_path.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
class ComposerStaticInitIncludePath
88
{
99
public static $prefixesPsr0 = array (
10-
'M' =>
10+
'M' =>
1111
array (
12-
'Main\\Foo' =>
12+
'Main\\Foo' =>
1313
array (
1414
0 => __DIR__ . '/../..' . '/',
1515
),
16-
'Main\\Bar' =>
16+
'Main\\Bar' =>
1717
array (
1818
0 => __DIR__ . '/../..' . '/',
1919
),

tests/Composer/Test/Autoload/Fixtures/autoload_static_target_dir.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ class ComposerStaticInitTargetDir
1212
);
1313

1414
public static $prefixesPsr0 = array (
15-
'M' =>
15+
'M' =>
1616
array (
17-
'Main\\Foo' =>
17+
'Main\\Foo' =>
1818
array (
1919
0 => __DIR__ . '/../..' . '/',
2020
),
21-
'Main\\Bar' =>
21+
'Main\\Bar' =>
2222
array (
2323
0 => __DIR__ . '/../..' . '/',
2424
),

0 commit comments

Comments
 (0)