Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix "phpdoc_no_empty_return" CS #9302

Merged
merged 5 commits into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@
'style' => 'post',
],
'no_useless_else' => false,
'phpdoc_no_empty_return' => false,
'psr_autoloading' => false,
'strict_comparison' => false,
'string_length_to_empty' => false,
Expand Down
4 changes: 2 additions & 2 deletions plugins/example_addressbook/example_addressbook_backend.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function get_name()
return $this->name;
}

public function set_search_set($filter)
public function set_search_set($filter): void
{
$this->filter = $filter;
}
Expand All @@ -84,7 +84,7 @@ public function get_search_set()
return $this->filter;
}

public function reset()
public function reset(): void
{
$this->result = null;
$this->filter = null;
Expand Down
4 changes: 1 addition & 3 deletions plugins/password/drivers/plesk.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,8 @@ class plesk_rpc
* @param string $path plesk rpc path
* @param string $user plesk user
* @param string $user plesk password
*
* @return void
*/
public function init($host, $port, $path, $user, $pass)
public function init($host, $port, $path, $user, $pass): void
{
$headers = [
sprintf('HTTP_AUTH_LOGIN: %s', $user),
Expand Down
42 changes: 10 additions & 32 deletions program/include/rcmail_oauth.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,8 @@ public static function get_instance($options = [])

/**
* Helper to log oauth
*
* @return void
*/
private function logger($level, $message)
private function logger($level, $message): void
{
$token = $this->login_phase['token'] ?? $_SESSION['oauth_token'] ?? [];
$sub = $token['identity']['sub'] ?? '-';
Expand All @@ -124,10 +122,8 @@ private function logger($level, $message)
* Helper to log oauth debug message (only if `oauth_debug`is true)
*
* XXX for debug only, please use rcube::raise_error to raise errors in a centralized place
*
* @return void
*/
public function log_debug(...$args)
public function log_debug(...$args): void
{
if ($this->options['debug']) {
$this->logger('DEBUG', sprintf(...$args));
Expand Down Expand Up @@ -215,11 +211,9 @@ public function __construct($options = [])
*
* use cache if defined
*
* @return void
*
* @see https://datatracker.ietf.org/doc/html/rfc8414
*/
protected function discover()
protected function discover(): void
{
$config_uri = $this->options['config_uri'];
if (empty($config_uri)) {
Expand Down Expand Up @@ -279,10 +273,8 @@ protected function discover()

/**
* Fetch JWKS certificates (use cache if active)
*
* @return void
*/
protected function fetch_jwks()
protected function fetch_jwks(): void
{
if (!$this->options['jwks_uri']) {
// not activated
Expand Down Expand Up @@ -319,10 +311,8 @@ protected function fetch_jwks()

/**
* Initialize this instance
*
* @return void
*/
public function init()
public function init(): void
{
// important must be called before is_enabled()
$this->discover();
Expand Down Expand Up @@ -381,8 +371,6 @@ public function get_last_error()
*
* Append Oauth button on login page if defined (this is a hook)
* can also hide default user/pass form if flag oauth_login_redirect is true
*
* @return void
*/
public function loginform_content(array $form_content)
{
Expand Down Expand Up @@ -506,10 +494,8 @@ public function get_redirect_uri()
* Authorization Code Request
*
* @see https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.1
*
* @return void
*/
public function login_redirect()
public function login_redirect(): void
{
if (empty($this->options['auth_uri']) || empty($this->options['client_id'])) {
// log error about missing config options
Expand Down Expand Up @@ -809,10 +795,8 @@ public function refresh_access_token(array $token)
* Warning: cache TTL should be at least > refresh_token frequency
*
* @param string $sub the sub of the identity
*
* @return void
*/
public function schedule_token_revocation($sub)
public function schedule_token_revocation($sub): void
{
if ($this->cache === null) {
rcube::raise_error(['message' => 'received a token revocation request, you must activate `oauth_cache` to enable this feature'], true, false);
Expand Down Expand Up @@ -943,10 +927,8 @@ protected function parse_tokens($grant_type, &$data, $previous_data = null)
* Modify some properties of the received auth response
*
* @param array $data
*
* @return void
*/
protected function mask_auth_data(&$data)
protected function mask_auth_data(&$data): void
{
// remove by security access_token as it is crypted in $_SESSION['password']
unset($data['access_token']);
Expand Down Expand Up @@ -1010,10 +992,8 @@ protected function check_token_validity($token)
* Callback for 'refresh' hook
*
* @param array $options
*
* @return void
*/
public function refresh($options)
public function refresh($options): void
{
if (!isset($_SESSION['oauth_token'])) {
return;
Expand Down Expand Up @@ -1271,11 +1251,9 @@ public function startup(array $args)
* will generate during the logout task the RP-initiated Logout URL and
* store it in `logout_redirect_url`
*
* @return void
*
* @see https://openid.net/specs/openid-connect-rpinitiated-1_0.html
*/
public function handle_logout()
public function handle_logout(): void
{
// if no logout URI, or no refresh token, safe to give up
if (!$this->options['logout_uri'] || !isset($_SESSION['oauth_token'])) {
Expand Down
10 changes: 2 additions & 8 deletions program/include/rcmail_output.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ abstract public function add_label(...$args);
*
* @param string $name Object name
* @param callable $func Function name to call
*
* @return void
*/
public function add_handler($name, $func)
{
Expand All @@ -106,8 +104,6 @@ public function add_handler($name, $func)
* Register a list of template object handlers
*
* @param array $handlers Hash array with object=>handler pairs
*
* @return void
*/
public function add_handlers($handlers)
{
Expand All @@ -119,8 +115,6 @@ public function add_handlers($handlers)
*
* @param string $header The header string
* @param bool $replace Replace previously set header?
*
* @return void
*/
public function header($header, $replace = true)
{
Expand All @@ -133,7 +127,7 @@ public function header($header, $replace = true)
* @param string $body The output body
* @param array $headers Headers
*
* @return void
* @return never
*/
public function sendExit($body = '', $headers = [])
{
Expand All @@ -151,7 +145,7 @@ public function sendExit($body = '', $headers = [])
* @param int $code The HTTP error code
* @param string $message The HTTP error message
*
* @return void
* @return never
*/
public function sendExitError($code, $message = '')
{
Expand Down
4 changes: 1 addition & 3 deletions program/include/rcmail_output_html.php
Original file line number Diff line number Diff line change
Expand Up @@ -2407,10 +2407,8 @@ protected function login_form($attrib)
* Loads javascript code for images preloading
*
* @param array $attrib Named parameters
*
* @return void
*/
protected function preloader($attrib)
protected function preloader($attrib): void
{
$images = preg_split('/[\s\t\n,]+/', $attrib['images'], -1, \PREG_SPLIT_NO_EMPTY);
$images = array_map([$this, 'abs_url'], $images);
Expand Down
8 changes: 2 additions & 6 deletions program/lib/Roundcube/rcube_addressbook.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,8 @@ abstract public function get_name();
* operation.
*
* @param mixed $filter Search params to use in listing method, obtained by get_search_set()
*
* @return void
*/
abstract public function set_search_set($filter);
abstract public function set_search_set($filter): void;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is small BC breaking change, it should be fine for master


/**
* Getter for saved search properties.
Expand All @@ -143,10 +141,8 @@ abstract public function get_search_set();

/**
* Reset saved results and search parameters
*
* @return void
*/
abstract public function reset();
abstract public function reset(): void;

/**
* Refresh saved search set after data has changed
Expand Down
4 changes: 2 additions & 2 deletions program/lib/Roundcube/rcube_contacts.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function get_name()
*
* @param string $filter SQL params to use in listing method
*/
public function set_search_set($filter)
public function set_search_set($filter): void
{
$this->filter = $filter;
$this->cache = null;
Expand Down Expand Up @@ -119,7 +119,7 @@ public function set_group($gid)
/**
* Reset all saved results and search parameters
*/
public function reset()
public function reset(): void
{
$this->result = null;
$this->filter = null;
Expand Down
4 changes: 2 additions & 2 deletions program/lib/Roundcube/rcube_ldap.php
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ public function set_sort_order($sort_col, $sort_order = null)
*
* @param string $filter Filter string
*/
public function set_search_set($filter)
public function set_search_set($filter): void
{
$this->filter = $filter;
}
Expand All @@ -584,7 +584,7 @@ public function get_search_set()
/**
* Reset all saved results and search parameters
*/
public function reset()
public function reset(): void
{
$this->result = null;
$this->ldap_result = null;
Expand Down
4 changes: 1 addition & 3 deletions tests/Browser/Components/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@ public function selector()
* Assert that the browser page contains the component.
*
* @param Browser $browser
*
* @return void
*/
public function assert($browser)
public function assert($browser): void
{
// Assume the app (window.rcmail) is always available
// we can't assert that before we visit the page
Expand Down
4 changes: 1 addition & 3 deletions tests/Browser/Components/Dialog.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@ public function selector()
* Assert that the browser page contains the component.
*
* @param Browser $browser
*
* @return void
*/
public function assert($browser)
public function assert($browser): void
{
$browser->waitFor($this->selector());
}
Expand Down
4 changes: 1 addition & 3 deletions tests/Browser/Components/HtmlEditor.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,8 @@ public function selector()
* Assert that the browser page contains the component.
*
* @param Browser $browser
*
* @return void
*/
public function assert($browser)
public function assert($browser): void
{
$browser->waitFor($this->selector() . '.html-editor');
}
Expand Down
4 changes: 1 addition & 3 deletions tests/Browser/Components/Popupmenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,8 @@ public function selector()
* Assert that the browser page contains the component.
*
* @param Browser $browser
*
* @return void
*/
public function assert($browser)
public function assert($browser): void
{
$browser->waitFor($this->selector());
}
Expand Down
4 changes: 1 addition & 3 deletions tests/Browser/Components/RecipientInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,8 @@ public function selector()
* Assert that the browser page contains the component.
*
* @param Browser $browser
*
* @return void
*/
public function assert($browser)
public function assert($browser): void
{
$browser->waitFor($this->selector() . ' @input');
}
Expand Down
4 changes: 1 addition & 3 deletions tests/Browser/Components/Taskmenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@ public function selector()
* Assert that the browser page contains the component.
*
* @param Browser $browser
*
* @return void
*/
public function assert($browser)
public function assert($browser): void
{
if ($browser->isPhone()) {
$browser->assertPresent($this->selector());
Expand Down
4 changes: 1 addition & 3 deletions tests/Browser/Components/Toolbarmenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@ public function selector()
* Assert that the browser page contains the component.
*
* @param Browser $browser
*
* @return void
*/
public function assert($browser)
public function assert($browser): void
{
if ($browser->isPhone()) {
$browser->assertPresent($this->selector());
Expand Down
4 changes: 1 addition & 3 deletions tests/Browser/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,8 @@ protected function newBrowser($driver)
* Prepare for Dusk test execution.
*
* @beforeClass
*
* @return void
*/
public static function prepare()
public static function prepare(): void
{
static::startWebServer();
static::startChromeDriver();
Expand Down
4 changes: 1 addition & 3 deletions tests/Browser/install.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@ class Installer extends Laravel\Dusk\Console\ChromeDriverCommand
* Execute the console command.
*
* @param string $version
*
* @return void
*/
public function install($version = '')
public function install($version = ''): void
{
$os = Laravel\Dusk\OperatingSystem::id();
$version = trim($version);
Expand Down
Loading