@@ -9,22 +9,6 @@ class Process {
99 public function __construct (array $ a ) {}
1010}
1111
12- class Process2 {
13- /**
14- * @param array<string> $a
15- * @throws ProcessFailedException
16- */
17- public function __construct (array $ a ) {}
18- }
19-
20- class Process3 {
21- /**
22- * @param array<string> $a
23- * @throws void
24- */
25- public function __construct (array $ a ) {}
26- }
27-
2812abstract class DbCommand
2913{
3014 /**
@@ -77,6 +61,15 @@ public function handle()
7761 abstract public function getCommand ();
7862}
7963
64+
65+ class Process2 {
66+ /**
67+ * @param array<string> $a
68+ * @throws ProcessFailedException
69+ */
70+ public function __construct (array $ a ) {}
71+ }
72+
8073abstract class DbCommand3
8174{
8275 /**
@@ -103,6 +96,14 @@ public function handle()
10396 abstract public function getCommand ();
10497}
10598
99+ class Process3 {
100+ /**
101+ * @param array<string> $a
102+ * @throws void
103+ */
104+ public function __construct (array $ a ) {}
105+ }
106+
106107abstract class DbCommand4
107108{
108109 /**
@@ -128,3 +129,84 @@ public function handle()
128129 */
129130 abstract public function getCommand ();
130131}
132+
133+ class Process4 {
134+ /**
135+ * @param array<string> $a
136+ *
137+ * @throws \LogicException
138+ */
139+ public function __construct (array $ a ) {}
140+
141+ /**
142+ * @throws ProcessFailedException
143+ * @throws \LogicException
144+ */
145+ public function mustRun (): int {}
146+ }
147+
148+ abstract class DbCommand5
149+ {
150+ /**
151+ * @return int
152+ */
153+ public function handle ()
154+ {
155+ try {
156+ (new Process4 (
157+ array_merge ([$ command = $ this ->getCommand ()]),
158+ ))->mustRun ();
159+ } catch (ProcessFailedException $ e ) {
160+ echo ("{$ command } not found in path. " );
161+
162+ return 1 ;
163+ }
164+
165+ return 0 ;
166+ }
167+
168+ /**
169+ * @return string
170+ */
171+ abstract public function getCommand ();
172+ }
173+
174+ class Process5 {
175+ /**
176+ * @param array<string> $a
177+ *
178+ * @throws \LogicException
179+ */
180+ public function __construct (array $ a ) {}
181+
182+ /**
183+ * @throws ProcessFailedException
184+ */
185+ public function mustRun (): int {}
186+ }
187+
188+ abstract class DbCommand6
189+ {
190+ /**
191+ * @return int
192+ */
193+ public function handle ()
194+ {
195+ try {
196+ (new Process5 (
197+ array_merge ([$ command = $ this ->getCommand ()]),
198+ ))->mustRun ();
199+ } catch (ProcessFailedException $ e ) {
200+ echo ("{$ command } not found in path. " );
201+
202+ return 1 ;
203+ }
204+
205+ return 0 ;
206+ }
207+
208+ /**
209+ * @return string
210+ */
211+ abstract public function getCommand ();
212+ }
0 commit comments