File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,15 @@ public function print(Output $output): void
48
48
'<info>PHP runtime version:</info> %s ' ,
49
49
$ phpRuntimeVersion ->getVersionString (),
50
50
));
51
+
52
+ $ composerPhpVersion = $ this ->getComposerRequireVersion ();
53
+ if ($ composerPhpVersion !== null ) {
54
+ $ output ->writeLineFormatted (sprintf (
55
+ '<info>PHP composer.json required version:</info> %s ' ,
56
+ $ composerPhpVersion ,
57
+ ));
58
+ }
59
+
51
60
$ output ->writeLineFormatted (sprintf (
52
61
'<info>PHP version for analysis:</info> %s (from %s) ' ,
53
62
$ this ->phpVersion ->getVersionString (),
@@ -166,4 +175,22 @@ public function print(Output $output): void
166
175
$ output ->writeLineFormatted ('' );
167
176
}
168
177
178
+ private function getComposerRequireVersion (): ?string
179
+ {
180
+ $ composerPhpVersion = null ;
181
+
182
+ if (count ($ this ->composerAutoloaderProjectPaths ) > 0 ) {
183
+ $ composer = ComposerHelper::getComposerConfig (end ($ this ->composerAutoloaderProjectPaths ));
184
+ if ($ composer !== null ) {
185
+ $ requiredVersion = $ composer ['require ' ]['php ' ] ?? null ;
186
+
187
+ if (is_string ($ requiredVersion )) {
188
+ $ composerPhpVersion = $ requiredVersion ;
189
+ }
190
+ }
191
+ }
192
+
193
+ return $ composerPhpVersion ;
194
+ }
195
+
169
196
}
You can’t perform that action at this time.
0 commit comments