Actions

User

Difference between revisions of "Gold/PHP 8 Scratchpad"

From Mahara Wiki

< User:Gold
(Gerrit filtering and a tag suggestion)
 
(5 intermediate revisions by 2 users not shown)
Line 8: Line 8:
  
 
This would mean that we first need to get the behat tests to test using the target version of PHP.  Then run the tests and assume that all failures are related to PHP8 non-compliance.
 
This would mean that we first need to get the behat tests to test using the target version of PHP.  Then run the tests and assume that all failures are related to PHP8 non-compliance.
 +
 +
PHPUnit will need to be updated so it is compatible with PHP 8.1 -> I note PHPUnit supports PHP 8.0 starting from version 9.3.0.
  
 
=== Other tools ===
 
=== Other tools ===
Line 15: Line 17:
 
* [https://github.com/PHPCompatibility/PHPCompatibility PHPCompatibility] is an extension for [https://github.com/squizlabs/PHP_CodeSniffer PHP_CodeSniffer].
 
* [https://github.com/PHPCompatibility/PHPCompatibility PHPCompatibility] is an extension for [https://github.com/squizlabs/PHP_CodeSniffer PHP_CodeSniffer].
 
* [https://github.com/wunderio/grumphp-php-compatibility grumphp-php-compatibility] is an extension of PHPCompatibility that allows it to word with [https://github.com/phpro/grumphp GrumPHP] (aka Bad Santa).
 
* [https://github.com/wunderio/grumphp-php-compatibility grumphp-php-compatibility] is an extension of PHPCompatibility that allows it to word with [https://github.com/phpro/grumphp GrumPHP] (aka Bad Santa).
 +
* [https://github.com/rectorphp/rector Reactor] is looking like a robust automated upgrade script too.
  
 
== How to work ==
 
== How to work ==
Line 40: Line 43:
  
 
Having looked at search options it looks like 'intopic' is preferred over 'topic' as we have multiple tags in this field.  I also see that 'PHP8' has been used a few times already. I would suggest 'PHP8Compat' as the tag to use to make filtering easier to spot for this task.
 
Having looked at search options it looks like 'intopic' is preferred over 'topic' as we have multiple tags in this field.  I also see that 'PHP8' has been used a few times already. I would suggest 'PHP8Compat' as the tag to use to make filtering easier to spot for this task.
 +
 +
=== Sub pages ===
 +
* [[User:Gold/PHP_8_Scratchpad/Add_PHP8|Add PHP 8.1 and PHP 7.4 to Apache2]]
 +
* [[User:Gold/PHP_8_Scratchpad/phan_sample_output|Sample output: phan]]

Latest revision as of 11:13, 17 May 2022

Just a place to scratch out thoughts on how to measure progress on PHP8 compliance that will give us some confidence and a sense of progress.

How to start

We need to be able to measure what is not currently working.

Behat & PHPUnit testing

We currently use this quite a bit. I would propose that we start with these as the initial measurement tool.

This would mean that we first need to get the behat tests to test using the target version of PHP. Then run the tests and assume that all failures are related to PHP8 non-compliance.

PHPUnit will need to be updated so it is compatible with PHP 8.1 -> I note PHPUnit supports PHP 8.0 starting from version 9.3.0.

Other tools

All tools have an option to specifically test for PHP 8.1.

How to work

Development Environment

I'm going to maintain a single codebase to work from for this. I'll set up Apache to host 2 sites from it. One running on PHP 7.4 and the other on PHP 8.1. This will give the opportunity to test things in the browser in a very quick and simple manner. They will have a shared config so they'll have the same DB and maharadata area.

Committing code

I want this to be a quick, rapid process. A large number of very small patchsets. Each resolving a single Behat test.

The commit message on a patchset will need to be small and concise. Ideally, just a reference to the behat test that this patchset fixes.

There will be edge cases. I see these being where a fix on one test cascades out to multiple other tests and/or areas of Mahara. In these cases the commit message will need to be more comprehensive.

Measurement

Once we have an idea of the amount of work we will have an idea on what is needed.

Reporting

If the number is large(ish) I'd like to add a dashboard or chatbot that reports on the progress.

Code analysis

A number of the Code Analysis tools have an option to output their findings in a machine readable format. These could be used in the reporting also.

Gerrit

Providing tags on patchsets are consistent we should be able to have a script search and scrape numbers from the Gerrit API. It is looking like this will be a simple thing. e.g. curl https://reviews.mahara.org/changes/?q=status:merged+topic:PHPStan

Having looked at search options it looks like 'intopic' is preferred over 'topic' as we have multiple tags in this field. I also see that 'PHP8' has been used a few times already. I would suggest 'PHP8Compat' as the tag to use to make filtering easier to spot for this task.

Sub pages