Drupal.org misses a PHP version field. As far as I can see, I have to go through the issue queue or .info file for every third-party module to find out which PHP version is supported. Is that correct?
2 Answers
Sort of.
The PHP version isn't a required key for module .info files, and it's a minimum version of compatibility anyway. So a module could declare itself as requiring PHP5.6, but still work absolutely fine under PHP7. Or it could not declare a minimum version of PHP at all, and still work under PHP7. Or it could declare PHP5.6 as minimum, but not work at all in PHP7. You get the idea.
So yes, you need to check on a case-by-case basis to find out which will work under a specific version of PHP.
Yes, this is (still) correct.
If you just want to know if your existing Installation and modules are ready for a new PHP-Version, you can try to use PHP_CodeSniffer.
This tool scans your directory to detect violations of a defined coding standard.
Depending on how you installed your website you can use composer for that. It could look something like that:
composer require --dev phpcompatibility/php-compatibility
cd [folder_of_your_drupal_composer_file]
vendor/bin/phpcs --config-set installed_paths vendor/phpcompatibility/php-compatibility/PHPCompatibility
vendor/bin/phpcs -p [folder_to_scan] --standard=PHPCompatibility --extensions=[extensions_to_check] --runtime-set testVersion [PHP-Version_to_check]
To check all your modules for compatibility for PHP8.0 and save the log to the file "compatibility_php80.txt", the last line could look something like that:
vendor/bin/phpcs -p web/modules --standard=PHPCompatibility --extensions=module/php,inc/php,install/php,php/php --runtime-set testVersion 8.0 --report-full=compatibility_php80.txt
You can find a quite similar approach on the drupal handbook page "Drupal - PHP version compatibility check"