Code Quality Updates after bumping PHP version requirement
See original GitHub issueTask Description
- Remove some compat code we have for PHP 7.0 or even PHP 5.6
- Use newer language features / simplify some code where applicable (the IDE will easily help with this)
Examples:
void
return type
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Bump PHP version requirement #505 - GitHub
This is a requirement for increasing minimum PHP version. ... For this number to reduce around 5% (requirements for updating minimum php version), ......
Read more >How to Change PHP Version in cPanel - InMotion Hosting
Click the MultiPHP Manager link in the Software section of cPanel. Check the box for the site or sites you wish to update....
Read more >Tips for transpiling code from PHP 8.0 down to 7.1
After introducing transpiling to my plugin, I've been able to bump its minimum required PHP version up to 8.0 (for development).
Read more >WordPress to Bump Recommended PHP Version From 5.6 to ...
There's a regular argument that bumping WordPress' minimum *required* version would force hosts to update their PHP version – we've found that ...
Read more >How To Update PHP Version In WordPress (Beginner's Guide)
Ensure your site is always running on the latest PHP. In this guide, we show you how to find and update the PHP...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Use whatever tool you deem best suited for the task.
Regarding lints, if we can achieve some changes with the current config, that’s great. If something would require additional PHPCS plugins or the like, that needs to be discussed separately.
For class constant visibility we can just uncomment this line in the PHPCS:
https://github.com/GoogleForCreators/web-stories-wp/blob/7274e02b0fe5c2d10c03c64d68c1e0db5329f3a8/phpcs.xml.dist#L172-L173
For
void
return types we can try enablingSlevomatCodingStandard.TypeHints.ReturnTypeHint
:I am not aware of a lint rule for array destructuring.
There’s also stuff that probably needs to be changed manually, for example:
https://github.com/GoogleForCreators/web-stories-wp/blob/7274e02b0fe5c2d10c03c64d68c1e0db5329f3a8/includes/Infrastructure/Injector/SimpleInjector.php#L390-L405
https://github.com/GoogleForCreators/web-stories-wp/blob/7274e02b0fe5c2d10c03c64d68c1e0db5329f3a8/includes/AMP/Output_Buffer.php#L195-L201
https://github.com/GoogleForCreators/web-stories-wp/blob/7274e02b0fe5c2d10c03c64d68c1e0db5329f3a8/includes/Infrastructure/ServiceContainer/LazilyInstantiatedService.php#L59-L60
More examples