Fixed Incorrect docblocks from xf-dev:entity-class-properties

DragonByte Tech

Well-known member
Affected version
2.3.7
Given the following column definition:
PHP:
'embed_metadata'       => ['type' => self::JSON_ARRAY, 'nullable' => true, 'default' => null],
The resulting docblock entry is @property array|null|null $embed_metadata - there's an extra null there.

Given an entity that extends AbstractPrefix or AbstractPrefixGroup, the following docblocks are generated:
(AbstractPrefix)
Code:
 * @property-read string|Phrase $title
 * @property-read bool $has_usage_help
 *
 * RELATIONS
 * @property-read Phrase|null $MasterTitle
 * @property-read Phrase|null $MasterDescription
 * @property-read Phrase|null $MasterUsageHelp

(AbstractPrefixGroup)
Code:
 * GETTERS
 * @property-read Phrase|string $title
 *
 * RELATIONS
 * @property-read Phrase|null $MasterTitle
\XF\Entity\AbstractPrefix and \XF\Entity\AbstractPrefixGroup both have these same incorrect docblocks.

In both cases, the Getters should refer to \XF\Phrase and the Relations should refer to \XF\Entity\Phrase. Since this is (likely) the only case of such a class name conflict, a special case should be added to the generator for this.

EDIT: It seems like fixing the docblocks for AbstractPrefix and AbstractPrefixGroup also fixes the exports for addons that use these classes. The "double null" bug remains, however.
 
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XF release (2.3.8).

Change log:
Fix some issues with entity type hinting
There may be a delay before changes are rolled out to the XenForo Community.
 
Back
Top Bottom