Make WordPress Core

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#37830 closed enhancement (wontfix)

WP_Query can collapse several methods using __call()

Reported by: wonderboymusic's profile wonderboymusic Owned by: wonderboymusic's profile wonderboymusic
Milestone: Priority: normal
Severity: normal Version:
Component: Query Keywords: revert
Focuses: docs Cc:

Description

There are a variety of is_* methods that also exist as properties. The functions simply cast to bool. These can all be collapsed using __call() and @method annotations.

Patch attached.

Attachments (1)

37830.diff (4.9 KB) - added by wonderboymusic 8 years ago.

Download all attachments as: .zip

Change History (7)

@wonderboymusic
8 years ago

#1 @wonderboymusic
8 years ago

  • Owner set to wonderboymusic
  • Resolution set to fixed
  • Status changed from new to closed

In 38356:

Query: collapse several of the is_* methods using __call(). Add @method annotations.

Fixes #37830.

#2 @ocean90
8 years ago

  • Focuses docs added
  • Keywords 2nd-opinion added
  • Resolution fixed deleted
  • Status changed from closed to reopened

May I ask which problem [38356] solves? I'm not really a fan of magic methods because they are … magic. How does this impact performance?

Through the @method annotation we seem to lose the @since tag. @DrewAPicture does DevHub support @method annotations or would we lose the methods/docs of these methods without further adjustments?

#3 @DrewAPicture
8 years ago

  • Keywords revert added

@ocean90 is correct that we lose data on when these methods were introduced. And I think more importantly we lose a lot of context that is useful to developers unfamiliar with the is_*() methods.

DevHub doesn't currently support @method tags, that is to say, the parser of course understands the tags but we don't expose the data in any form on DevHub. I think the preference here would be to keep the methods as non-magic to retain the extra context and versioning information.

#4 @johnbillion
8 years ago

  • Keywords has-patch 2nd-opinion removed

#5 @wonderboymusic
8 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 38471:

Query: r38356, you were not long for this world.

Fixes #37830.

#6 @ocean90
8 years ago

  • Milestone 4.7 deleted
  • Resolution changed from fixed to wontfix
Note: See TracTickets for help on using tickets.