[wp-trac] [WordPress Trac] #37867: Document return types for create/create_and_get/create_many() methods of factory classes

WordPress Trac noreply at wordpress.org
Sun Sep 11 02:34:18 UTC 2016


#37867: Document return types for create/create_and_get/create_many() methods of
factory classes
------------------------------+------------------------------
 Reporter:  jdgrimes          |       Owner:
     Type:  enhancement       |      Status:  new
 Priority:  normal            |   Milestone:  Awaiting Review
Component:  Build/Test Tools  |     Version:  3.7
 Severity:  normal            |  Resolution:
 Keywords:  2nd-opinion       |     Focuses:  docs
------------------------------+------------------------------

Comment (by DrewAPicture):

 Replying to [comment:8 boonebgorges]:
 > @DrewAPicture Can you have a think about what @jdgrimes is proposing?

 Using `@method` annotations would definitely be the most efficient way to
 go, albeit copping out of doing it the "right" way, which would of course
 involve redefining and documenting all of the relevant superclass methods
 in each of the factories.

 Using `@method` annotations in this way is a bit of a bastardization of
 their intent to be sure, but it gets the job done. I personally think in
 the specific context of our unit test factories, the level of potential
 confusion (in expecting magic methods) would be fairly low.

 FWIW, we just implemented custom test factories in a plugin I work on and
 this is actually the same method we used to indicate return types.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/37867#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list