From 5f4587bb88ddbd53086675c69098ea0a9c20af16 Mon Sep 17 00:00:00 2001 From: Andre Klapper Date: Wed, 23 Oct 2024 12:11:53 +0200 Subject: [PATCH] Fix implicitly nullable parameter declarations for PHP 8.4 Summary: Followup to rPdb61eb20 and rPf3d49f74. This patch should cover all remaining issues now that PHPStan covers it (instead of the previous trial-and-error approach). Implicitly nullable parameter declarations are deprecated in PHP 8.4: https://php.watch/versions/8.4/implicitly-marking-parameter-type-nullable-deprecated The proposed syntax was introduced in PHP 7.1 and Phorge requires PHP 7.2 now. Test Plan: Run static code analysis. Reviewers: O1 Blessed Committers, avivey Reviewed By: O1 Blessed Committers, avivey Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno Differential Revision: https://we.phorge.it/D25832 --- .../auth/engine/PhabricatorAuthInviteEngine.php | 2 +- .../base/controller/PhabricatorController.php | 4 ++-- .../calendar/import/PhabricatorCalendarImportEngine.php | 2 +- .../calendar/parser/data/PhutilCalendarRecurrenceSet.php | 4 ++-- .../controller/PhabricatorConduitAPIController.php | 4 ++-- .../method/ConduitGetCertificateConduitAPIMethod.php | 2 +- .../settings/PhabricatorConfigSettingsListController.php | 2 +- .../conpherence/view/ConpherenceDurableColumnView.php | 2 +- .../dashboard/PhabricatorDashboardAdjustController.php | 2 +- .../layoutconfig/PhabricatorDashboardPanelRefList.php | 2 +- .../differential/conduit/DifferentialConduitAPIMethod.php | 2 +- .../controller/DifferentialRevisionViewController.php | 6 +++--- .../differential/render/DifferentialChangesetRenderer.php | 4 ++-- .../controller/DiffusionLastModifiedController.php | 2 +- .../diffusion/data/DiffusionLocalRepositoryFilter.php | 2 +- .../document/DiffusionDocumentRenderingEngine.php | 2 +- .../diffusion/query/DiffusionCommitRevisionQuery.php | 2 +- .../files/diff/PhabricatorDocumentEngineBlocks.php | 2 +- .../files/document/PhabricatorDocumentEngine.php | 4 ++-- .../files/document/PhabricatorImageDocumentEngine.php | 8 ++++---- .../files/document/PhabricatorJupyterDocumentEngine.php | 8 ++++---- .../render/PhabricatorDocumentRenderingEngine.php | 2 +- .../render/PhabricatorFileDocumentRenderingEngine.php | 2 +- .../project/__tests__/PhabricatorProjectCoreTestCase.php | 2 +- src/applications/project/view/ProjectBoardTaskCard.php | 2 +- .../daemon/PhabricatorRepositoryPullLocalDaemon.php | 2 +- .../repository/engine/PhabricatorRepositoryPullEngine.php | 2 +- .../search/compiler/PhutilSearchQueryCompiler.php | 2 +- .../__tests__/PhutilSearchQueryCompilerTestCase.php | 2 +- .../PhabricatorElasticFulltextStorageEngine.php | 6 +++--- .../menuitem/PhabricatorDashboardProfileMenuItem.php | 2 +- .../query/PhabricatorSearchApplicationSearchEngine.php | 2 +- .../panel/PhabricatorEmailPreferencesSettingsPanel.php | 4 ++-- src/applications/settings/setting/PhabricatorSetting.php | 2 +- .../transactions/draft/PhabricatorDraftEngine.php | 2 +- .../diff/interface/PhabricatorInlineComment.php | 4 ++-- .../util/__tests__/PhabricatorGlobalLockTestCase.php | 2 +- src/view/AphrontDialogView.php | 2 +- src/view/phui/PHUIObjectBoxView.php | 2 +- 39 files changed, 56 insertions(+), 56 deletions(-) diff --git a/src/applications/auth/engine/PhabricatorAuthInviteEngine.php b/src/applications/auth/engine/PhabricatorAuthInviteEngine.php index 70fc03345c..2881de12ff 100644 --- a/src/applications/auth/engine/PhabricatorAuthInviteEngine.php +++ b/src/applications/auth/engine/PhabricatorAuthInviteEngine.php @@ -125,7 +125,7 @@ final class PhabricatorAuthInviteEngine extends Phobject { private function handleLoggedInInvite( PhabricatorAuthInvite $invite, PhabricatorUser $viewer, - PhabricatorUserEmail $email = null) { + ?PhabricatorUserEmail $email = null) { if ($email && ($email->getUserPHID() !== $viewer->getPHID())) { $other_user = $this->loadUserForEmail($email); diff --git a/src/applications/base/controller/PhabricatorController.php b/src/applications/base/controller/PhabricatorController.php index 3f04e5a62a..5e94dc4d29 100644 --- a/src/applications/base/controller/PhabricatorController.php +++ b/src/applications/base/controller/PhabricatorController.php @@ -485,8 +485,8 @@ abstract class PhabricatorController extends AphrontController { protected function buildTransactionTimeline( PhabricatorApplicationTransactionInterface $object, - PhabricatorApplicationTransactionQuery $query = null, - PhabricatorMarkupEngine $engine = null, + ?PhabricatorApplicationTransactionQuery $query = null, + ?PhabricatorMarkupEngine $engine = null, $view_data = array()) { $request = $this->getRequest(); diff --git a/src/applications/calendar/import/PhabricatorCalendarImportEngine.php b/src/applications/calendar/import/PhabricatorCalendarImportEngine.php index 33809f1516..f5964b6efd 100644 --- a/src/applications/calendar/import/PhabricatorCalendarImportEngine.php +++ b/src/applications/calendar/import/PhabricatorCalendarImportEngine.php @@ -55,7 +55,7 @@ abstract class PhabricatorCalendarImportEngine final protected function importEventDocument( PhabricatorUser $viewer, PhabricatorCalendarImport $import, - PhutilCalendarRootNode $root = null) { + ?PhutilCalendarRootNode $root = null) { $event_type = PhutilCalendarEventNode::NODETYPE; diff --git a/src/applications/calendar/parser/data/PhutilCalendarRecurrenceSet.php b/src/applications/calendar/parser/data/PhutilCalendarRecurrenceSet.php index 6ebcd4a58a..17bacd3857 100644 --- a/src/applications/calendar/parser/data/PhutilCalendarRecurrenceSet.php +++ b/src/applications/calendar/parser/data/PhutilCalendarRecurrenceSet.php @@ -21,8 +21,8 @@ final class PhutilCalendarRecurrenceSet } public function getEventsBetween( - PhutilCalendarDateTime $start = null, - PhutilCalendarDateTime $end = null, + ?PhutilCalendarDateTime $start = null, + ?PhutilCalendarDateTime $end = null, $limit = null) { if ($end === null && $limit === null) { diff --git a/src/applications/conduit/controller/PhabricatorConduitAPIController.php b/src/applications/conduit/controller/PhabricatorConduitAPIController.php index 8eb19a2dc9..4a6108cfd5 100644 --- a/src/applications/conduit/controller/PhabricatorConduitAPIController.php +++ b/src/applications/conduit/controller/PhabricatorConduitAPIController.php @@ -527,9 +527,9 @@ final class PhabricatorConduitAPIController private function buildHumanReadableResponse( $method, - ConduitAPIRequest $request = null, + ?ConduitAPIRequest $request = null, $result = null, - ConduitAPIMethod $method_implementation = null) { + ?ConduitAPIMethod $method_implementation = null) { $param_rows = array(); $param_rows[] = array('Method', $this->renderAPIValue($method)); diff --git a/src/applications/conduit/method/ConduitGetCertificateConduitAPIMethod.php b/src/applications/conduit/method/ConduitGetCertificateConduitAPIMethod.php index 41716748e0..03ddfb296b 100644 --- a/src/applications/conduit/method/ConduitGetCertificateConduitAPIMethod.php +++ b/src/applications/conduit/method/ConduitGetCertificateConduitAPIMethod.php @@ -80,7 +80,7 @@ final class ConduitGetCertificateConduitAPIMethod extends ConduitAPIMethod { private function logFailure( ConduitAPIRequest $request, - PhabricatorConduitCertificateToken $info = null) { + ?PhabricatorConduitCertificateToken $info = null) { $log = PhabricatorUserLog::initializeNewLog( $request->getUser(), diff --git a/src/applications/config/controller/settings/PhabricatorConfigSettingsListController.php b/src/applications/config/controller/settings/PhabricatorConfigSettingsListController.php index 0d34250bb8..8996294469 100644 --- a/src/applications/config/controller/settings/PhabricatorConfigSettingsListController.php +++ b/src/applications/config/controller/settings/PhabricatorConfigSettingsListController.php @@ -75,7 +75,7 @@ final class PhabricatorConfigSettingsListController private function newConfigOptionView( PhabricatorConfigOption $option, - PhabricatorConfigEntry $stored_value = null) { + ?PhabricatorConfigEntry $stored_value = null) { $summary = $option->getSummary(); diff --git a/src/applications/conpherence/view/ConpherenceDurableColumnView.php b/src/applications/conpherence/view/ConpherenceDurableColumnView.php index 69778c71ab..be8a170cfb 100644 --- a/src/applications/conpherence/view/ConpherenceDurableColumnView.php +++ b/src/applications/conpherence/view/ConpherenceDurableColumnView.php @@ -32,7 +32,7 @@ final class ConpherenceDurableColumnView extends AphrontTagView { } public function setSelectedConpherence( - ConpherenceThread $conpherence = null) { + ?ConpherenceThread $conpherence = null) { $this->selectedConpherence = $conpherence; return $this; } diff --git a/src/applications/dashboard/controller/dashboard/PhabricatorDashboardAdjustController.php b/src/applications/dashboard/controller/dashboard/PhabricatorDashboardAdjustController.php index 4f3937e3ae..2efaa2e23a 100644 --- a/src/applications/dashboard/controller/dashboard/PhabricatorDashboardAdjustController.php +++ b/src/applications/dashboard/controller/dashboard/PhabricatorDashboardAdjustController.php @@ -204,7 +204,7 @@ final class PhabricatorDashboardAdjustController private function handleMoveRequest( PhabricatorDashboard $dashboard, PhabricatorDashboardPanelRef $panel_ref, - PhabricatorDashboardPanelRef $after_ref = null) { + ?PhabricatorDashboardPanelRef $after_ref = null) { $request = $this->getRequest(); $request->validateCSRF(); diff --git a/src/applications/dashboard/layoutconfig/PhabricatorDashboardPanelRefList.php b/src/applications/dashboard/layoutconfig/PhabricatorDashboardPanelRefList.php index 2f74d0a937..7135522840 100644 --- a/src/applications/dashboard/layoutconfig/PhabricatorDashboardPanelRefList.php +++ b/src/applications/dashboard/layoutconfig/PhabricatorDashboardPanelRefList.php @@ -121,7 +121,7 @@ final class PhabricatorDashboardPanelRefList public function movePanelRef( PhabricatorDashboardPanelRef $target, $column_key, - PhabricatorDashboardPanelRef $after = null) { + ?PhabricatorDashboardPanelRef $after = null) { $target->setColumnKey($column_key); diff --git a/src/applications/differential/conduit/DifferentialConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialConduitAPIMethod.php index 13ed71c96e..108f562bfb 100644 --- a/src/applications/differential/conduit/DifferentialConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialConduitAPIMethod.php @@ -20,7 +20,7 @@ abstract class DifferentialConduitAPIMethod extends ConduitAPIMethod { protected function buildInlineInfoDictionary( DifferentialInlineComment $inline, - DifferentialChangeset $changeset = null) { + ?DifferentialChangeset $changeset = null) { $file_path = null; $diff_id = null; diff --git a/src/applications/differential/controller/DifferentialRevisionViewController.php b/src/applications/differential/controller/DifferentialRevisionViewController.php index ff5cd7373f..35895f8b8b 100644 --- a/src/applications/differential/controller/DifferentialRevisionViewController.php +++ b/src/applications/differential/controller/DifferentialRevisionViewController.php @@ -863,8 +863,8 @@ final class DifferentialRevisionViewController private function loadChangesetsAndVsMap( DifferentialDiff $target, - DifferentialDiff $diff_vs = null, - PhabricatorRepository $repository = null) { + ?DifferentialDiff $diff_vs = null, + ?PhabricatorRepository $repository = null) { $viewer = $this->getViewer(); $load_diffs = array($target); @@ -1049,7 +1049,7 @@ final class DifferentialRevisionViewController array $changesets, array $vs_changesets, array $vs_map, - PhabricatorRepository $repository = null) { + ?PhabricatorRepository $repository = null) { assert_instances_of($changesets, 'DifferentialChangeset'); assert_instances_of($vs_changesets, 'DifferentialChangeset'); diff --git a/src/applications/differential/render/DifferentialChangesetRenderer.php b/src/applications/differential/render/DifferentialChangesetRenderer.php index 676a6bcf05..12b1efac80 100644 --- a/src/applications/differential/render/DifferentialChangesetRenderer.php +++ b/src/applications/differential/render/DifferentialChangesetRenderer.php @@ -105,7 +105,7 @@ abstract class DifferentialChangesetRenderer extends Phobject { return $this->depthOnlyLines; } - public function attachOldFile(PhabricatorFile $old = null) { + public function attachOldFile(?PhabricatorFile $old = null) { $this->oldFile = $old; return $this; } @@ -121,7 +121,7 @@ abstract class DifferentialChangesetRenderer extends Phobject { return (bool)$this->oldFile; } - public function attachNewFile(PhabricatorFile $new = null) { + public function attachNewFile(?PhabricatorFile $new = null) { $this->newFile = $new; return $this; } diff --git a/src/applications/diffusion/controller/DiffusionLastModifiedController.php b/src/applications/diffusion/controller/DiffusionLastModifiedController.php index 92f5b50a8a..9b51cb8eec 100644 --- a/src/applications/diffusion/controller/DiffusionLastModifiedController.php +++ b/src/applications/diffusion/controller/DiffusionLastModifiedController.php @@ -84,7 +84,7 @@ final class DiffusionLastModifiedController extends DiffusionController { private function renderColumns( DiffusionRequest $drequest, - PhabricatorRepositoryCommit $commit = null, + ?PhabricatorRepositoryCommit $commit = null, $lint = null) { $viewer = $this->getViewer(); diff --git a/src/applications/diffusion/data/DiffusionLocalRepositoryFilter.php b/src/applications/diffusion/data/DiffusionLocalRepositoryFilter.php index b443352206..966612aec6 100644 --- a/src/applications/diffusion/data/DiffusionLocalRepositoryFilter.php +++ b/src/applications/diffusion/data/DiffusionLocalRepositoryFilter.php @@ -20,7 +20,7 @@ final class DiffusionLocalRepositoryFilter extends Phobject { return $this->viewer; } - public function setDevice(AlmanacDevice $device = null) { + public function setDevice(?AlmanacDevice $device = null) { $this->device = $device; return $this; } diff --git a/src/applications/diffusion/document/DiffusionDocumentRenderingEngine.php b/src/applications/diffusion/document/DiffusionDocumentRenderingEngine.php index 2c33a82ad5..9fe56a92b3 100644 --- a/src/applications/diffusion/document/DiffusionDocumentRenderingEngine.php +++ b/src/applications/diffusion/document/DiffusionDocumentRenderingEngine.php @@ -65,7 +65,7 @@ final class DiffusionDocumentRenderingEngine protected function addApplicationCrumbs( PHUICrumbsView $crumbs, - PhabricatorDocumentRef $ref = null) { + ?PhabricatorDocumentRef $ref = null) { return; } diff --git a/src/applications/diffusion/query/DiffusionCommitRevisionQuery.php b/src/applications/diffusion/query/DiffusionCommitRevisionQuery.php index 822ebfb014..5ddde36c7f 100644 --- a/src/applications/diffusion/query/DiffusionCommitRevisionQuery.php +++ b/src/applications/diffusion/query/DiffusionCommitRevisionQuery.php @@ -68,7 +68,7 @@ final class DiffusionCommitRevisionQuery PhabricatorUser $viewer, $source_object, array $object_names, - PhabricatorRepository $repository_scope = null) { + ?PhabricatorRepository $repository_scope = null) { // Fetch commits first, since we need to load data on commits in order // to identify associated revisions later on. diff --git a/src/applications/files/diff/PhabricatorDocumentEngineBlocks.php b/src/applications/files/diff/PhabricatorDocumentEngineBlocks.php index 3897af2f02..8f8d9da39d 100644 --- a/src/applications/files/diff/PhabricatorDocumentEngineBlocks.php +++ b/src/applications/files/diff/PhabricatorDocumentEngineBlocks.php @@ -39,7 +39,7 @@ final class PhabricatorDocumentEngineBlocks } public function addBlockList( - PhabricatorDocumentRef $ref = null, + ?PhabricatorDocumentRef $ref = null, array $blocks = array()) { assert_instances_of($blocks, 'PhabricatorDocumentEngineBlock'); diff --git a/src/applications/files/document/PhabricatorDocumentEngine.php b/src/applications/files/document/PhabricatorDocumentEngine.php index 3a13c5eb4a..7826821720 100644 --- a/src/applications/files/document/PhabricatorDocumentEngine.php +++ b/src/applications/files/document/PhabricatorDocumentEngine.php @@ -32,8 +32,8 @@ abstract class PhabricatorDocumentEngine } public function canDiffDocuments( - PhabricatorDocumentRef $uref = null, - PhabricatorDocumentRef $vref = null) { + ?PhabricatorDocumentRef $uref = null, + ?PhabricatorDocumentRef $vref = null) { return false; } diff --git a/src/applications/files/document/PhabricatorImageDocumentEngine.php b/src/applications/files/document/PhabricatorImageDocumentEngine.php index a20758ede1..f92477789b 100644 --- a/src/applications/files/document/PhabricatorImageDocumentEngine.php +++ b/src/applications/files/document/PhabricatorImageDocumentEngine.php @@ -18,8 +18,8 @@ final class PhabricatorImageDocumentEngine } public function canDiffDocuments( - PhabricatorDocumentRef $uref = null, - PhabricatorDocumentRef $vref = null) { + ?PhabricatorDocumentRef $uref = null, + ?PhabricatorDocumentRef $vref = null) { // For now, we can only render a rich image diff if the documents have // their data stored in Files already. @@ -36,8 +36,8 @@ final class PhabricatorImageDocumentEngine } public function newEngineBlocks( - PhabricatorDocumentRef $uref = null, - PhabricatorDocumentRef $vref = null) { + ?PhabricatorDocumentRef $uref = null, + ?PhabricatorDocumentRef $vref = null) { if ($uref) { $u_blocks = $this->newDiffBlocks($uref); diff --git a/src/applications/files/document/PhabricatorJupyterDocumentEngine.php b/src/applications/files/document/PhabricatorJupyterDocumentEngine.php index 28ea43718c..76d222f19f 100644 --- a/src/applications/files/document/PhabricatorJupyterDocumentEngine.php +++ b/src/applications/files/document/PhabricatorJupyterDocumentEngine.php @@ -36,14 +36,14 @@ final class PhabricatorJupyterDocumentEngine } public function canDiffDocuments( - PhabricatorDocumentRef $uref = null, - PhabricatorDocumentRef $vref = null) { + ?PhabricatorDocumentRef $uref = null, + ?PhabricatorDocumentRef $vref = null) { return true; } public function newEngineBlocks( - PhabricatorDocumentRef $uref = null, - PhabricatorDocumentRef $vref = null) { + ?PhabricatorDocumentRef $uref = null, + ?PhabricatorDocumentRef $vref = null) { $blocks = new PhabricatorDocumentEngineBlocks(); diff --git a/src/applications/files/document/render/PhabricatorDocumentRenderingEngine.php b/src/applications/files/document/render/PhabricatorDocumentRenderingEngine.php index c664e56b6d..1200de7aad 100644 --- a/src/applications/files/document/render/PhabricatorDocumentRenderingEngine.php +++ b/src/applications/files/document/render/PhabricatorDocumentRenderingEngine.php @@ -329,7 +329,7 @@ abstract class PhabricatorDocumentRenderingEngine protected function addApplicationCrumbs( PHUICrumbsView $crumbs, - PhabricatorDocumentRef $ref = null) { + ?PhabricatorDocumentRef $ref = null) { return; } diff --git a/src/applications/files/document/render/PhabricatorFileDocumentRenderingEngine.php b/src/applications/files/document/render/PhabricatorFileDocumentRenderingEngine.php index 65e9a49681..4f130511b6 100644 --- a/src/applications/files/document/render/PhabricatorFileDocumentRenderingEngine.php +++ b/src/applications/files/document/render/PhabricatorFileDocumentRenderingEngine.php @@ -35,7 +35,7 @@ final class PhabricatorFileDocumentRenderingEngine protected function addApplicationCrumbs( PHUICrumbsView $crumbs, - PhabricatorDocumentRef $ref = null) { + ?PhabricatorDocumentRef $ref = null) { if ($ref) { $file = $ref->getFile(); diff --git a/src/applications/project/__tests__/PhabricatorProjectCoreTestCase.php b/src/applications/project/__tests__/PhabricatorProjectCoreTestCase.php index e3a138c702..cebaa04cb3 100644 --- a/src/applications/project/__tests__/PhabricatorProjectCoreTestCase.php +++ b/src/applications/project/__tests__/PhabricatorProjectCoreTestCase.php @@ -1534,7 +1534,7 @@ final class PhabricatorProjectCoreTestCase extends PhabricatorTestCase { private function createProject( PhabricatorUser $user, - PhabricatorProject $parent = null, + ?PhabricatorProject $parent = null, $is_milestone = false) { $project = PhabricatorProject::initializeNewProject($user, $parent); diff --git a/src/applications/project/view/ProjectBoardTaskCard.php b/src/applications/project/view/ProjectBoardTaskCard.php index d102ac1b11..c35891f53d 100644 --- a/src/applications/project/view/ProjectBoardTaskCard.php +++ b/src/applications/project/view/ProjectBoardTaskCard.php @@ -54,7 +54,7 @@ final class ProjectBoardTaskCard extends Phobject { return $this->task; } - public function setOwner(PhabricatorObjectHandle $owner = null) { + public function setOwner(?PhabricatorObjectHandle $owner = null) { $this->owner = $owner; return $this; } diff --git a/src/applications/repository/daemon/PhabricatorRepositoryPullLocalDaemon.php b/src/applications/repository/daemon/PhabricatorRepositoryPullLocalDaemon.php index 2ed1af8e00..2da312eafb 100644 --- a/src/applications/repository/daemon/PhabricatorRepositoryPullLocalDaemon.php +++ b/src/applications/repository/daemon/PhabricatorRepositoryPullLocalDaemon.php @@ -405,7 +405,7 @@ final class PhabricatorRepositoryPullLocalDaemon private function loadPullableRepositories( array $include, array $exclude, - AlmanacDevice $device = null) { + ?AlmanacDevice $device = null) { $query = id(new PhabricatorRepositoryQuery()) ->setViewer($this->getViewer()); diff --git a/src/applications/repository/engine/PhabricatorRepositoryPullEngine.php b/src/applications/repository/engine/PhabricatorRepositoryPullEngine.php index af4cd95d0a..fe5811f0f7 100644 --- a/src/applications/repository/engine/PhabricatorRepositoryPullEngine.php +++ b/src/applications/repository/engine/PhabricatorRepositoryPullEngine.php @@ -172,7 +172,7 @@ final class PhabricatorRepositoryPullEngine $this->donePull(); } - private function abortPull($message, Exception $ex = null) { + private function abortPull($message, ?Exception $ex = null) { $code_error = PhabricatorRepositoryStatusMessage::CODE_ERROR; $this->updateRepositoryInitStatus($code_error, $message); if ($ex) { diff --git a/src/applications/search/compiler/PhutilSearchQueryCompiler.php b/src/applications/search/compiler/PhutilSearchQueryCompiler.php index 951939b52c..6711cac095 100644 --- a/src/applications/search/compiler/PhutilSearchQueryCompiler.php +++ b/src/applications/search/compiler/PhutilSearchQueryCompiler.php @@ -437,7 +437,7 @@ final class PhutilSearchQueryCompiler private function renderToken( PhutilSearchQueryToken $token, - PhutilSearchStemmer $stemmer = null) { + ?PhutilSearchStemmer $stemmer = null) { $value = $token->getValue(); if ($stemmer) { diff --git a/src/applications/search/compiler/__tests__/PhutilSearchQueryCompilerTestCase.php b/src/applications/search/compiler/__tests__/PhutilSearchQueryCompilerTestCase.php index 4dc41d9734..8321e76533 100644 --- a/src/applications/search/compiler/__tests__/PhutilSearchQueryCompilerTestCase.php +++ b/src/applications/search/compiler/__tests__/PhutilSearchQueryCompilerTestCase.php @@ -227,7 +227,7 @@ final class PhutilSearchQueryCompilerTestCase private function assertCompileQueries( array $tests, $operators = null, - PhutilSearchStemmer $stemmer = null) { + ?PhutilSearchStemmer $stemmer = null) { foreach ($tests as $input => $expect) { $caught = null; diff --git a/src/applications/search/fulltextstorage/PhabricatorElasticFulltextStorageEngine.php b/src/applications/search/fulltextstorage/PhabricatorElasticFulltextStorageEngine.php index f6aead3759..d774f4911c 100644 --- a/src/applications/search/fulltextstorage/PhabricatorElasticFulltextStorageEngine.php +++ b/src/applications/search/fulltextstorage/PhabricatorElasticFulltextStorageEngine.php @@ -263,7 +263,7 @@ class PhabricatorElasticFulltextStorageEngine $exceptions); } - public function indexExists(PhabricatorElasticsearchHost $host = null) { + public function indexExists(?PhabricatorElasticsearchHost $host = null) { if (!$host) { $host = $this->getHostForRead(); } @@ -397,7 +397,7 @@ class PhabricatorElasticFulltextStorageEngine return $data; } - public function indexIsSane(PhabricatorElasticsearchHost $host = null) { + public function indexIsSane(?PhabricatorElasticsearchHost $host = null) { if (!$host) { $host = $this->getHostForRead(); } @@ -476,7 +476,7 @@ class PhabricatorElasticFulltextStorageEngine $this->executeRequest($host, '/', $data, 'PUT'); } - public function getIndexStats(PhabricatorElasticsearchHost $host = null) { + public function getIndexStats(?PhabricatorElasticsearchHost $host = null) { if ($this->version < 2) { return false; } diff --git a/src/applications/search/menuitem/PhabricatorDashboardProfileMenuItem.php b/src/applications/search/menuitem/PhabricatorDashboardProfileMenuItem.php index 717bba7c39..8e87e737d4 100644 --- a/src/applications/search/menuitem/PhabricatorDashboardProfileMenuItem.php +++ b/src/applications/search/menuitem/PhabricatorDashboardProfileMenuItem.php @@ -27,7 +27,7 @@ final class PhabricatorDashboardProfileMenuItem return true; } - private function attachDashboard(PhabricatorDashboard $dashboard = null) { + private function attachDashboard(?PhabricatorDashboard $dashboard = null) { $this->dashboard = $dashboard; return $this; } diff --git a/src/applications/search/query/PhabricatorSearchApplicationSearchEngine.php b/src/applications/search/query/PhabricatorSearchApplicationSearchEngine.php index dca98e8411..e945df3b44 100644 --- a/src/applications/search/query/PhabricatorSearchApplicationSearchEngine.php +++ b/src/applications/search/query/PhabricatorSearchApplicationSearchEngine.php @@ -201,7 +201,7 @@ final class PhabricatorSearchApplicationSearchEngine } public static function getIndexableDocumentTypes( - PhabricatorUser $viewer = null) { + ?PhabricatorUser $viewer = null) { // TODO: This is inelegant and not very efficient, but gets us reasonable // results. It would be nice to do this more elegantly. diff --git a/src/applications/settings/panel/PhabricatorEmailPreferencesSettingsPanel.php b/src/applications/settings/panel/PhabricatorEmailPreferencesSettingsPanel.php index 6e84e28622..3cec467454 100644 --- a/src/applications/settings/panel/PhabricatorEmailPreferencesSettingsPanel.php +++ b/src/applications/settings/panel/PhabricatorEmailPreferencesSettingsPanel.php @@ -146,7 +146,7 @@ final class PhabricatorEmailPreferencesSettingsPanel return $form_box; } - private function getAllEditorsWithTags(PhabricatorUser $user = null) { + private function getAllEditorsWithTags(?PhabricatorUser $user = null) { $editors = id(new PhutilClassMapQuery()) ->setAncestorClass('PhabricatorApplicationTransactionEditor') ->setFilterMethod('getMailTagsMap') @@ -165,7 +165,7 @@ final class PhabricatorEmailPreferencesSettingsPanel return $editors; } - private function getAllTags(PhabricatorUser $user = null) { + private function getAllTags(?PhabricatorUser $user = null) { $tags = array(); foreach ($this->getAllEditorsWithTags($user) as $editor) { $tags += $editor->getMailTagsMap(); diff --git a/src/applications/settings/setting/PhabricatorSetting.php b/src/applications/settings/setting/PhabricatorSetting.php index 5a25df5fac..f402001c9d 100644 --- a/src/applications/settings/setting/PhabricatorSetting.php +++ b/src/applications/settings/setting/PhabricatorSetting.php @@ -4,7 +4,7 @@ abstract class PhabricatorSetting extends Phobject { private $viewer = false; - public function setViewer(PhabricatorUser $viewer = null) { + public function setViewer(?PhabricatorUser $viewer = null) { $this->viewer = $viewer; return $this; } diff --git a/src/applications/transactions/draft/PhabricatorDraftEngine.php b/src/applications/transactions/draft/PhabricatorDraftEngine.php index 9e55104912..1e64bfdef4 100644 --- a/src/applications/transactions/draft/PhabricatorDraftEngine.php +++ b/src/applications/transactions/draft/PhabricatorDraftEngine.php @@ -27,7 +27,7 @@ abstract class PhabricatorDraftEngine } final public function setVersionedDraft( - PhabricatorVersionedDraft $draft = null) { + ?PhabricatorVersionedDraft $draft = null) { $this->hasVersionedDraft = true; $this->versionedDraft = $draft; return $this; diff --git a/src/infrastructure/diff/interface/PhabricatorInlineComment.php b/src/infrastructure/diff/interface/PhabricatorInlineComment.php index 4e7b86d30a..b57a4e3d04 100644 --- a/src/infrastructure/diff/interface/PhabricatorInlineComment.php +++ b/src/infrastructure/diff/interface/PhabricatorInlineComment.php @@ -288,7 +288,7 @@ abstract class PhabricatorInlineComment public function attachVersionedDraftForViewer( PhabricatorUser $viewer, - PhabricatorVersionedDraft $draft = null) { + ?PhabricatorVersionedDraft $draft = null) { $key = $viewer->getCacheFragment(); $this->versionedDrafts[$key] = $draft; @@ -415,7 +415,7 @@ abstract class PhabricatorInlineComment private function getWireContentStateMap( $is_edit, - PhabricatorUser $viewer = null) { + ?PhabricatorUser $viewer = null) { $initial_state = $this->getInitialContentState(); $committed_state = $this->getCommittedContentState(); diff --git a/src/infrastructure/util/__tests__/PhabricatorGlobalLockTestCase.php b/src/infrastructure/util/__tests__/PhabricatorGlobalLockTestCase.php index d0e79dbb8d..c4a883bccb 100644 --- a/src/infrastructure/util/__tests__/PhabricatorGlobalLockTestCase.php +++ b/src/infrastructure/util/__tests__/PhabricatorGlobalLockTestCase.php @@ -205,7 +205,7 @@ final class PhabricatorGlobalLockTestCase private function tryHeldLock( $lock_name, - AphrontDatabaseConnection $conn = null) { + ?AphrontDatabaseConnection $conn = null) { $lock = PhabricatorGlobalLock::newLock($lock_name); diff --git a/src/view/AphrontDialogView.php b/src/view/AphrontDialogView.php index 14aa4a19b6..d0692213a6 100644 --- a/src/view/AphrontDialogView.php +++ b/src/view/AphrontDialogView.php @@ -273,7 +273,7 @@ final class AphrontDialogView } public function setValidationException( - PhabricatorApplicationTransactionValidationException $ex = null) { + ?PhabricatorApplicationTransactionValidationException $ex = null) { $this->validationException = $ex; return $this; } diff --git a/src/view/phui/PHUIObjectBoxView.php b/src/view/phui/PHUIObjectBoxView.php index 4d42187479..dce9d57568 100644 --- a/src/view/phui/PHUIObjectBoxView.php +++ b/src/view/phui/PHUIObjectBoxView.php @@ -135,7 +135,7 @@ final class PHUIObjectBoxView extends AphrontTagView { } public function setValidationException( - PhabricatorApplicationTransactionValidationException $ex = null) { + ?PhabricatorApplicationTransactionValidationException $ex = null) { $this->validationException = $ex; return $this; }