set_args @return incorrect
-
I’m using the ORM to create organisers so my code includes the following:
$organizer = tribe_organizers()->set_args( $args )->create();But when I do code analysis with phpstan I get the following error:
Call to an undefined method Tribe__Repository__Update_Interface::create()I think this is because function tribe_organizers() returns Tribe__Repository__Interface which is defined as:
interface Tribe__Repository__Interface extends
Repository_Interface,
Tribe__Repository__Read_Interface,
Tribe__Repository__Update_InterfaceAnd Tribe__Repository__Update_Interface is defined as
interface Tribe__Repository__Update_Interface extends Tribe__Repository__Setter_InterfaceAnd set_args is part of Tribe__Repository__Setter_Interface. So far so good. But set_args header has @return Tribe__Repository__Update_Interface. Unfortunately, create method is actually on Repository_Interface not Tribe__Repository__Update_Interface, hence the error reported.
I think the header for set_args should be changed to:
* @return Repository_Interface
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
You must be logged in to reply to this topic.