<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[27473] trunk/src/wp-includes: Better standardize parameter value types in PHPDocs where both a post ID or `WP_Post` would be acceptable.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/27473">27473</a></dd>
<dt>Author</dt> <dd>DrewAPicture</dd>
<dt>Date</dt> <dd>2014-03-08 19:31:51 +0000 (Sat, 08 Mar 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Better standardize parameter value types in PHPDocs where both a post ID or `WP_Post` would be acceptable.

Covers cases where previously only `int` or `int|object` types were notated.

Props coffee2code for the original patch.
See <a href="http://core.trac.wordpress.org/ticket/20495">#20495</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesposttemplatephp">trunk/src/wp-includes/post-template.php</a></li>
<li><a href="#trunksrcwpincludespostphp">trunk/src/wp-includes/post.php</a></li>
<li><a href="#trunksrcwpincludestaxonomyphp">trunk/src/wp-includes/taxonomy.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludesposttemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/post-template.php (27472 => 27473)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/post-template.php  2014-03-08 06:13:27 UTC (rev 27472)
+++ trunk/src/wp-includes/post-template.php     2014-03-08 19:31:51 UTC (rev 27473)
</span><span class="lines">@@ -96,7 +96,7 @@
</span><span class="cx">  *
</span><span class="cx">  * @since 0.71
</span><span class="cx">  *
</span><del>- * @param int|object $post Optional. Post ID or object.
</del><ins>+ * @param int|WP_Post $post Optional. Post ID or post object.
</ins><span class="cx">  * @return string
</span><span class="cx">  */
</span><span class="cx"> function get_the_title( $post = 0 ) {
</span><span class="lines">@@ -129,7 +129,7 @@
</span><span class="cx">  *
</span><span class="cx">  * @since 1.5.0
</span><span class="cx">  *
</span><del>- * @param int $id Optional. Post ID.
</del><ins>+ * @param int|WP_Post $id Optional. Post ID or post object.
</ins><span class="cx">  */
</span><span class="cx"> function the_guid( $id = 0 ) {
</span><span class="cx">  echo esc_url( get_the_guid( $id ) );
</span><span class="lines">@@ -144,7 +144,7 @@
</span><span class="cx">  *
</span><span class="cx">  * @since 1.5.0
</span><span class="cx">  *
</span><del>- * @param int $id Optional. Post ID.
</del><ins>+ * @param int|WP_Post $id Optional. Post ID or post object.
</ins><span class="cx">  * @return string
</span><span class="cx">  */
</span><span class="cx"> function get_the_guid( $id = 0 ) {
</span><span class="lines">@@ -280,7 +280,7 @@
</span><span class="cx">  *
</span><span class="cx">  * @since 2.3.0
</span><span class="cx">  *
</span><del>- * @param int $id Optional. Post ID.
</del><ins>+ * @param int|WP_Post $id Optional. Post ID or post object.
</ins><span class="cx">  * @return bool
</span><span class="cx">  */
</span><span class="cx"> function has_excerpt( $id = 0 ) {
</span><span class="lines">@@ -294,7 +294,7 @@
</span><span class="cx">  * @since 2.7.0
</span><span class="cx">  *
</span><span class="cx">  * @param string|array $class One or more classes to add to the class list.
</span><del>- * @param int $post_id An optional post ID.
</del><ins>+ * @param int|WP_Post $post_id Optional. Post ID or post object.
</ins><span class="cx">  */
</span><span class="cx"> function post_class( $class = '', $post_id = null ) {
</span><span class="cx">  // Separates classes with a single space, collates classes for post DIV
</span><span class="lines">@@ -316,7 +316,7 @@
</span><span class="cx">  * @since 2.7.0
</span><span class="cx">  *
</span><span class="cx">  * @param string|array $class One or more classes to add to the class list.
</span><del>- * @param int $post_id An optional post ID.
</del><ins>+ * @param int|WP_Post $post_id Optional. Post ID or post object.
</ins><span class="cx">  * @return array Array of classes.
</span><span class="cx">  */
</span><span class="cx"> function get_post_class( $class = '', $post_id = null ) {
</span><span class="lines">@@ -1173,7 +1173,7 @@
</span><span class="cx">  *
</span><span class="cx">  * @since 2.0.0
</span><span class="cx">  *
</span><del>- * @param int $id Optional. Post ID.
</del><ins>+ * @param int|WP_Post $id Optional. Post ID or post object.
</ins><span class="cx">  * @param bool $fullsize Optional, default is false. Whether to use full size.
</span><span class="cx">  * @param bool $deprecated Deprecated. Not used.
</span><span class="cx">  * @param bool $permalink Optional, default is false. Whether to include permalink.
</span><span class="lines">@@ -1194,7 +1194,7 @@
</span><span class="cx">  * @since 2.5.0
</span><span class="cx">  * @uses apply_filters() Calls 'wp_get_attachment_link' filter on HTML content with same parameters as function.
</span><span class="cx">  *
</span><del>- * @param int $id Optional. Post ID.
</del><ins>+ * @param int|WP_Post $id Optional. Post ID or post object.
</ins><span class="cx">  * @param string $size Optional, default is 'thumbnail'. Size of image, either array or string.
</span><span class="cx">  * @param bool $permalink Optional, default is false. Whether to add permalink to image.
</span><span class="cx">  * @param bool $icon Optional, default is false. Whether to include icon.
</span><span class="lines">@@ -1259,7 +1259,7 @@
</span><span class="cx">  *
</span><span class="cx">  * @since 1.0.0
</span><span class="cx">  * @uses apply_filters() Calls 'the_password_form' filter on output.
</span><del>- * @param int|WP_Post $post Optional. A post id or post object. Defaults to the current post when in The Loop, undefined otherwise.
</del><ins>+ * @param int|WP_Post $post Optional. A post ID or post object.
</ins><span class="cx">  * @return string HTML content for password form for password protected post.
</span><span class="cx">  */
</span><span class="cx"> function get_the_password_form( $post = 0 ) {
</span><span class="lines">@@ -1420,7 +1420,7 @@
</span><span class="cx">  * @uses get_edit_post_link()
</span><span class="cx">  * @uses get_the_author_meta()
</span><span class="cx">  *
</span><del>- * @param int|object $post_id Post ID or post object.
</del><ins>+ * @param int|WP_Post $post_id Optional. Post ID or post object.
</ins><span class="cx">  * @param string $type 'all' (default), 'revision' or 'autosave'
</span><span class="cx">  * @return null
</span><span class="cx">  */
</span></span></pre></div>
<a id="trunksrcwpincludespostphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/post.php (27472 => 27473)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/post.php   2014-03-08 06:13:27 UTC (rev 27472)
+++ trunk/src/wp-includes/post.php      2014-03-08 19:31:51 UTC (rev 27473)
</span><span class="lines">@@ -380,7 +380,7 @@
</span><span class="cx">  * @since 1.5.1
</span><span class="cx">  * @link http://codex.wordpress.org/Function_Reference/get_post
</span><span class="cx">  *
</span><del>- * @param int|object $post Post ID or post object. Optional, default is the current post from the loop.
</del><ins>+ * @param int|WP_Post $post Optional. Post ID or post object.
</ins><span class="cx">  * @param string $output Optional, default is Object. Either OBJECT, ARRAY_A, or ARRAY_N.
</span><span class="cx">  * @param string $filter Optional, default is raw.
</span><span class="cx">  * @return WP_Post|null WP_Post on success or null on failure
</span><span class="lines">@@ -710,7 +710,7 @@
</span><span class="cx">  *
</span><span class="cx">  * @since 2.5.0
</span><span class="cx">  *
</span><del>- * @param int|object $post Post ID or post object
</del><ins>+ * @param int|WP_Post $post Post ID or post object.
</ins><span class="cx">  * @return array Ancestor IDs or empty array if none are found.
</span><span class="cx">  */
</span><span class="cx"> function get_post_ancestors( $post ) {
</span><span class="lines">@@ -747,7 +747,7 @@
</span><span class="cx">  * @uses sanitize_post_field() See for possible $context values.
</span><span class="cx">  *
</span><span class="cx">  * @param string $field Post field name.
</span><del>- * @param int|object $post Post ID or post object.
</del><ins>+ * @param int|WP_Post $post Post ID or post object.
</ins><span class="cx">  * @param string $context Optional. How to filter the field. Default is 'display'.
</span><span class="cx">  * @return string The value of the post field on success, empty string on failure.
</span><span class="cx">  */
</span><span class="lines">@@ -771,7 +771,7 @@
</span><span class="cx">  *
</span><span class="cx">  * @since 2.0.0
</span><span class="cx">  *
</span><del>- * @param int $ID Optional. Post ID. Default is the current post from the loop.
</del><ins>+ * @param int|WP_Post $ID Optional. Post ID or post object.
</ins><span class="cx">  * @return string|bool The mime type on success, false on failure.
</span><span class="cx">  */
</span><span class="cx"> function get_post_mime_type($ID = '') {
</span><span class="lines">@@ -791,7 +791,7 @@
</span><span class="cx">  *
</span><span class="cx">  * @since 2.0.0
</span><span class="cx">  *
</span><del>- * @param int $ID Optional. Post ID. Default is the current post from the loop.
</del><ins>+ * @param int|WP_Post $ID Optional. Post ID or post object.
</ins><span class="cx">  * @return string|bool Post status on success, false on failure.
</span><span class="cx">  */
</span><span class="cx"> function get_post_status($ID = '') {
</span><span class="lines">@@ -1025,7 +1025,7 @@
</span><span class="cx">  *
</span><span class="cx">  * @since 2.1.0
</span><span class="cx">  *
</span><del>- * @param int|object $post Optional. Post ID or post object. Default is the current post from the loop.
</del><ins>+ * @param int|WP_Post $post Optional. Post ID or post object.
</ins><span class="cx">  * @return string|bool Post type on success, false on failure.
</span><span class="cx">  */
</span><span class="cx"> function get_post_type( $post = null ) {
</span><span class="lines">@@ -2480,7 +2480,7 @@
</span><span class="cx">  * @uses do_action() on 'trash_post_comments' before trashing
</span><span class="cx">  * @uses do_action() on 'trashed_post_comments' after trashing
</span><span class="cx">  *
</span><del>- * @param int|object $post Post ID or object.
</del><ins>+ * @param int|WP_Post $post Optional. Post ID or post object.
</ins><span class="cx">  * @return mixed False on failure
</span><span class="cx">  */
</span><span class="cx"> function wp_trash_post_comments($post = null) {
</span><span class="lines">@@ -2521,7 +2521,7 @@
</span><span class="cx">  * @uses do_action() on 'untrash_post_comments' before trashing
</span><span class="cx">  * @uses do_action() on 'untrashed_post_comments' after trashing
</span><span class="cx">  *
</span><del>- * @param int|object $post Post ID or object.
</del><ins>+ * @param int|WP_Post $post Optional. Post ID or post object.
</ins><span class="cx">  * @return mixed False on failure
</span><span class="cx">  */
</span><span class="cx"> function wp_untrash_post_comments($post = null) {
</span><span class="lines">@@ -3039,7 +3039,7 @@
</span><span class="cx">  * @uses $wpdb
</span><span class="cx">  * @uses do_action() Calls 'edit_post', 'save_post_{$post_type}', 'save_post' and 'wp_insert_post' on post_id and post data.
</span><span class="cx">  *
</span><del>- * @param int|object $post Post ID or object.
</del><ins>+ * @param int|WP_Post $post Post ID or post object.
</ins><span class="cx">  */
</span><span class="cx"> function wp_publish_post( $post ) {
</span><span class="cx">  global $wpdb;
</span><span class="lines">@@ -3072,7 +3072,7 @@
</span><span class="cx">  *
</span><span class="cx">  * @since 2.5.0
</span><span class="cx">  *
</span><del>- * @param int $post_id Post ID.
</del><ins>+ * @param int|WP_Post $post_id Post ID or post object.
</ins><span class="cx">  * @return null Nothing is returned. Which can mean that no action is required or post was published.
</span><span class="cx">  */
</span><span class="cx"> function check_and_publish_future_post($post_id) {
</span><span class="lines">@@ -4760,7 +4760,7 @@
</span><span class="cx">  *
</span><span class="cx">  * @uses do_action() Calls 'clean_post_cache' on $id before adding children (if any).
</span><span class="cx">  *
</span><del>- * @param int|object $post Post ID or object to remove from the cache
</del><ins>+ * @param int|WP_Post $post Post ID or post object to remove from the cache.
</ins><span class="cx">  */
</span><span class="cx"> function clean_post_cache( $post ) {
</span><span class="cx">  global $_wp_suspend_cache_invalidation, $wpdb;
</span><span class="lines">@@ -5039,7 +5039,7 @@
</span><span class="cx">  *
</span><span class="cx">  * @since 3.1.0
</span><span class="cx">  *
</span><del>- * @param int|object $post Post ID or object where thumbnail should be attached.
</del><ins>+ * @param int|WP_Post $post Post ID or post object where thumbnail should be attached.
</ins><span class="cx">  * @param int $thumbnail_id Thumbnail to attach.
</span><span class="cx">  * @return bool True on success, false on failure.
</span><span class="cx">  */
</span><span class="lines">@@ -5060,7 +5060,7 @@
</span><span class="cx">  *
</span><span class="cx">  * @since 3.3.0
</span><span class="cx">  *
</span><del>- * @param int|object $post Post ID or object where thumbnail should be removed from.
</del><ins>+ * @param int|WP_Post $post Post ID or post object where thumbnail should be removed from.
</ins><span class="cx">  * @return bool True on success, false on failure.
</span><span class="cx">  */
</span><span class="cx"> function delete_post_thumbnail( $post ) {
</span></span></pre></div>
<a id="trunksrcwpincludestaxonomyphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/taxonomy.php (27472 => 27473)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/taxonomy.php       2014-03-08 06:13:27 UTC (rev 27472)
+++ trunk/src/wp-includes/taxonomy.php  2014-03-08 19:31:51 UTC (rev 27473)
</span><span class="lines">@@ -3193,7 +3193,7 @@
</span><span class="cx">  *
</span><span class="cx">  * @since 2.5.0
</span><span class="cx">  *
</span><del>- * @param int $post Optional. Post ID or will use Global Post ID (in loop).
</del><ins>+ * @param int|WP_Post $post Optional. Post ID or post object.
</ins><span class="cx">  * @param array $args Override the defaults.
</span><span class="cx">  * @return array
</span><span class="cx">  */
</span><span class="lines">@@ -3240,7 +3240,7 @@
</span><span class="cx">  * @since 2.5.0
</span><span class="cx">  * @uses get_object_taxonomies()
</span><span class="cx">  *
</span><del>- * @param int $post Optional. Post ID
</del><ins>+ * @param int|WP_Post $post Optional. Post ID or post object.
</ins><span class="cx">  * @return array
</span><span class="cx">  */
</span><span class="cx"> function get_post_taxonomies($post = 0) {
</span></span></pre>
</div>
</div>

</body>
</html>