1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 06:42:42 +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( private function handleLoggedInInvite(
PhabricatorAuthInvite $invite, PhabricatorAuthInvite $invite,
PhabricatorUser $viewer, PhabricatorUser $viewer,
PhabricatorUserEmail $email = null) { ?PhabricatorUserEmail $email = null) {
if ($email && ($email->getUserPHID() !== $viewer->getPHID())) { if ($email && ($email->getUserPHID() !== $viewer->getPHID())) {
$other_user = $this->loadUserForEmail($email); $other_user = $this->loadUserForEmail($email);

View file

@ -485,8 +485,8 @@ abstract class PhabricatorController extends AphrontController {
protected function buildTransactionTimeline( protected function buildTransactionTimeline(
PhabricatorApplicationTransactionInterface $object, PhabricatorApplicationTransactionInterface $object,
PhabricatorApplicationTransactionQuery $query = null, ?PhabricatorApplicationTransactionQuery $query = null,
PhabricatorMarkupEngine $engine = null, ?PhabricatorMarkupEngine $engine = null,
$view_data = array()) { $view_data = array()) {
$request = $this->getRequest(); $request = $this->getRequest();

View file

@ -55,7 +55,7 @@ abstract class PhabricatorCalendarImportEngine
final protected function importEventDocument( final protected function importEventDocument(
PhabricatorUser $viewer, PhabricatorUser $viewer,
PhabricatorCalendarImport $import, PhabricatorCalendarImport $import,
PhutilCalendarRootNode $root = null) { ?PhutilCalendarRootNode $root = null) {
$event_type = PhutilCalendarEventNode::NODETYPE; $event_type = PhutilCalendarEventNode::NODETYPE;

View file

@ -21,8 +21,8 @@ final class PhutilCalendarRecurrenceSet
} }
public function getEventsBetween( public function getEventsBetween(
PhutilCalendarDateTime $start = null, ?PhutilCalendarDateTime $start = null,
PhutilCalendarDateTime $end = null, ?PhutilCalendarDateTime $end = null,
$limit = null) { $limit = null) {
if ($end === null && $limit === null) { if ($end === null && $limit === null) {

View file

@ -527,9 +527,9 @@ final class PhabricatorConduitAPIController
private function buildHumanReadableResponse( private function buildHumanReadableResponse(
$method, $method,
ConduitAPIRequest $request = null, ?ConduitAPIRequest $request = null,
$result = null, $result = null,
ConduitAPIMethod $method_implementation = null) { ?ConduitAPIMethod $method_implementation = null) {
$param_rows = array(); $param_rows = array();
$param_rows[] = array('Method', $this->renderAPIValue($method)); $param_rows[] = array('Method', $this->renderAPIValue($method));

View file

@ -80,7 +80,7 @@ final class ConduitGetCertificateConduitAPIMethod extends ConduitAPIMethod {
private function logFailure( private function logFailure(
ConduitAPIRequest $request, ConduitAPIRequest $request,
PhabricatorConduitCertificateToken $info = null) { ?PhabricatorConduitCertificateToken $info = null) {
$log = PhabricatorUserLog::initializeNewLog( $log = PhabricatorUserLog::initializeNewLog(
$request->getUser(), $request->getUser(),

View file

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

View file

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

View file

@ -204,7 +204,7 @@ final class PhabricatorDashboardAdjustController
private function handleMoveRequest( private function handleMoveRequest(
PhabricatorDashboard $dashboard, PhabricatorDashboard $dashboard,
PhabricatorDashboardPanelRef $panel_ref, PhabricatorDashboardPanelRef $panel_ref,
PhabricatorDashboardPanelRef $after_ref = null) { ?PhabricatorDashboardPanelRef $after_ref = null) {
$request = $this->getRequest(); $request = $this->getRequest();
$request->validateCSRF(); $request->validateCSRF();

View file

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

View file

@ -20,7 +20,7 @@ abstract class DifferentialConduitAPIMethod extends ConduitAPIMethod {
protected function buildInlineInfoDictionary( protected function buildInlineInfoDictionary(
DifferentialInlineComment $inline, DifferentialInlineComment $inline,
DifferentialChangeset $changeset = null) { ?DifferentialChangeset $changeset = null) {
$file_path = null; $file_path = null;
$diff_id = null; $diff_id = null;

View file

@ -863,8 +863,8 @@ final class DifferentialRevisionViewController
private function loadChangesetsAndVsMap( private function loadChangesetsAndVsMap(
DifferentialDiff $target, DifferentialDiff $target,
DifferentialDiff $diff_vs = null, ?DifferentialDiff $diff_vs = null,
PhabricatorRepository $repository = null) { ?PhabricatorRepository $repository = null) {
$viewer = $this->getViewer(); $viewer = $this->getViewer();
$load_diffs = array($target); $load_diffs = array($target);
@ -1049,7 +1049,7 @@ final class DifferentialRevisionViewController
array $changesets, array $changesets,
array $vs_changesets, array $vs_changesets,
array $vs_map, array $vs_map,
PhabricatorRepository $repository = null) { ?PhabricatorRepository $repository = null) {
assert_instances_of($changesets, 'DifferentialChangeset'); assert_instances_of($changesets, 'DifferentialChangeset');
assert_instances_of($vs_changesets, 'DifferentialChangeset'); assert_instances_of($vs_changesets, 'DifferentialChangeset');

View file

@ -105,7 +105,7 @@ abstract class DifferentialChangesetRenderer extends Phobject {
return $this->depthOnlyLines; return $this->depthOnlyLines;
} }
public function attachOldFile(PhabricatorFile $old = null) { public function attachOldFile(?PhabricatorFile $old = null) {
$this->oldFile = $old; $this->oldFile = $old;
return $this; return $this;
} }
@ -121,7 +121,7 @@ abstract class DifferentialChangesetRenderer extends Phobject {
return (bool)$this->oldFile; return (bool)$this->oldFile;
} }
public function attachNewFile(PhabricatorFile $new = null) { public function attachNewFile(?PhabricatorFile $new = null) {
$this->newFile = $new; $this->newFile = $new;
return $this; return $this;
} }

View file

@ -84,7 +84,7 @@ final class DiffusionLastModifiedController extends DiffusionController {
private function renderColumns( private function renderColumns(
DiffusionRequest $drequest, DiffusionRequest $drequest,
PhabricatorRepositoryCommit $commit = null, ?PhabricatorRepositoryCommit $commit = null,
$lint = null) { $lint = null) {
$viewer = $this->getViewer(); $viewer = $this->getViewer();

View file

@ -20,7 +20,7 @@ final class DiffusionLocalRepositoryFilter extends Phobject {
return $this->viewer; return $this->viewer;
} }
public function setDevice(AlmanacDevice $device = null) { public function setDevice(?AlmanacDevice $device = null) {
$this->device = $device; $this->device = $device;
return $this; return $this;
} }

View file

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

View file

@ -68,7 +68,7 @@ final class DiffusionCommitRevisionQuery
PhabricatorUser $viewer, PhabricatorUser $viewer,
$source_object, $source_object,
array $object_names, array $object_names,
PhabricatorRepository $repository_scope = null) { ?PhabricatorRepository $repository_scope = null) {
// Fetch commits first, since we need to load data on commits in order // Fetch commits first, since we need to load data on commits in order
// to identify associated revisions later on. // to identify associated revisions later on.

View file

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

View file

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

View file

@ -18,8 +18,8 @@ final class PhabricatorImageDocumentEngine
} }
public function canDiffDocuments( public function canDiffDocuments(
PhabricatorDocumentRef $uref = null, ?PhabricatorDocumentRef $uref = null,
PhabricatorDocumentRef $vref = null) { ?PhabricatorDocumentRef $vref = null) {
// For now, we can only render a rich image diff if the documents have // For now, we can only render a rich image diff if the documents have
// their data stored in Files already. // their data stored in Files already.
@ -36,8 +36,8 @@ final class PhabricatorImageDocumentEngine
} }
public function newEngineBlocks( public function newEngineBlocks(
PhabricatorDocumentRef $uref = null, ?PhabricatorDocumentRef $uref = null,
PhabricatorDocumentRef $vref = null) { ?PhabricatorDocumentRef $vref = null) {
if ($uref) { if ($uref) {
$u_blocks = $this->newDiffBlocks($uref); $u_blocks = $this->newDiffBlocks($uref);

View file

@ -36,14 +36,14 @@ final class PhabricatorJupyterDocumentEngine
} }
public function canDiffDocuments( public function canDiffDocuments(
PhabricatorDocumentRef $uref = null, ?PhabricatorDocumentRef $uref = null,
PhabricatorDocumentRef $vref = null) { ?PhabricatorDocumentRef $vref = null) {
return true; return true;
} }
public function newEngineBlocks( public function newEngineBlocks(
PhabricatorDocumentRef $uref = null, ?PhabricatorDocumentRef $uref = null,
PhabricatorDocumentRef $vref = null) { ?PhabricatorDocumentRef $vref = null) {
$blocks = new PhabricatorDocumentEngineBlocks(); $blocks = new PhabricatorDocumentEngineBlocks();

View file

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

View file

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

View file

@ -1534,7 +1534,7 @@ final class PhabricatorProjectCoreTestCase extends PhabricatorTestCase {
private function createProject( private function createProject(
PhabricatorUser $user, PhabricatorUser $user,
PhabricatorProject $parent = null, ?PhabricatorProject $parent = null,
$is_milestone = false) { $is_milestone = false) {
$project = PhabricatorProject::initializeNewProject($user, $parent); $project = PhabricatorProject::initializeNewProject($user, $parent);

View file

@ -54,7 +54,7 @@ final class ProjectBoardTaskCard extends Phobject {
return $this->task; return $this->task;
} }
public function setOwner(PhabricatorObjectHandle $owner = null) { public function setOwner(?PhabricatorObjectHandle $owner = null) {
$this->owner = $owner; $this->owner = $owner;
return $this; return $this;
} }

View file

@ -405,7 +405,7 @@ final class PhabricatorRepositoryPullLocalDaemon
private function loadPullableRepositories( private function loadPullableRepositories(
array $include, array $include,
array $exclude, array $exclude,
AlmanacDevice $device = null) { ?AlmanacDevice $device = null) {
$query = id(new PhabricatorRepositoryQuery()) $query = id(new PhabricatorRepositoryQuery())
->setViewer($this->getViewer()); ->setViewer($this->getViewer());

View file

@ -172,7 +172,7 @@ final class PhabricatorRepositoryPullEngine
$this->donePull(); $this->donePull();
} }
private function abortPull($message, Exception $ex = null) { private function abortPull($message, ?Exception $ex = null) {
$code_error = PhabricatorRepositoryStatusMessage::CODE_ERROR; $code_error = PhabricatorRepositoryStatusMessage::CODE_ERROR;
$this->updateRepositoryInitStatus($code_error, $message); $this->updateRepositoryInitStatus($code_error, $message);
if ($ex) { if ($ex) {

View file

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

View file

@ -227,7 +227,7 @@ final class PhutilSearchQueryCompilerTestCase
private function assertCompileQueries( private function assertCompileQueries(
array $tests, array $tests,
$operators = null, $operators = null,
PhutilSearchStemmer $stemmer = null) { ?PhutilSearchStemmer $stemmer = null) {
foreach ($tests as $input => $expect) { foreach ($tests as $input => $expect) {
$caught = null; $caught = null;

View file

@ -263,7 +263,7 @@ class PhabricatorElasticFulltextStorageEngine
$exceptions); $exceptions);
} }
public function indexExists(PhabricatorElasticsearchHost $host = null) { public function indexExists(?PhabricatorElasticsearchHost $host = null) {
if (!$host) { if (!$host) {
$host = $this->getHostForRead(); $host = $this->getHostForRead();
} }
@ -397,7 +397,7 @@ class PhabricatorElasticFulltextStorageEngine
return $data; return $data;
} }
public function indexIsSane(PhabricatorElasticsearchHost $host = null) { public function indexIsSane(?PhabricatorElasticsearchHost $host = null) {
if (!$host) { if (!$host) {
$host = $this->getHostForRead(); $host = $this->getHostForRead();
} }
@ -476,7 +476,7 @@ class PhabricatorElasticFulltextStorageEngine
$this->executeRequest($host, '/', $data, 'PUT'); $this->executeRequest($host, '/', $data, 'PUT');
} }
public function getIndexStats(PhabricatorElasticsearchHost $host = null) { public function getIndexStats(?PhabricatorElasticsearchHost $host = null) {
if ($this->version < 2) { if ($this->version < 2) {
return false; return false;
} }

View file

@ -27,7 +27,7 @@ final class PhabricatorDashboardProfileMenuItem
return true; return true;
} }
private function attachDashboard(PhabricatorDashboard $dashboard = null) { private function attachDashboard(?PhabricatorDashboard $dashboard = null) {
$this->dashboard = $dashboard; $this->dashboard = $dashboard;
return $this; return $this;
} }

View file

@ -201,7 +201,7 @@ final class PhabricatorSearchApplicationSearchEngine
} }
public static function getIndexableDocumentTypes( public static function getIndexableDocumentTypes(
PhabricatorUser $viewer = null) { ?PhabricatorUser $viewer = null) {
// TODO: This is inelegant and not very efficient, but gets us reasonable // TODO: This is inelegant and not very efficient, but gets us reasonable
// results. It would be nice to do this more elegantly. // results. It would be nice to do this more elegantly.

View file

@ -146,7 +146,7 @@ final class PhabricatorEmailPreferencesSettingsPanel
return $form_box; return $form_box;
} }
private function getAllEditorsWithTags(PhabricatorUser $user = null) { private function getAllEditorsWithTags(?PhabricatorUser $user = null) {
$editors = id(new PhutilClassMapQuery()) $editors = id(new PhutilClassMapQuery())
->setAncestorClass('PhabricatorApplicationTransactionEditor') ->setAncestorClass('PhabricatorApplicationTransactionEditor')
->setFilterMethod('getMailTagsMap') ->setFilterMethod('getMailTagsMap')
@ -165,7 +165,7 @@ final class PhabricatorEmailPreferencesSettingsPanel
return $editors; return $editors;
} }
private function getAllTags(PhabricatorUser $user = null) { private function getAllTags(?PhabricatorUser $user = null) {
$tags = array(); $tags = array();
foreach ($this->getAllEditorsWithTags($user) as $editor) { foreach ($this->getAllEditorsWithTags($user) as $editor) {
$tags += $editor->getMailTagsMap(); $tags += $editor->getMailTagsMap();

View file

@ -4,7 +4,7 @@ abstract class PhabricatorSetting extends Phobject {
private $viewer = false; private $viewer = false;
public function setViewer(PhabricatorUser $viewer = null) { public function setViewer(?PhabricatorUser $viewer = null) {
$this->viewer = $viewer; $this->viewer = $viewer;
return $this; return $this;
} }

View file

@ -27,7 +27,7 @@ abstract class PhabricatorDraftEngine
} }
final public function setVersionedDraft( final public function setVersionedDraft(
PhabricatorVersionedDraft $draft = null) { ?PhabricatorVersionedDraft $draft = null) {
$this->hasVersionedDraft = true; $this->hasVersionedDraft = true;
$this->versionedDraft = $draft; $this->versionedDraft = $draft;
return $this; return $this;

View file

@ -288,7 +288,7 @@ abstract class PhabricatorInlineComment
public function attachVersionedDraftForViewer( public function attachVersionedDraftForViewer(
PhabricatorUser $viewer, PhabricatorUser $viewer,
PhabricatorVersionedDraft $draft = null) { ?PhabricatorVersionedDraft $draft = null) {
$key = $viewer->getCacheFragment(); $key = $viewer->getCacheFragment();
$this->versionedDrafts[$key] = $draft; $this->versionedDrafts[$key] = $draft;
@ -415,7 +415,7 @@ abstract class PhabricatorInlineComment
private function getWireContentStateMap( private function getWireContentStateMap(
$is_edit, $is_edit,
PhabricatorUser $viewer = null) { ?PhabricatorUser $viewer = null) {
$initial_state = $this->getInitialContentState(); $initial_state = $this->getInitialContentState();
$committed_state = $this->getCommittedContentState(); $committed_state = $this->getCommittedContentState();

View file

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

View file

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

View file

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