From c51002398d63ccd93562996761c662a297512ff7 Mon Sep 17 00:00:00 2001 From: Andre Klapper Date: Tue, 29 Apr 2025 14:19:22 +0300 Subject: [PATCH] Fix invalid return values for void Summary: Remove or correct wrong @return types in PHPDoc and/or correct wrong return values in methods. Test Plan: Run static code analysis; read code; check method in parent class and other callers, etc. Reviewers: O1 Blessed Committers, valerio.bozzolan Reviewed By: O1 Blessed Committers, valerio.bozzolan Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno Differential Revision: https://we.phorge.it/D25979 --- src/applications/drydock/worker/DrydockLeaseUpdateWorker.php | 2 +- src/applications/metamta/storage/PhabricatorMetaMTAMail.php | 2 -- .../people/phid/PhabricatorPeopleUserEmailPHIDType.php | 2 -- .../search/query/PhabricatorSearchDocumentQuery.php | 1 - src/infrastructure/customfield/field/PhabricatorCustomField.php | 2 -- .../customfield/field/PhabricatorCustomFieldList.php | 2 +- .../daemon/workers/query/PhabricatorWorkerTriggerQuery.php | 1 - .../daemon/workers/storage/PhabricatorWorkerTrigger.php | 1 - 8 files changed, 2 insertions(+), 11 deletions(-) diff --git a/src/applications/drydock/worker/DrydockLeaseUpdateWorker.php b/src/applications/drydock/worker/DrydockLeaseUpdateWorker.php index b4066a847f..12c3cf70be 100644 --- a/src/applications/drydock/worker/DrydockLeaseUpdateWorker.php +++ b/src/applications/drydock/worker/DrydockLeaseUpdateWorker.php @@ -169,7 +169,7 @@ final class DrydockLeaseUpdateWorker extends DrydockWorker { * acquire the lease. * * @param DrydockLease $lease Requested lease. - * @return void + * @return DrydockResource * @task allocator */ private function executeAllocator(DrydockLease $lease) { diff --git a/src/applications/metamta/storage/PhabricatorMetaMTAMail.php b/src/applications/metamta/storage/PhabricatorMetaMTAMail.php index 6c1aa4bd6a..ca102ae8ac 100644 --- a/src/applications/metamta/storage/PhabricatorMetaMTAMail.php +++ b/src/applications/metamta/storage/PhabricatorMetaMTAMail.php @@ -531,8 +531,6 @@ final class PhabricatorMetaMTAMail /** * Attempt to deliver an email immediately, in this process. - * - * @return void */ public function sendNow() { if ($this->getStatus() != PhabricatorMailOutboundStatus::STATUS_QUEUE) { diff --git a/src/applications/people/phid/PhabricatorPeopleUserEmailPHIDType.php b/src/applications/people/phid/PhabricatorPeopleUserEmailPHIDType.php index 206b27d77e..19c81b2db1 100644 --- a/src/applications/people/phid/PhabricatorPeopleUserEmailPHIDType.php +++ b/src/applications/people/phid/PhabricatorPeopleUserEmailPHIDType.php @@ -34,8 +34,6 @@ final class PhabricatorPeopleUserEmailPHIDType $email = $objects[$phid]; $handle->setName($email->getAddress()); } - - return null; } } diff --git a/src/applications/search/query/PhabricatorSearchDocumentQuery.php b/src/applications/search/query/PhabricatorSearchDocumentQuery.php index 7282b33efb..48a4b12828 100644 --- a/src/applications/search/query/PhabricatorSearchDocumentQuery.php +++ b/src/applications/search/query/PhabricatorSearchDocumentQuery.php @@ -105,7 +105,6 @@ final class PhabricatorSearchDocumentQuery protected function nextPage(array $page) { // We already updated the internal offset in `loadPage()` after loading // results, so we do not need to make any additional state updates here. - return $this; } } diff --git a/src/infrastructure/customfield/field/PhabricatorCustomField.php b/src/infrastructure/customfield/field/PhabricatorCustomField.php index b5c83f1eed..4ae9b7dcc7 100644 --- a/src/infrastructure/customfield/field/PhabricatorCustomField.php +++ b/src/infrastructure/customfield/field/PhabricatorCustomField.php @@ -794,7 +794,6 @@ abstract class PhabricatorCustomField extends Phobject { * query. * @param PhabricatorCursorPagedPolicyAwareQuery $query Query to constrain. * @param wild $value Constraint provided by the user. - * @return void * @task appsearch */ public function applyApplicationSearchConstraintToQuery( @@ -818,7 +817,6 @@ abstract class PhabricatorCustomField extends Phobject { * form. * @param AphrontFormView $form The form to update. * @param wild $value Value from the saved query. - * @return void * @task appsearch */ public function appendToApplicationSearchForm( diff --git a/src/infrastructure/customfield/field/PhabricatorCustomFieldList.php b/src/infrastructure/customfield/field/PhabricatorCustomFieldList.php index e5f5c1698f..ca474ffd8b 100644 --- a/src/infrastructure/customfield/field/PhabricatorCustomFieldList.php +++ b/src/infrastructure/customfield/field/PhabricatorCustomFieldList.php @@ -48,7 +48,7 @@ final class PhabricatorCustomFieldList extends Phobject { * * @param PhabricatorCustomFieldInterface $object Object to read field values * for. - * @return void + * @return $this */ public function readFieldsFromStorage( PhabricatorCustomFieldInterface $object) { diff --git a/src/infrastructure/daemon/workers/query/PhabricatorWorkerTriggerQuery.php b/src/infrastructure/daemon/workers/query/PhabricatorWorkerTriggerQuery.php index e25fa11e1c..ac9a6b1509 100644 --- a/src/infrastructure/daemon/workers/query/PhabricatorWorkerTriggerQuery.php +++ b/src/infrastructure/daemon/workers/query/PhabricatorWorkerTriggerQuery.php @@ -74,7 +74,6 @@ final class PhabricatorWorkerTriggerQuery // (Before T13266, we raised an exception here, but since "nextPage()" is // now called even if we don't page we can't do that anymore. Just do // nothing instead.) - return null; } protected function loadPage() { diff --git a/src/infrastructure/daemon/workers/storage/PhabricatorWorkerTrigger.php b/src/infrastructure/daemon/workers/storage/PhabricatorWorkerTrigger.php index e8dccdebf1..06055e418d 100644 --- a/src/infrastructure/daemon/workers/storage/PhabricatorWorkerTrigger.php +++ b/src/infrastructure/daemon/workers/storage/PhabricatorWorkerTrigger.php @@ -86,7 +86,6 @@ final class PhabricatorWorkerTrigger * is the first execution. * @param int $this_event Scheduled epoch of this execution. This may not be * the same as the current time. - * @return void */ public function executeTrigger($last_event, $this_event) { return $this->getAction()->execute($last_event, $this_event); -- 2.51.2