- π¦πΉAustria klausi π¦πΉ Vienna
This has now been implemented in Coder in β¨ stdclass is auto-corrected to object but it should not be Fixed .
Raising priority to major as now the documented coding standards are not in sync with Coder.
Next step: define the wording and necessary changes to coding standards documentation pages in the issue summary.
- Status changed to Active
13 days ago 6:58am 23 January 2025 - π³πΏNew Zealand quietone
The next step here is to complete the proposed resolution section.
- πΊπΈUnited States dww
So yeah, we'd need to update this: https://www.drupal.org/docs/develop/standards/php/api-documentation-and-... β
To deal with this:
object (NOT "stdClass")
- π³πΏNew Zealand quietone
Adding link to current text and the current text.
Anyone know what 'stdClass' was excluded?
- π¦πΉAustria drunken monkey Vienna, Austria
I think I would rather disallow type-hinting with
\stdClass
at all to resolve this, then it not being allowed in the PhpDoc would not be a problem. Type-hinting on\stdClass
seems like bad practice to me and it should be discouraged if it isnβt yet in our standards.Anyone know what 'stdClass' was excluded?
Seems like this was written in a time when Drupal mostly used anonymous objects and we just wanted to document those as
object
in the PhpDoc, not as\stdClass
. Actual type hints were not allowed in PHP at that time, so the question of a discrepancy between PhpDoc and in-code type hint never arose.
And we probably couldnβt think of a good reason to actually require a\stdClass
object instead of any object with the required (public) properties β same as I do now.