Actions

User

User:Gold/PHP 8 Scratchpad

From Mahara Wiki

< User:Gold
Revision as of 10:49, 17 Mayıs 2022 by Gold (talk | contribs) (→‎Other tools: Adding Reactor)

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

Add PHP 8.1 and PHP 7.4 to Apache2