Make WordPress Core

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#37830 closed enhancement (wontfix)

WP_Query can collapse several methods using __call()

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

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 10 years ago.

Download all attachments as: .zip

Change History (7)

#1 @wonderboymusic
10 years ago

  • Owner set to wonderboymusic
  • Resolutionfixed
  • Status newclosed

In 38356:

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

Fixes #37830.

#2 @ocean90
10 years ago

  • Focuses docs added
  • Keywords 2nd-opinion added
  • Resolution fixed
  • Status closedreopened

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
10 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
10 years ago

  • Keywords has-patch 2nd-opinion removed

#5 @wonderboymusic
10 years ago

  • Resolutionfixed
  • Status reopenedclosed

In 38471:

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

Fixes #37830.

#6 @ocean90
10 years ago

  • Milestone 4.7
  • Resolution fixedwontfix
Note: See TracTickets for help on using tickets.