@@ -27,7 +27,26 @@ protected function configure(): void
27
27
28
28
protected function execute (InputInterface $ input , OutputInterface $ output ): int
29
29
{
30
+ $ packages = [];
31
+ $ requires = [];
32
+
33
+ while (false !== $ package = fgets (STDIN )) {
34
+ $ package = substr ($ package , 0 , -1 );
35
+
36
+ $ versions = scandir ($ package , SCANDIR_SORT_NONE );
37
+ usort ($ versions , 'version_compare ' );
38
+
39
+ if (!$ versions = array_slice ($ versions , 2 )) {
40
+ continue ;
41
+ }
42
+
43
+ $ packages [$ package ] = $ versions ;
44
+
45
+ $ requires [] = escapeshellarg ($ package .':^ ' .array_pop ($ versions ));
46
+ }
47
+
30
48
if ($ endpoint = $ input ->getArgument ('endpoint ' )) {
49
+ $ requires = implode (' ' , $ requires );
31
50
$ endpoint = <<<EOMD
32
51
33
52
## How to test these changes in your application
@@ -40,7 +59,11 @@ protected function execute(InputInterface $input, OutputInterface $output): int
40
59
SET SYMFONY_ENDPOINT= {$ endpoint }
41
60
```
42
61
43
- 2. Install the package(s) related to this recipe using `composer require`
62
+ 2. Install the package(s) related to this recipe:
63
+ ```sh
64
+ composer req 'symfony/flex:^1.16'
65
+ composer req {$ requires }
66
+ ```
44
67
45
68
3. Don't forget to unset the `SYMFONY_ENDPOINT` environment variable when done:
46
69
```sh
@@ -55,20 +78,15 @@ protected function execute(InputInterface $input, OutputInterface $output): int
55
78
56
79
$ head = <<<EOMD
57
80
Thanks for the PR 😍
58
-
81
+ { $ endpoint }
59
82
## Diff between recipe versions
60
83
61
84
In order to help with the review stage, I'm in charge of computing the diff between the various versions of patched recipes.
62
85
I'm going keep this comment up to date with any updates of the attached patch.
63
86
64
87
EOMD ;
65
88
66
- while (false !== $ package = fgets (STDIN )) {
67
- $ package = substr ($ package , 0 , -1 );
68
-
69
- $ versions = scandir ($ package , SCANDIR_SORT_NONE );
70
- usort ($ versions , 'version_compare ' );
71
- $ versions = array_slice ($ versions , 2 );
89
+ foreach ($ packages as $ package => $ versions ) {
72
90
$ previousVersion = array_shift ($ versions );
73
91
74
92
if (!$ versions ) {
0 commit comments