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 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.
qodana.yaml
CLI
note
The CLI options override the settings of the qodana.yaml file.
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. The QODANA_TOKEN variable refers to the project token.
If you run Qodana with version 7.1 of the PHP runtime, the report will contain the following problems:
Analysis results: 2 problems detected
Grouping problems by severity: Info: 2
Name Severity Count problems
Missing returntype declaration Info 1
Unused declaration Info 1
Running Qodana with version 8.0 of the PHP runtime will produce the following output:
Analysis results: 3 problems detected
Grouping problems by severity: Info: 3
Name Severity Count problems
Missing returntype declaration Info 1
Unused declaration Info 1'switch' can be replaced with 'match' expression Info 1
Running Qodana with the migration feature enabled will produce the following report:
Analysis results: 1 problems detected
Grouping problems by severity: Info: 1
Name Severity Count problems
'switch' can be replaced with 'match' expression Info 1
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.
Thanks for your feedback!
Was this page helpful?
Cookie Settings
Our website uses some cookies and records your IP address for the purposes of accessibility, security, and managing your access to the telecommunication network. You can disable data collection and cookies by changing your browser settings, but it may affect how this website functions. Learn more.
With your consent, JetBrains may also use cookies and your IP address to collect individual statistics and provide you with personalized offers and ads subject to the Privacy Notice and the Terms of Use. JetBrains may use third-party services for this purpose. You can adjust or withdraw your consent at any time by visiting the Opt-Out page.