You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the readonly keyword first, instead of second (as was fixed in #120), moodle-cs is giving the error Inline doc block comments are not allowed
For example,
This does not work (readonly first):
publicfunction __construct(
/** @var string some info */readonlypublicstring$test
) {
But this does work (readonly second):
publicfunction __construct(
/** @var string some info */publicreadonlystring$test
) {
I cant find any official php docs about what order is the best/correct, but if one is preferred it might be worth enforcing a specific order as an additional check ?
The text was updated successfully, but these errors were encountered:
matthewhilton
changed the title
Inline doc block comments are not allowed when using readonly promoted constructor valuesInline doc block comments are not allowed when using readonly as first property modifier
Oct 28, 2024
PER-2.0 defines the order:
https://www.php-fig.org/per/coding-style/#46-modifier-keywords
Classes, properties, and methods have numerous keyword modifiers that alter
how the engine and language handles them. When present, they MUST be in the
following order:
- Inheritance modifier: abstract or final
- Visibility modifier: public, protected, or private
- Scope modifier: static
- Mutation modifier: readonly
- Type declaration
- Name
All keywords MUST be on a single line, and MUST be separated by a single
space.
Andrew Lyons
Principal Architect
Moodle HQ - moodle.com [image: Moodle - Empowering educators to improve our
world]
On Mon, 28 Oct 2024 at 15:32, Matthew Hilton ***@***.***> wrote:
When using the readonly keyword first, instead of second (as was fixed in
#120 <#120>), moodle-cs is
giving the error Inline doc block comments are not allowed
For example,
This does not work (readonly first):
public function __construct(
/** @var string some info */
readonly public string $test
) {
But this does work (readonly second):
public function __construct(
/** @var string some info */
public readonly string $test
) {
I cant find any official php docs about what order is the best/correct,
but if one is preferred it might be worth enforcing a specific order as an
additional check ?
—
Reply to this email directly, view it on GitHub
<#187>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAC2K72GTFGS6LYNZPWZOK3Z5W45BAVCNFSM6AAAAABQWR2Q7CVHI2DSMVQWIX3LMV43ASLTON2WKOZSGYYTOMRWHA3DAMA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
When using the
readonly
keyword first, instead of second (as was fixed in #120), moodle-cs is giving the errorInline doc block comments are not allowed
For example,
This does not work (readonly first):
But this does work (readonly second):
I cant find any official php docs about what order is the best/correct, but if one is preferred it might be worth enforcing a specific order as an additional check ?
The text was updated successfully, but these errors were encountered: