1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-22 13:30:55 +01:00

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
This commit is contained in:
Andre Klapper 2024-10-23 12:11:53 +02:00
parent f3d49f7407
commit 5f4587bb88
39 changed files with 56 additions and 56 deletions

View file

@ -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);

View file

@ -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();

View file

@ -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;

View file

@ -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) {

View file

@ -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));

View file

@ -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(),

View file

@ -75,7 +75,7 @@ final class PhabricatorConfigSettingsListController
private function newConfigOptionView(
PhabricatorConfigOption $option,
PhabricatorConfigEntry $stored_value = null) {
?PhabricatorConfigEntry $stored_value = null) {
$summary = $option->getSummary();

View file

@ -32,7 +32,7 @@ final class ConpherenceDurableColumnView extends AphrontTagView {
}
public function setSelectedConpherence(
ConpherenceThread $conpherence = null) {
?ConpherenceThread $conpherence = null) {
$this->selectedConpherence = $conpherence;
return $this;
}

View file

@ -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();

View file

@ -121,7 +121,7 @@ final class PhabricatorDashboardPanelRefList
public function movePanelRef(
PhabricatorDashboardPanelRef $target,
$column_key,
PhabricatorDashboardPanelRef $after = null) {
?PhabricatorDashboardPanelRef $after = null) {
$target->setColumnKey($column_key);

View file

@ -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;

View file

@ -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');

View file

@ -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;
}

View file

@ -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();

View file

@ -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;
}

View file

@ -65,7 +65,7 @@ final class DiffusionDocumentRenderingEngine
protected function addApplicationCrumbs(
PHUICrumbsView $crumbs,
PhabricatorDocumentRef $ref = null) {
?PhabricatorDocumentRef $ref = null) {
return;
}

View file

@ -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.

View file

@ -39,7 +39,7 @@ final class PhabricatorDocumentEngineBlocks
}
public function addBlockList(
PhabricatorDocumentRef $ref = null,
?PhabricatorDocumentRef $ref = null,
array $blocks = array()) {
assert_instances_of($blocks, 'PhabricatorDocumentEngineBlock');

View file

@ -32,8 +32,8 @@ abstract class PhabricatorDocumentEngine
}
public function canDiffDocuments(
PhabricatorDocumentRef $uref = null,
PhabricatorDocumentRef $vref = null) {
?PhabricatorDocumentRef $uref = null,
?PhabricatorDocumentRef $vref = null) {
return false;
}

View file

@ -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);

View file

@ -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();

View file

@ -329,7 +329,7 @@ abstract class PhabricatorDocumentRenderingEngine
protected function addApplicationCrumbs(
PHUICrumbsView $crumbs,
PhabricatorDocumentRef $ref = null) {
?PhabricatorDocumentRef $ref = null) {
return;
}

View file

@ -35,7 +35,7 @@ final class PhabricatorFileDocumentRenderingEngine
protected function addApplicationCrumbs(
PHUICrumbsView $crumbs,
PhabricatorDocumentRef $ref = null) {
?PhabricatorDocumentRef $ref = null) {
if ($ref) {
$file = $ref->getFile();

View file

@ -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);

View file

@ -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;
}

View file

@ -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());

View file

@ -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) {

View file

@ -437,7 +437,7 @@ final class PhutilSearchQueryCompiler
private function renderToken(
PhutilSearchQueryToken $token,
PhutilSearchStemmer $stemmer = null) {
?PhutilSearchStemmer $stemmer = null) {
$value = $token->getValue();
if ($stemmer) {

View file

@ -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;

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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.

View file

@ -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();

View file

@ -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;
}

View file

@ -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;

View file

@ -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();

View file

@ -205,7 +205,7 @@ final class PhabricatorGlobalLockTestCase
private function tryHeldLock(
$lock_name,
AphrontDatabaseConnection $conn = null) {
?AphrontDatabaseConnection $conn = null) {
$lock = PhabricatorGlobalLock::newLock($lock_name);

View file

@ -273,7 +273,7 @@ final class AphrontDialogView
}
public function setValidationException(
PhabricatorApplicationTransactionValidationException $ex = null) {
?PhabricatorApplicationTransactionValidationException $ex = null) {
$this->validationException = $ex;
return $this;
}

View file

@ -135,7 +135,7 @@ final class PHUIObjectBoxView extends AphrontTagView {
}
public function setValidationException(
PhabricatorApplicationTransactionValidationException $ex = null) {
?PhabricatorApplicationTransactionValidationException $ex = null) {
$this->validationException = $ex;
return $this;
}