Use return type hint instead of docblock to tell PHP the return type

[MAILPOET-4814]
This commit is contained in:
Rodrigo Primo
2023-01-18 15:25:14 -03:00
committed by Aschepikov
parent e37daa6c66
commit 8d57e81b99

View File

@@ -11,17 +11,11 @@ use MailPoet\Settings\SettingsController;
* MailPoet task that is added to the WooCommerce homepage.
*/
class MailPoetTask extends Task {
/**
* @return string
*/
public function get_id() { // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
public function get_id(): string { // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
return 'mailpoet_task';
}
/**
* @return string
*/
public function get_title() { // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
public function get_title(): string { // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
if ($this->is_complete()) {
return esc_html__( 'MailPoet setup completed', 'mailpoet' );
}
@@ -29,28 +23,21 @@ class MailPoetTask extends Task {
return esc_html__( 'Setup MailPoet', 'mailpoet' );
}
/**
* @return string
*/
public function get_content() { // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
public function get_content(): string { // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
return '';
}
/**
* String that is displayed below the title of the task indicating the estimated completion time.
*
* @return string
*/
public function get_time() { // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
public function get_time(): string { // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
return '';
}
/**
* Link used when the user clicks on the title of the task.
*
* @return string
*/
public function get_action_url() { // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
public function get_action_url(): string { // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
if ($this->is_complete()) {
return admin_url('admin.php?page=' . Menu::MAIN_PAGE_SLUG);
}
@@ -62,10 +49,8 @@ class MailPoetTask extends Task {
* Whether the task is completed.
* If the setting 'version' is not null it means the welcome wizard
* was already completed so we mark this task as completed as well.
*
* @return bool
*/
public function is_complete() { // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
public function is_complete(): bool { // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
$settings = ContainerWrapper::getInstance()->get(SettingsController::class);
$version = $settings->get('version');