I am working on migrating my project from php 7.4 to 8.1. Because of this, I constantly encounter the problem of incorrect arguments passed to the method.
For example: count($data['items'])
, where $data['items']
could potentially be an array
or null
.
Tried using PHP_CodeSniffer
with PHPCompatibility
with --runtime-set testVersion 8.1
option.
But it doesn't detect such problems.
How can I find all such potential problems?
As a result I filed to find a good solution for checking that the required data type is always passed to the function.
Rector, PHPStan, PHPCodeSniffer helped to check out some of the potential errors.
Other errors searched by manual testing.