From 3cfe00b736b2dcd8ba20a1f66dd929c6bda88cd2 Mon Sep 17 00:00:00 2001 From: Derick Alangi Date: Wed, 12 Jun 2019 13:47:06 +0100 Subject: [PATCH] Avoid the use of silence operator (@) and use AtEase methods Bug: T26159 Change-Id: I973cc607fd909d47faf2773a02835af83bbc301f --- includes/shell/Command.php | 5 +++-- maintenance/userOptions.php | 6 ++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/includes/shell/Command.php b/includes/shell/Command.php index 7742075e0f..4ba78688dc 100644 --- a/includes/shell/Command.php +++ b/includes/shell/Command.php @@ -446,8 +446,9 @@ class Command { // stream_select parameter names are from the POV of us being able to do the operation; // proc_open desriptor types are from the POV of the process doing it. // So $writePipes is passed as the $read parameter and $readPipes as $write. - // phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged - $numReadyPipes = @stream_select( $writePipes, $readPipes, $emptyArray, $timeout ); + AtEase::suppressWarnings(); + $numReadyPipes = stream_select( $writePipes, $readPipes, $emptyArray, $timeout ); + AtEase::restoreWarnings(); if ( $numReadyPipes === false ) { $error = error_get_last(); if ( strncmp( $error['message'], $eintrMessage, strlen( $eintrMessage ) ) == 0 ) { diff --git a/maintenance/userOptions.php b/maintenance/userOptions.php index 4c9dcb4667..98f1c24a86 100644 --- a/maintenance/userOptions.php +++ b/maintenance/userOptions.php @@ -107,16 +107,14 @@ The new option is NOT validated.' ); $userValue = $user->getOption( $option ); if ( $userValue <> $defaultOptions[$option] ) { - // phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged - @$ret[$option][$userValue]++; + $ret[$option][$userValue] = ( $ret[$option][$userValue] ?? 0 ) + 1; } } else { foreach ( $defaultOptions as $name => $defaultValue ) { $userValue = $user->getOption( $name ); if ( $userValue != $defaultValue ) { - // phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged - @$ret[$name][$userValue]++; + $ret[$option][$userValue] = ( $ret[$option][$userValue] ?? 0 ) + 1; } } } -- 2.20.1