PHP version migration
To see how migration from one PHP version to another will affect your code quality, employ 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.
This feature is supported by the Qodana for PHP linter and available under the Ultimate and Ultimate Plus licenses and their trial versions.
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:
Here, you have two options for running this feature:
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. The QODANA_TOKEN
variable refers to the project token.
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.