PHP version migration
If you need to see how migration from one PHP version to another will affect your code quality, you can use the php-migration
Qodana scenario. If you run this scenario, you will be able to see the codebase problems that will arise after you upgrade to a newer PHP version.
You can configure this scenario either in the qodana.yaml
file or invoke it using the CLI.
This snippet specifies the php-migration
scenario using the name
parameter. The fromLevel
and toLevel
parameters denote the old and upgraded PHP versions respectively.
This is the example of the qodana.yaml
configuration:
This snippet specifies the php-migration
scenario for the --script
option followed by the colon :
character, and PHP versions separated by the -to-
character combination.
This is the example of the CLI command:
Example
To show how the language migration feature works, the following PHP code snippet will be inspected:
If you run Qodana with version 7.1 of the PHP runtime, the report will contain the following problems:
Running Qodana with version 8.0 of the PHP runtime will produce the following output:
Running Qodana with the migration feature enabled will produce the following report:
As you can see, the migration report contains only the problem contained in the version 8.0 report and missing from the version 7.1 report.