Completed
Push — fix/codeclimate-reporting ( 039eb8...9d9848 )
by Yaroslav
32:08 queued 24:50
created
class.json-api.php 1 patch
Doc Comments   +18 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,6 +33,9 @@  discard block
 block discarded – undo
33 33
 	public $extra_headers = array();
34 34
 
35 35
 	/**
36
+	 * @param string $method
37
+	 * @param string $url
38
+	 * @param string $post_body
36 39
 	 * @return WPCOM_JSON_API instance
37 40
 	 */
38 41
 	static function init( $method = null, $url = null, $post_body = null ) {
@@ -347,6 +350,9 @@  discard block
 block discarded – undo
347 350
 		return call_user_func_array( array( $endpoint, 'callback' ), $path_pieces );
348 351
 	}
349 352
 
353
+	/**
354
+	 * @param integer $status_code
355
+	 */
350 356
 	function output_early( $status_code, $response = null, $content_type = 'application/json' ) {
351 357
 		$exit       = $this->exit;
352 358
 		$this->exit = false;
@@ -563,11 +569,18 @@  discard block
 block discarded – undo
563 569
 		return wp_json_encode( $data );
564 570
 	}
565 571
 
572
+	/**
573
+	 * @param string $needle
574
+	 */
566 575
 	function ends_with( $haystack, $needle ) {
567 576
 		return $needle === substr( $haystack, -strlen( $needle ) );
568 577
 	}
569 578
 
570 579
 	// Returns the site's blog_id in the WP.com ecosystem
580
+
581
+	/**
582
+	 * @return integer
583
+	 */
571 584
 	function get_blog_id_for_output() {
572 585
 		return $this->token_details['blog_id'];
573 586
 	}
@@ -590,6 +603,10 @@  discard block
 block discarded – undo
590 603
 	}
591 604
 
592 605
 	// Returns true if the specified blog ID is a restricted blog
606
+
607
+	/**
608
+	 * @param integer $blog_id
609
+	 */
593 610
 	function is_restricted_blog( $blog_id ) {
594 611
 		/**
595 612
 		 * Filters all REST API access and return a 403 unauthorized response for all Restricted blog IDs.
@@ -639,7 +656,7 @@  discard block
 block discarded – undo
639 656
 	/**
640 657
 	 * Counts the number of comments on a site, excluding certain comment types.
641 658
 	 *
642
-	 * @param $post_id int Post ID.
659
+	 * @param integer $post_id int Post ID.
643 660
 	 * @return array Array of counts, matching the output of https://developer.wordpress.org/reference/functions/get_comment_count/.
644 661
 	 */
645 662
 	public function wp_count_comments( $post_id ) {
Please login to merge, or discard this patch.
_inc/lib/class.media.php 1 patch
Doc Comments   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	/**
85 85
 	 * Return an array of allowed mime_type items used to upload a media file.
86 86
 	 *
87
-	 * @return array mime_type array
87
+	 * @return string[] mime_type array
88 88
 	 */
89 89
 	static function get_allowed_mime_types( $default_mime_types ) {
90 90
 		return array_unique( array_merge( $default_mime_types, array(
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 	 * @param  object $media_item - media post object
253 253
 	 * @param  file $file - file recently added
254 254
 	 * @param  bool $has_original_media - condition is the original media has been already added
255
-	 * @return bool `true` if the item has been added. Otherwise `false`.
255
+	 * @return false|null `true` if the item has been added. Otherwise `false`.
256 256
 	 */
257 257
 	public static function register_revision( $media_item, $file, $has_original_media ) {
258 258
 		if ( is_wp_error( $file ) || ! $has_original_media ) {
@@ -280,6 +280,9 @@  discard block
 block discarded – undo
280 280
 		return $original;
281 281
 	}
282 282
 
283
+	/**
284
+	 * @param string $pathname
285
+	 */
283 286
 	public static function delete_file( $pathname ) {
284 287
 		if ( ! file_exists( $pathname ) || ! is_file( $pathname ) ) {
285 288
 			// let's touch a fake file to try to `really` remove the media file
@@ -295,7 +298,7 @@  discard block
 block discarded – undo
295 298
 	 *
296 299
 	 * @param  number $media_id - media post ID
297 300
 	 * @param  string $filename - basename of the file ( name-of-file.ext )
298
-	 * @return bool `true` is the file has been removed, `false` if not.
301
+	 * @return boolean|null `true` is the file has been removed, `false` if not.
299 302
 	 */
300 303
 	private static function delete_media_history_file( $media_id, $filename ) {
301 304
 		$attached_path = get_attached_file( $media_id );
@@ -365,6 +368,7 @@  discard block
 block discarded – undo
365 368
 	 *
366 369
 	 * @param  number $media_id - media post ID
367 370
 	 * @param  number [$limit] - maximun amount of items. 20 as default.
371
+	 * @param integer $limit
368 372
 	 * @return array items removed from `revision_history`
369 373
 	 */
370 374
 	public static function limit_revision_history( $media_id, $limit = null) {
Please login to merge, or discard this patch.
class.jetpack-post-images.php 1 patch
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -166,6 +166,7 @@  discard block
 block discarded – undo
166 166
 	/**
167 167
 	 * Get attachment images for a specified post and return them. Also make sure
168 168
 	 * their dimensions are at or above a required minimum.
169
+	 * @param integer $post_id
169 170
 	 */
170 171
 	static function from_attachment( $post_id, $width = 200, $height = 200 ) {
171 172
 		$images = array();
@@ -232,7 +233,7 @@  discard block
 block discarded – undo
232 233
 	 * format to the other images?_from_*() methods.
233 234
 	 *
234 235
 	 * @param  int $post_id The post ID to check
235
-	 * @return Array containing details of the Featured Image, or empty array if none.
236
+	 * @return integer|null containing details of the Featured Image, or empty array if none.
236 237
 	 */
237 238
 	static function from_thumbnail( $post_id, $width = 200, $height = 200 ) {
238 239
 		$images = array();
@@ -687,7 +688,6 @@  discard block
 block discarded – undo
687 688
 	 * resized and cropped image.
688 689
 	 *
689 690
 	 * @param  string $src
690
-	 * @param  int    $dimension
691 691
 	 * @return string            Transformed image URL
692 692
 	 */
693 693
 	static function fit_image_url( $src, $width, $height ) {
Please login to merge, or discard this patch.
class.json-api-endpoints.php 1 patch
Doc Comments   +5 added lines patch added patch discarded remove patch
@@ -1534,6 +1534,7 @@  discard block
 block discarded – undo
1534 1534
 	 * timezone set in the options table for the blog or the GMT offset.
1535 1535
 	 *
1536 1536
 	 * @param datetime string $date_string Date to parse.
1537
+	 * @param string $date_string
1537 1538
 	 *
1538 1539
 	 * @return array( $local_time_string, $gmt_time_string )
1539 1540
 	 */
@@ -1643,6 +1644,10 @@  discard block
 block discarded – undo
1643 1644
 		do_action( 'restapi_theme_init' );
1644 1645
 	}
1645 1646
 
1647
+	/**
1648
+	 * @param string $from_hook
1649
+	 * @param string $to_hook
1650
+	 */
1646 1651
 	function copy_hooks( $from_hook, $to_hook, $base_paths ) {
1647 1652
 		global $wp_filter;
1648 1653
 		foreach ( $wp_filter as $hook => $actions ) {
Please login to merge, or discard this patch.
_inc/lib/class.color.php 1 patch
Doc Comments   +13 added lines, -1 removed lines patch added patch discarded remove patch
@@ -149,6 +149,9 @@  discard block
 block discarded – undo
149 149
 
150 150
 	/**
151 151
 	 * Helper function for Jetpack_Color::fromHsl()
152
+	 * @param double $p
153
+	 * @param double $q
154
+	 * @param integer $t
152 155
 	 */
153 156
 	private function hue2rgb( $p, $q, $t ) {
154 157
 		if ( $t < 0 ) $t += 1;
@@ -498,7 +501,7 @@  discard block
 block discarded – undo
498 501
 	 *
499 502
 	 * @param Jetpack_Color $color
500 503
 	 *
501
-	 * @return int
504
+	 * @return double
502 505
 	 */
503 506
 	public function getDistanceRgbFrom(Jetpack_Color $color)
504 507
 	{
@@ -687,6 +690,9 @@  discard block
 block discarded – undo
687 690
 		return $this->incrementLightness( $amount );
688 691
 	}
689 692
 
693
+	/**
694
+	 * @param integer $amount
695
+	 */
690 696
 	public function incrementLightness( $amount ) {
691 697
 		$hsl = $this->toHsl();
692 698
 		extract( $hsl );
@@ -704,6 +710,9 @@  discard block
 block discarded – undo
704 710
 		return $this->incrementSaturation( - $amount );
705 711
 	}
706 712
 
713
+	/**
714
+	 * @param integer $amount
715
+	 */
707 716
 	public function incrementSaturation( $amount ) {
708 717
 		$hsl = $this->toHsl();
709 718
 		extract( $hsl );
@@ -744,6 +753,9 @@  discard block
 block discarded – undo
744 753
 		return $this->incrementHue( $incr );
745 754
 	}
746 755
 
756
+	/**
757
+	 * @param integer $amount
758
+	 */
747 759
 	public function incrementHue( $amount ) {
748 760
 		$hsl = $this->toHsl();
749 761
 		extract( $hsl );
Please login to merge, or discard this patch.
_inc/lib/class.media-summary.php 1 patch
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -271,6 +271,9 @@  discard block
 block discarded – undo
271 271
 		}
272 272
 	}
273 273
 
274
+	/**
275
+	 * @param string $type
276
+	 */
274 277
 	static function get_video_poster( $type, $id ) {
275 278
 		if ( 'videopress' == $type ) {
276 279
 			if ( function_exists( 'video_get_highest_resolution_image_url' ) ) {
@@ -356,6 +359,9 @@  discard block
 block discarded – undo
356 359
 		return (int) count( self::split_content_in_words( self::clean_text( $post_content ) ) );
357 360
 	}
358 361
 
362
+	/**
363
+	 * @param string $excerpt_content
364
+	 */
359 365
 	static function get_word_remaining_count( $post_content, $excerpt_content ) {
360 366
 		$content_word_count = count( self::split_content_in_words( self::clean_text( $post_content ) ) );
361 367
 		$excerpt_word_count = count( self::split_content_in_words( self::clean_text( $excerpt_content ) ) );
Please login to merge, or discard this patch.
class.jetpack.php 1 patch
Doc Comments   +32 added lines, -18 removed lines patch added patch discarded remove patch
@@ -807,7 +807,7 @@  discard block
 block discarded – undo
807 807
 	 * This is ported over from the manage module, which has been deprecated and baked in here.
808 808
 	 *
809 809
 	 * @param $domains
810
-	 * @return array
810
+	 * @return string[]
811 811
 	 */
812 812
 	function allow_wpcom_domain( $domains ) {
813 813
 		if ( empty( $domains ) ) {
@@ -1222,7 +1222,7 @@  discard block
 block discarded – undo
1222 1222
 	/**
1223 1223
 	 * Does the network allow admins to add new users.
1224 1224
 	 *
1225
-	 * @return boolian
1225
+	 * @return boolean
1226 1226
 	 */
1227 1227
 	static function network_add_new_users( $option = null ) {
1228 1228
 		return (bool) get_site_option( 'add_new_users' );
@@ -1332,7 +1332,7 @@  discard block
 block discarded – undo
1332 1332
 	 *
1333 1333
 	 * @param  bool $option
1334 1334
 	 *
1335
-	 * @return boolean
1335
+	 * @return string
1336 1336
 	 */
1337 1337
 	public function is_main_network_option( $option ) {
1338 1338
 		// return '1' or ''
@@ -1343,7 +1343,7 @@  discard block
 block discarded – undo
1343 1343
 	 * Return true if we are with multi-site or multi-network false if we are dealing with single site.
1344 1344
 	 *
1345 1345
 	 * @param  string $option
1346
-	 * @return boolean
1346
+	 * @return string
1347 1347
 	 */
1348 1348
 	public function is_multisite( $option ) {
1349 1349
 		return (string) (bool) is_multisite();
@@ -1406,7 +1406,7 @@  discard block
 block discarded – undo
1406 1406
 	/**
1407 1407
 	 * Returns true if the site has file write access false otherwise.
1408 1408
 	 *
1409
-	 * @return string ( '1' | '0' )
1409
+	 * @return integer ( '1' | '0' )
1410 1410
 	 **/
1411 1411
 	public static function file_system_write_access() {
1412 1412
 		if ( ! function_exists( 'get_filesystem_method' ) ) {
@@ -2142,7 +2142,7 @@  discard block
 block discarded – undo
2142 2142
 	 * @param int    $user_id The user id.
2143 2143
 	 * @param string $token The user token.
2144 2144
 	 * @param bool   $is_master_user Whether the user is the master user.
2145
-	 * @return bool
2145
+	 * @return boolean|null
2146 2146
 	 */
2147 2147
 	public static function update_user_token( $user_id, $token, $is_master_user ) {
2148 2148
 		_deprecated_function( __METHOD__, 'jetpack-8.0', 'Automattic\\Jetpack\\Connection\\Utils::update_user_token' );
@@ -2585,7 +2585,7 @@  discard block
 block discarded – undo
2585 2585
 	 *
2586 2586
 	 * @param string $tag Tag as it appears in each module heading.
2587 2587
 	 *
2588
-	 * @return mixed
2588
+	 * @return string
2589 2589
 	 */
2590 2590
 	public static function translate_module_tag( $tag ) {
2591 2591
 		return jetpack_get_module_i18n_tag( $tag );
@@ -2757,8 +2757,8 @@  discard block
 block discarded – undo
2757 2757
 	 * Rewrites ABSPATH (eg `/home/jetpack/wordpress/`) to ABSPATH, and if WP_CONTENT_DIR
2758 2758
 	 * is located outside of ABSPATH, rewrites that to WP_CONTENT_DIR.
2759 2759
 	 *
2760
-	 * @param $string
2761
-	 * @return mixed
2760
+	 * @param string $string
2761
+	 * @return string|null
2762 2762
 	 */
2763 2763
 	public static function alias_directories( $string ) {
2764 2764
 		// ABSPATH has a trailing slash.
@@ -2769,6 +2769,10 @@  discard block
 block discarded – undo
2769 2769
 		return $string;
2770 2770
 	}
2771 2771
 
2772
+	/**
2773
+	 * @param boolean $redirect
2774
+	 * @param boolean $send_state_messages
2775
+	 */
2772 2776
 	public static function activate_default_modules(
2773 2777
 		$min_version = false,
2774 2778
 		$max_version = false,
@@ -3052,6 +3056,9 @@  discard block
 block discarded – undo
3052 3056
 		return self::update_active_modules( $new );
3053 3057
 	}
3054 3058
 
3059
+	/**
3060
+	 * @param string $module
3061
+	 */
3055 3062
 	public static function enable_module_configurable( $module ) {
3056 3063
 		$module = self::get_module_slug( $module );
3057 3064
 		add_filter( 'jetpack_module_configurable_' . $module, '__return_true' );
@@ -3080,6 +3087,10 @@  discard block
 block discarded – undo
3080 3087
 	}
3081 3088
 
3082 3089
 	/* Installation */
3090
+
3091
+	/**
3092
+	 * @param string $message
3093
+	 */
3083 3094
 	public static function bail_on_activation( $message, $deactivate = true ) {
3084 3095
 		?>
3085 3096
 <!doctype html>
@@ -3829,7 +3840,7 @@  discard block
 block discarded – undo
3829 3840
 	 * Add help to the Jetpack page
3830 3841
 	 *
3831 3842
 	 * @since Jetpack (1.2.3)
3832
-	 * @return false if not the Jetpack page
3843
+	 * @return false|null if not the Jetpack page
3833 3844
 	 */
3834 3845
 	function admin_help() {
3835 3846
 		$current_screen = get_current_screen();
@@ -5126,7 +5137,7 @@  discard block
 block discarded – undo
5126 5137
 	 * @param String  $action  The action name.
5127 5138
 	 * @param Integer $user_id The user identifier.
5128 5139
 	 * @param Integer $exp     Expiration time in seconds.
5129
-	 * @return array
5140
+	 * @return boolean
5130 5141
 	 */
5131 5142
 	public static function generate_secrets( $action, $user_id = false, $exp = 600 ) {
5132 5143
 		return self::connection()->generate_secrets( $action, $user_id, $exp );
@@ -5433,7 +5444,6 @@  discard block
 block discarded – undo
5433 5444
 	/**
5434 5445
 	 * Report authentication status to the WP REST API.
5435 5446
 	 *
5436
-	 * @param  WP_Error|mixed $result Error from another authentication handler, null if we should handle it, or another value if not
5437 5447
 	 * @return WP_Error|boolean|null {@see WP_JSON_Server::check_authentication}
5438 5448
 	 */
5439 5449
 	public function wp_rest_authentication_errors( $value ) {
@@ -5535,6 +5545,7 @@  discard block
 block discarded – undo
5535 5545
 	 * @param string $key
5536 5546
 	 * @param string $value
5537 5547
 	 * @param bool   $restate private
5548
+	 * @return string
5538 5549
 	 */
5539 5550
 	public static function state( $key = null, $value = null, $restate = false ) {
5540 5551
 		static $state = array();
@@ -5593,6 +5604,9 @@  discard block
 block discarded – undo
5593 5604
 		self::state( null, null, true );
5594 5605
 	}
5595 5606
 
5607
+	/**
5608
+	 * @param string $file
5609
+	 */
5596 5610
 	public static function check_privacy( $file ) {
5597 5611
 		static $is_site_publicly_accessible = null;
5598 5612
 
@@ -5673,6 +5687,9 @@  discard block
 block discarded – undo
5673 5687
 		}
5674 5688
 	}
5675 5689
 
5690
+	/**
5691
+	 * @param string $url
5692
+	 */
5676 5693
 	public static function staticize_subdomain( $url ) {
5677 5694
 
5678 5695
 		// Extract hostname from URL
@@ -6242,9 +6259,7 @@  discard block
 block discarded – undo
6242 6259
 	 *
6243 6260
 	 * Attached to `style_loader_src` filter.
6244 6261
 	 *
6245
-	 * @param string $tag The tag that would link to the external asset.
6246 6262
 	 * @param string $handle The registered handle of the script in question.
6247
-	 * @param string $href The url of the asset in question.
6248 6263
 	 */
6249 6264
 	public static function set_suffix_on_min( $src, $handle ) {
6250 6265
 		if ( false === strpos( $src, '.min.css' ) ) {
@@ -6435,8 +6450,8 @@  discard block
 block discarded – undo
6435 6450
 	 *  - Absolute URLs             `http://domain.com/feh.png`
6436 6451
 	 *  - Domain root relative URLs `/feh.png`
6437 6452
 	 *
6438
-	 * @param $css string: The raw CSS -- should be read in directly from the file.
6439
-	 * @param $css_file_url : The URL that the file can be accessed at, for calculating paths from.
6453
+	 * @param string $css string: The raw CSS -- should be read in directly from the file.
6454
+	 * @param string $css_file_url : The URL that the file can be accessed at, for calculating paths from.
6440 6455
 	 *
6441 6456
 	 * @return mixed|string
6442 6457
 	 */
@@ -6697,7 +6712,7 @@  discard block
 block discarded – undo
6697 6712
 	/**
6698 6713
 	 * Stores and prints out domains to prefetch for page speed optimization.
6699 6714
 	 *
6700
-	 * @param mixed $new_urls
6715
+	 * @param string[] $new_urls
6701 6716
 	 */
6702 6717
 	public static function dns_prefetch( $new_urls = null ) {
6703 6718
 		static $prefetch_urls = array();
@@ -6754,7 +6769,6 @@  discard block
 block discarded – undo
6754 6769
 	}
6755 6770
 
6756 6771
 	/**
6757
-	 * @param mixed $result Value for the user's option
6758 6772
 	 * @return mixed
6759 6773
 	 */
6760 6774
 	function get_user_option_meta_box_order_dashboard( $sorted ) {
Please login to merge, or discard this patch.