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
xero-php declares the available fields on its models using the syntax @property Type Name inside the body of the class. For example, the Invoiceclass declares many fields using this pattern:
classInvoiceextendsRemote\Model
{
usePDFTrait;
useAttachmentTrait;
useSendEmailTrait;
useHistoryTrait;
/** * See Invoice Types. * * @property string Type *//** * See Contacts. * * @property Contact Contact *//** * See LineItems. * * @property LineItem[] LineItems */
Unfortunately this is not the correct way to use the @property PHPDoc tag, and tools such as PHPStan and Psalm cannot understand it, which makes using xero-php models significantly more difficult than necessary.
According to the PHPDoc documentation, property tags must tag the entire class (or trait), and must be written in the form @property Type $Name. For example, this is the correct way to declare the above properties on an invoice:
Hi @00dani, thanks for pointing this out. I'm not sure why it was implemented like this to begin with, but I'm wondering if a decade ago when this was written, maybe the standard was less prescriptive. Just a guess!
Unfortunately, xero-php is no longer programatically generated, so it'll be a reasonable amount of work to go and swap these out, possibly even warrants writing a script to do so. If you've got time/capacity to do this an open a PR, I'd be happy to merge this in.
xero-php declares the available fields on its models using the syntax
@property Type Name
inside the body of the class. For example, theInvoice
class declares many fields using this pattern:Unfortunately this is not the correct way to use the
@property
PHPDoc tag, and tools such as PHPStan and Psalm cannot understand it, which makes using xero-php models significantly more difficult than necessary.According to the PHPDoc documentation, property tags must tag the entire class (or trait), and must be written in the form
@property Type $Name
. For example, this is the correct way to declare the above properties on an invoice:Could this mistake please be fixed?
The text was updated successfully, but these errors were encountered: