wp/wp-includes/class-wp-tax-query.php
changeset 16 a86126ab1dd4
parent 9 177826044cd9
child 19 3d72ae0968f4
--- a/wp/wp-includes/class-wp-tax-query.php	Tue Oct 22 16:11:46 2019 +0200
+++ b/wp/wp-includes/class-wp-tax-query.php	Tue Dec 15 13:49:49 2020 +0100
@@ -96,8 +96,8 @@
 	 *
 	 *     @type string $relation Optional. The MySQL keyword used to join
 	 *                            the clauses of the query. Accepts 'AND', or 'OR'. Default 'AND'.
-	 *     @type array {
-	 *         Optional. An array of first-order clause parameters, or another fully-formed tax query.
+	 *     @type array  ...$0 {
+	 *         An array of first-order clause parameters, or another fully-formed tax query.
 	 *
 	 *         @type string           $taxonomy         Taxonomy being queried. Optional when field=term_taxonomy_id.
 	 *         @type string|int|array $terms            Term or terms to filter by.
@@ -388,7 +388,8 @@
 			'join'  => array(),
 		);
 
-		$join = $where = '';
+		$join  = '';
+		$where = '';
 
 		$this->clean_query( $clause );
 
@@ -399,7 +400,7 @@
 		$terms    = $clause['terms'];
 		$operator = strtoupper( $clause['operator'] );
 
-		if ( 'IN' == $operator ) {
+		if ( 'IN' === $operator ) {
 
 			if ( empty( $terms ) ) {
 				return self::$no_results;
@@ -429,7 +430,7 @@
 
 			$where = "$alias.term_taxonomy_id $operator ($terms)";
 
-		} elseif ( 'NOT IN' == $operator ) {
+		} elseif ( 'NOT IN' === $operator ) {
 
 			if ( empty( $terms ) ) {
 				return $sql;
@@ -443,7 +444,7 @@
 				WHERE term_taxonomy_id IN ($terms)
 			)";
 
-		} elseif ( 'AND' == $operator ) {
+		} elseif ( 'AND' === $operator ) {
 
 			if ( empty( $terms ) ) {
 				return $sql;
@@ -496,14 +497,14 @@
 	 *
 	 * @since 4.1.0
 	 *
-	 * @param array       $clause       Query clause.
-	 * @param array       $parent_query Parent query of $clause.
+	 * @param array $clause       Query clause.
+	 * @param array $parent_query Parent query of $clause.
 	 * @return string|false Table alias if found, otherwise false.
 	 */
 	protected function find_compatible_table_alias( $clause, $parent_query ) {
 		$alias = false;
 
-		// Sanity check. Only IN queries use the JOIN syntax .
+		// Sanity check. Only IN queries use the JOIN syntax.
 		if ( ! isset( $clause['operator'] ) || 'IN' !== $clause['operator'] ) {
 			return $alias;
 		}
@@ -525,7 +526,7 @@
 			}
 
 			// The sibling must both have compatible operator to share its alias.
-			if ( in_array( strtoupper( $sibling['operator'] ), $compatible_operators ) ) {
+			if ( in_array( strtoupper( $sibling['operator'] ), $compatible_operators, true ) ) {
 				$alias = $sibling['alias'];
 				break;
 			}
@@ -548,7 +549,7 @@
 				return;
 			}
 
-			// so long as there are shared terms, include_children requires that a taxonomy is set
+			// So long as there are shared terms, 'include_children' requires that a taxonomy is set.
 			$query['include_children'] = false;
 		} elseif ( ! taxonomy_exists( $query['taxonomy'] ) ) {
 			$query = new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) );
@@ -640,7 +641,7 @@
 			return;
 		}
 
-		if ( 'AND' == $query['operator'] && count( $term_list ) < count( $query['terms'] ) ) {
+		if ( 'AND' === $query['operator'] && count( $term_list ) < count( $query['terms'] ) ) {
 			$query = new WP_Error( 'inexistent_terms', __( 'Inexistent terms.' ) );
 			return;
 		}