Ignore specific phpcs warnings

This commit is contained in:
Justin Foell
2018-03-28 09:03:52 -05:00
parent 7a8e0f170f
commit bcaaff6754
3 changed files with 8 additions and 8 deletions
+3 -3
View File
@@ -103,10 +103,10 @@ class Polyline {
*/
final public static function decode( $string ) {
$points = array();
$index = $i = 0;
$index = $i = 0; // phpcs:ignore Squiz.PHP.DisallowMultipleAssignments.Found
$previous = array( 0, 0 );
while ( $i < strlen( $string ) ) {
$shift = $result = 0x00;
while ( $i < strlen( $string ) ) { // phpcs:ignore Squiz.PHP.DisallowSizeFunctionsInLoops.Found
$shift = $result = 0x00; // phpcs:ignore Squiz.PHP.DisallowMultipleAssignments.Found
do {
$bit = ord( substr( $string, $i++ ) ) - 63;
$result |= ( $bit & 0x1f ) << $shift;
+3 -3
View File
@@ -30,7 +30,7 @@ class WPStrava_API {
return $response;
}
if ( 200 != $response['response']['code'] ) {
if ( 200 != $response['response']['code'] ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
// See if there's useful info in the body.
$body = json_decode( $response['body'] );
@@ -74,14 +74,14 @@ class WPStrava_API {
return $response;
}
if ( 200 != $response['response']['code'] ) {
if ( 200 != $response['response']['code'] ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
// See if there's useful info in the body.
$body = json_decode( $response['body'] );
$error = '';
if ( ! empty( $body->error ) ) {
$error = $body->error;
} elseif ( 503 == $response['response']['code'] ) {
} elseif ( 503 == $response['response']['code'] ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
$error = __( 'Strava Temporarily Unavailable', 'wp-strava' );
} else {
$error = print_r( $response, true ); // phpcs:ignore -- Debug output.
+2 -2
View File
@@ -115,13 +115,13 @@ class WPStrava_LatestMapWidget extends WP_Widget {
// Compare transient (temporary storage) to option (more permenant).
// If the option isn't set or the transient is different, update the option.
if ( empty( $activity_option->id ) || $activity->id != $activity_option->id ) {
if ( empty( $activity_option->id ) || $activity->id != $activity_option->id ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
$build_new = true;
$this->update_activity( $id, $activity );
}
// Update the transient if it needs updating.
if ( empty( $activity_transient->id ) || $activity->id != $activity_transient->id ) {
if ( empty( $activity_transient->id ) || $activity->id != $activity_transient->id ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
$this->update_activity_transient( $id, $activity );
}
}