ci.yml, what does "...is missing a return type" mean?

ci.yml, what does "...is missing a return type" mean?

de Howard Miller -
Número de respuestas: 7
Imagen de Core developers Imagen de Documentation writers Imagen de Particularly helpful Moodlers Imagen de Peer reviewers Imagen de Plugin developers

I updated my ci.yml scripts to the latest version and some odd stuff is now going on. One thing  I've not been able to resolve...

"Test method test_blah_blah() is missing a return type"

In unit tests. Obviously, unit test methods don't have a return type. Does anybody know what it is asking me to change?

Promedio de valoraciones: -
En respuesta a Howard Miller

Re: ci.yml, what does "...is missing a return type" mean?

de Howard Miller -
Imagen de Core developers Imagen de Documentation writers Imagen de Particularly helpful Moodlers Imagen de Peer reviewers Imagen de Plugin developers
Ok - answering my own question - the test function now seems to require an explicit return type of void. That is...

function test_something(): void {}

The script also insists that the class is qualified as 'final'. None of this is reflected in the PHPUnit documentation (that I can find) triste
En respuesta a Howard Miller

Re: ci.yml, what does "...is missing a return type" mean?

de Andrew Lyons -
Imagen de Core developers Imagen de Moodle HQ Imagen de Particularly helpful Moodlers Imagen de Peer reviewers Imagen de Plugin developers Imagen de Testers
This is in preparation for PHPUnit 10.

Whilst some of these things are not specifically required for PHPUnit 10, they do actively prevent issues and promote better code.

These are mostly auto-fixable using phpcs/phpcbf.
En respuesta a Andrew Lyons

Re: ci.yml, what does "...is missing a return type" mean?

de Howard Miller -
Imagen de Core developers Imagen de Documentation writers Imagen de Particularly helpful Moodlers Imagen de Peer reviewers Imagen de Plugin developers
Thanks Andrew,

"These are mostly auto-fixable using phpcs/phpcbf"

I have no clue what this is. Any links/hints?
En respuesta a Howard Miller

Re: ci.yml, what does "...is missing a return type" mean?

de Renaat Debleu -
Imagen de Core developers Imagen de Particularly helpful Moodlers Imagen de Plugin developers
The only thing you have to do to get those errors fixed, is running phpcbf in the root directory of your Moodle installation:
 
php moodle-plugin-ci.phar phpcbf path/to/your/plugin
 
 
En respuesta a Renaat Debleu

Re: ci.yml, what does "...is missing a return type" mean?

de Howard Miller -
Imagen de Core developers Imagen de Documentation writers Imagen de Particularly helpful Moodlers Imagen de Peer reviewers Imagen de Plugin developers
Renaat

I'm possibly being stupid but there's no file called moodle-plugin-ci.phar in my installation. Where does that come from?
 
I think you're all probably thinking that I know about something that I clearly don't gran sonrisa
En respuesta a Howard Miller

Re: ci.yml, what does "...is missing a return type" mean?

de Renaat Debleu -
Imagen de Core developers Imagen de Particularly helpful Moodlers Imagen de Plugin developers
Have a look at https://moodlehq.github.io/moodle-plugin-ci/ to use moodle-plugin-ci locally.