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
4848 '<info>PHP runtime version:</info> %s ' ,
4949 $ phpRuntimeVersion ->getVersionString (),
5050 ));
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+
5160 $ output ->writeLineFormatted (sprintf (
5261 '<info>PHP version for analysis:</info> %s (from %s) ' ,
5362 $ this ->phpVersion ->getVersionString (),
@@ -166,4 +175,22 @@ public function print(Output $output): void
166175 $ output ->writeLineFormatted ('' );
167176 }
168177
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+
169196}
You can’t perform that action at this time.
0 commit comments