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

Note: This code change does *not* fix all occurrences but only allows passing `./bin/storage upgrade`.

Refs T15935

Test Plan: Try to successfully run `./bin/storage upgrade` with PHP 8.4

Reviewers: O1 Blessed Committers, chris

Reviewed By: O1 Blessed Committers, chris

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15935

Differential Revision: https://we.phorge.it/D25814
This commit is contained in:
Andre Klapper 2024-08-30 16:37:25 +02:00
parent b08c7c761c
commit db61eb20f0
40 changed files with 59 additions and 59 deletions

View file

@ -66,7 +66,7 @@ final class PhabricatorAuditTransactionComment
} }
public function attachReplyToComment( public function attachReplyToComment(
PhabricatorAuditTransactionComment $comment = null) { ?PhabricatorAuditTransactionComment $comment = null) {
$this->replyToComment = $comment; $this->replyToComment = $comment;
return $this; return $this;
} }
@ -93,7 +93,7 @@ final class PhabricatorAuditTransactionComment
} }
public function attachInlineContext( public function attachInlineContext(
PhabricatorInlineCommentContext $context = null) { ?PhabricatorInlineCommentContext $context = null) {
$this->inlineContext = $context; $this->inlineContext = $context;
return $this; return $this;
} }

View file

@ -338,7 +338,7 @@ abstract class PhabricatorApplication
*/ */
public function buildMainMenuItems( public function buildMainMenuItems(
PhabricatorUser $user, PhabricatorUser $user,
PhabricatorController $controller = null) { ?PhabricatorController $controller = null) {
return array(); return array();
} }

View file

@ -130,7 +130,7 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO
private function newChild( private function newChild(
PhabricatorUser $actor, PhabricatorUser $actor,
$sequence, $sequence,
PhutilCalendarDateTime $start = null) { ?PhutilCalendarDateTime $start = null) {
if (!$this->isParentEvent()) { if (!$this->isParentEvent()) {
throw new Exception( throw new Exception(
pht( pht(
@ -188,7 +188,7 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO
public function copyFromParent( public function copyFromParent(
PhabricatorUser $actor, PhabricatorUser $actor,
PhutilCalendarDateTime $start = null) { ?PhutilCalendarDateTime $start = null) {
if (!$this->isChildEvent()) { if (!$this->isChildEvent()) {
throw new Exception( throw new Exception(
@ -287,7 +287,7 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO
public function newGhost( public function newGhost(
PhabricatorUser $actor, PhabricatorUser $actor,
$sequence, $sequence,
PhutilCalendarDateTime $start = null) { ?PhutilCalendarDateTime $start = null) {
$ghost = $this->newChild($actor, $sequence, $start); $ghost = $this->newChild($actor, $sequence, $start);
@ -559,7 +559,7 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO
return $this->assertAttached($this->parentEvent); return $this->assertAttached($this->parentEvent);
} }
public function attachParentEvent(PhabricatorCalendarEvent $event = null) { public function attachParentEvent(?PhabricatorCalendarEvent $event = null) {
$this->parentEvent = $event; $this->parentEvent = $event;
return $this; return $this;
} }
@ -957,7 +957,7 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO
$datetime->newAbsoluteDateTime()->toDictionary()); $datetime->newAbsoluteDateTime()->toDictionary());
} }
public function setUntilDateTime(PhutilCalendarDateTime $datetime = null) { public function setUntilDateTime(?PhutilCalendarDateTime $datetime = null) {
if ($datetime) { if ($datetime) {
$value = $datetime->newAbsoluteDateTime()->toDictionary(); $value = $datetime->newAbsoluteDateTime()->toDictionary();
} else { } else {
@ -1045,7 +1045,7 @@ final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO
} }
public function attachImportSource( public function attachImportSource(
PhabricatorCalendarImport $import = null) { ?PhabricatorCalendarImport $import = null) {
$this->importSource = $import; $this->importSource = $import;
return $this; return $this;
} }

View file

@ -349,8 +349,8 @@ final class PhabricatorConfigSchemaQuery extends Phobject {
} }
private function compareSchemata( private function compareSchemata(
PhabricatorConfigStorageSchema $expect = null, ?PhabricatorConfigStorageSchema $expect = null,
PhabricatorConfigStorageSchema $actual = null) { ?PhabricatorConfigStorageSchema $actual = null) {
$expect_is_key = ($expect instanceof PhabricatorConfigKeySchema); $expect_is_key = ($expect instanceof PhabricatorConfigKeySchema);
$actual_is_key = ($actual instanceof PhabricatorConfigKeySchema); $actual_is_key = ($actual instanceof PhabricatorConfigKeySchema);

View file

@ -290,8 +290,8 @@ final class DifferentialChangeset
} }
public function getAbsoluteRepositoryPath( public function getAbsoluteRepositoryPath(
PhabricatorRepository $repository = null, ?PhabricatorRepository $repository = null,
DifferentialDiff $diff = null) { ?DifferentialDiff $diff = null) {
$base = '/'; $base = '/';
if ($diff && $diff->getSourceControlPath()) { if ($diff && $diff->getSourceControlPath()) {
@ -550,7 +550,7 @@ final class DifferentialChangeset
} }
public function newComparisonChangeset( public function newComparisonChangeset(
DifferentialChangeset $against = null) { ?DifferentialChangeset $against = null) {
$left = $this; $left = $this;
$right = $against; $right = $against;

View file

@ -332,7 +332,7 @@ final class DifferentialDiff
return $this->assertAttached($this->revision); return $this->assertAttached($this->revision);
} }
public function attachRevision(DifferentialRevision $revision = null) { public function attachRevision(?DifferentialRevision $revision = null) {
$this->revision = $revision; $this->revision = $revision;
return $this; return $this;
} }
@ -363,7 +363,7 @@ final class DifferentialDiff
return $this->assertAttached($this->properties); return $this->assertAttached($this->properties);
} }
public function attachBuildable(HarbormasterBuildable $buildable = null) { public function attachBuildable(?HarbormasterBuildable $buildable = null) {
$this->buildable = $buildable; $this->buildable = $buildable;
return $this; return $this;
} }

View file

@ -435,7 +435,7 @@ final class DifferentialHunk
private function destroyData( private function destroyData(
$type, $type,
$data, $data,
PhabricatorDestructionEngine $engine = null) { ?PhabricatorDestructionEngine $engine = null) {
if (!$engine) { if (!$engine) {
$engine = new PhabricatorDestructionEngine(); $engine = new PhabricatorDestructionEngine();

View file

@ -592,7 +592,7 @@ final class DifferentialRevision extends DifferentialDAO
return $this->assertAttached($this->repository); return $this->assertAttached($this->repository);
} }
public function attachRepository(PhabricatorRepository $repository = null) { public function attachRepository(?PhabricatorRepository $repository = null) {
$this->repository = $repository; $this->repository = $repository;
return $this; return $this;
} }
@ -668,7 +668,7 @@ final class DifferentialRevision extends DifferentialDAO
public function attachFlag( public function attachFlag(
PhabricatorUser $viewer, PhabricatorUser $viewer,
PhabricatorFlag $flag = null) { ?PhabricatorFlag $flag = null) {
$this->flags[$viewer->getPHID()] = $flag; $this->flags[$viewer->getPHID()] = $flag;
return $this; return $this;
} }

View file

@ -25,7 +25,7 @@ final class DifferentialTransactionComment
} }
public function attachReplyToComment( public function attachReplyToComment(
DifferentialTransactionComment $comment = null) { ?DifferentialTransactionComment $comment = null) {
$this->replyToComment = $comment; $this->replyToComment = $comment;
return $this; return $this;
} }
@ -139,7 +139,7 @@ final class DifferentialTransactionComment
} }
public function attachInlineContext( public function attachInlineContext(
PhabricatorInlineCommentContext $context = null) { ?PhabricatorInlineCommentContext $context = null) {
$this->inlineContext = $context; $this->inlineContext = $context;
return $this; return $this;
} }

View file

@ -72,7 +72,7 @@ final class DivinerLiveBook extends DivinerDAO
return idx($spec, 'name', $group); return idx($spec, 'name', $group);
} }
public function attachRepository(PhabricatorRepository $repository = null) { public function attachRepository(?PhabricatorRepository $repository = null) {
$this->repository = $repository; $this->repository = $repository;
return $this; return $this;
} }

View file

@ -102,7 +102,7 @@ final class DivinerLiveSymbol extends DivinerDAO
return $this->assertAttached($this->repository); return $this->assertAttached($this->repository);
} }
public function attachRepository(PhabricatorRepository $repository = null) { public function attachRepository(?PhabricatorRepository $repository = null) {
$this->repository = $repository; $this->repository = $repository;
return $this; return $this;
} }
@ -111,7 +111,7 @@ final class DivinerLiveSymbol extends DivinerDAO
return $this->assertAttached($this->atom); return $this->assertAttached($this->atom);
} }
public function attachAtom(DivinerLiveAtom $atom = null) { public function attachAtom(?DivinerLiveAtom $atom = null) {
if ($atom === null) { if ($atom === null) {
$this->atom = null; $this->atom = null;
} else { } else {

View file

@ -3,6 +3,6 @@
interface DoorkeeperBridgedObjectInterface { interface DoorkeeperBridgedObjectInterface {
public function getBridgedObject(); public function getBridgedObject();
public function attachBridgedObject(DoorkeeperExternalObject $object = null); public function attachBridgedObject(?DoorkeeperExternalObject $object = null);
} }

View file

@ -139,7 +139,7 @@ final class DrydockLease extends DrydockDAO
return $this->assertAttached($this->resource); return $this->assertAttached($this->resource);
} }
public function attachResource(DrydockResource $resource = null) { public function attachResource(?DrydockResource $resource = null) {
$this->resource = $resource; $this->resource = $resource;
return $this; return $this;
} }

View file

@ -49,7 +49,7 @@ final class DrydockLog extends DrydockDAO
) + parent::getConfiguration(); ) + parent::getConfiguration();
} }
public function attachBlueprint(DrydockBlueprint $blueprint = null) { public function attachBlueprint(?DrydockBlueprint $blueprint = null) {
$this->blueprint = $blueprint; $this->blueprint = $blueprint;
return $this; return $this;
} }
@ -58,7 +58,7 @@ final class DrydockLog extends DrydockDAO
return $this->assertAttached($this->blueprint); return $this->assertAttached($this->blueprint);
} }
public function attachResource(DrydockResource $resource = null) { public function attachResource(?DrydockResource $resource = null) {
$this->resource = $resource; $this->resource = $resource;
return $this; return $this;
} }
@ -67,7 +67,7 @@ final class DrydockLog extends DrydockDAO
return $this->assertAttached($this->resource); return $this->assertAttached($this->resource);
} }
public function attachLease(DrydockLease $lease = null) { public function attachLease(?DrydockLease $lease = null) {
$this->lease = $lease; $this->lease = $lease;
return $this; return $this;
} }
@ -77,7 +77,7 @@ final class DrydockLog extends DrydockDAO
} }
public function attachOperation( public function attachOperation(
DrydockRepositoryOperation $operation = null) { ?DrydockRepositoryOperation $operation = null) {
$this->operation = $operation; $this->operation = $operation;
return $this; return $this;
} }

View file

@ -1314,7 +1314,7 @@ final class PhabricatorFile extends PhabricatorFileDAO
return $this->assertAttached($this->originalFile); return $this->assertAttached($this->originalFile);
} }
public function attachOriginalFile(PhabricatorFile $file = null) { public function attachOriginalFile(?PhabricatorFile $file = null) {
$this->originalFile = $file; $this->originalFile = $file;
return $this; return $this;
} }

View file

@ -71,7 +71,7 @@ final class PhabricatorFileAttachment
return $this->assertAttached($this->object); return $this->assertAttached($this->object);
} }
public function attachFile(PhabricatorFile $file = null) { public function attachFile(?PhabricatorFile $file = null) {
$this->file = $file; $this->file = $file;
return $this; return $this;
} }

View file

@ -44,7 +44,7 @@ final class PhabricatorFileChunk extends PhabricatorFileDAO
->setByteEnd($end); ->setByteEnd($end);
} }
public function attachDataFile(PhabricatorFile $file = null) { public function attachDataFile(?PhabricatorFile $file = null) {
$this->dataFile = $file; $this->dataFile = $file;
return $this; return $this;
} }

View file

@ -64,7 +64,7 @@ final class FundBacker extends FundDAO
return $this->assertAttached($this->initiative); return $this->assertAttached($this->initiative);
} }
public function attachInitiative(FundInitiative $initiative = null) { public function attachInitiative(?FundInitiative $initiative = null) {
$this->initiative = $initiative; $this->initiative = $initiative;
return $this; return $this;
} }

View file

@ -90,7 +90,7 @@ final class HarbormasterBuild extends HarbormasterDAO
} }
public function attachBuildPlan( public function attachBuildPlan(
HarbormasterBuildPlan $build_plan = null) { ?HarbormasterBuildPlan $build_plan = null) {
$this->buildPlan = $build_plan; $this->buildPlan = $build_plan;
return $this; return $this;
} }

View file

@ -715,7 +715,7 @@ final class HarbormasterBuildLog
$this->delete(); $this->delete();
} }
public function destroyFile(PhabricatorDestructionEngine $engine = null) { public function destroyFile(?PhabricatorDestructionEngine $engine = null) {
if (!$engine) { if (!$engine) {
$engine = new PhabricatorDestructionEngine(); $engine = new PhabricatorDestructionEngine();
} }

View file

@ -146,7 +146,7 @@ final class HarbormasterBuildTarget
return $this->assertAttached($this->build); return $this->assertAttached($this->build);
} }
public function attachBuildStep(HarbormasterBuildStep $step = null) { public function attachBuildStep(?HarbormasterBuildStep $step = null) {
$this->buildStep = $step; $this->buildStep = $step;
return $this; return $this;
} }

View file

@ -131,7 +131,7 @@ final class LegalpadDocument extends LegalpadDAO
public function attachUserSignature( public function attachUserSignature(
$user_phid, $user_phid,
LegalpadDocumentSignature $signature = null) { ?LegalpadDocumentSignature $signature = null) {
$this->userSignatures[$user_phid] = $signature; $this->userSignatures[$user_phid] = $signature;
return $this; return $this;
} }

View file

@ -32,7 +32,7 @@ final class PhabricatorFileImageMacro extends PhabricatorFileDAO
return $this->assertAttached($this->file); return $this->assertAttached($this->file);
} }
public function attachAudio(PhabricatorFile $audio = null) { public function attachAudio(?PhabricatorFile $audio = null) {
$this->audio = $audio; $this->audio = $audio;
return $this; return $this;
} }

View file

@ -539,7 +539,7 @@ final class ManiphestTask extends ManiphestDAO
} }
public function attachBridgedObject( public function attachBridgedObject(
DoorkeeperExternalObject $object = null) { ?DoorkeeperExternalObject $object = null) {
$this->bridgedObject = $object; $this->bridgedObject = $object;
return $this; return $this;
} }

View file

@ -444,7 +444,7 @@ final class PhabricatorMetaMTAReceivedMail extends PhabricatorMetaMTADAO {
private function sendExceptionMail( private function sendExceptionMail(
Exception $ex, Exception $ex,
PhabricatorUser $viewer = null) { ?PhabricatorUser $viewer = null) {
// If we've failed to identify a legitimate sender, we don't send them // If we've failed to identify a legitimate sender, we don't send them
// an error message back. We want to avoid sending mail to unverified // an error message back. We want to avoid sending mail to unverified

View file

@ -180,7 +180,7 @@ final class NuanceItem
return $this->assertAttached($this->queue); return $this->assertAttached($this->queue);
} }
public function attachQueue(NuanceQueue $queue = null) { public function attachQueue(?NuanceQueue $queue = null) {
$this->queue = $queue; $this->queue = $queue;
return $this; return $this;
} }

View file

@ -91,7 +91,7 @@ final class PassphraseCredential extends PassphraseDAO
PassphraseCredentialPHIDType::TYPECONST); PassphraseCredentialPHIDType::TYPECONST);
} }
public function attachSecret(PhutilOpaqueEnvelope $secret = null) { public function attachSecret(?PhutilOpaqueEnvelope $secret = null) {
$this->secret = $secret; $this->secret = $secret;
return $this; return $this;
} }

View file

@ -13,7 +13,7 @@ final class PhabricatorUserLog extends PhabricatorUserDAO
protected $session; protected $session;
public static function initializeNewLog( public static function initializeNewLog(
PhabricatorUser $actor = null, ?PhabricatorUser $actor = null,
$object_phid = null, $object_phid = null,
$action = null) { $action = null) {

View file

@ -106,7 +106,7 @@ final class PhortuneCart extends PhortuneDAO
public function willApplyCharge( public function willApplyCharge(
PhabricatorUser $actor, PhabricatorUser $actor,
PhortunePaymentProvider $provider, PhortunePaymentProvider $provider,
PhortunePaymentMethod $method = null) { ?PhortunePaymentMethod $method = null) {
$account = $this->getAccount(); $account = $this->getAccount();

View file

@ -137,7 +137,7 @@ final class PhortuneCharge extends PhortuneDAO
return $this->assertAttached($this->cart); return $this->assertAttached($this->cart);
} }
public function attachCart(PhortuneCart $cart = null) { public function attachCart(?PhortuneCart $cart = null) {
$this->cart = $cart; $this->cart = $cart;
return $this; return $this;
} }

View file

@ -47,7 +47,7 @@ final class PhabricatorPolicy
public static function newFromPolicyAndHandle( public static function newFromPolicyAndHandle(
$policy_identifier, $policy_identifier,
PhabricatorObjectHandle $handle = null) { ?PhabricatorObjectHandle $handle = null) {
$is_global = PhabricatorPolicyQuery::isGlobalPolicy($policy_identifier); $is_global = PhabricatorPolicyQuery::isGlobalPolicy($policy_identifier);
if ($is_global) { if ($is_global) {

View file

@ -40,7 +40,7 @@ final class PonderAnswer extends PonderDAO
} }
public function attachQuestion(PonderQuestion $question = null) { public function attachQuestion(?PonderQuestion $question = null) {
$this->question = $question; $this->question = $question;
return $this; return $this;
} }

View file

@ -67,7 +67,7 @@ final class PhabricatorProject extends PhabricatorProjectDAO
public static function initializeNewProject( public static function initializeNewProject(
PhabricatorUser $actor, PhabricatorUser $actor,
PhabricatorProject $parent = null) { ?PhabricatorProject $parent = null) {
$app = id(new PhabricatorApplicationQuery()) $app = id(new PhabricatorApplicationQuery())
->setViewer(PhabricatorUser::getOmnipotentUser()) ->setViewer(PhabricatorUser::getOmnipotentUser())
@ -498,7 +498,7 @@ final class PhabricatorProject extends PhabricatorProjectDAO
return $this->assertAttached($this->parentProject); return $this->assertAttached($this->parentProject);
} }
public function attachParentProject(PhabricatorProject $project = null) { public function attachParentProject(?PhabricatorProject $project = null) {
$this->parentProject = $project; $this->parentProject = $project;
return $this; return $this;
} }

View file

@ -186,7 +186,7 @@ final class PhabricatorProjectColumn
return sprintf('%s%012d', $group, $sequence); return sprintf('%s%012d', $group, $sequence);
} }
public function attachTrigger(PhabricatorProjectTrigger $trigger = null) { public function attachTrigger(?PhabricatorProjectTrigger $trigger = null) {
$this->trigger = $trigger; $this->trigger = $trigger;
return $this; return $this;
} }

View file

@ -250,7 +250,7 @@ final class PhabricatorRepository extends PhabricatorRepositoryDAO
} }
public function attachMostRecentCommit( public function attachMostRecentCommit(
PhabricatorRepositoryCommit $commit = null) { ?PhabricatorRepositoryCommit $commit = null) {
$this->mostRecentCommit = $commit; $this->mostRecentCommit = $commit;
return $this; return $this;
} }

View file

@ -169,7 +169,7 @@ final class PhabricatorRepositoryCommit
} }
public function attachCommitData( public function attachCommitData(
PhabricatorRepositoryCommitData $data = null) { ?PhabricatorRepositoryCommitData $data = null) {
$this->commitData = $data; $this->commitData = $data;
return $this; return $this;
} }
@ -198,8 +198,8 @@ final class PhabricatorRepositoryCommit
} }
public function attachIdentities( public function attachIdentities(
PhabricatorRepositoryIdentity $author = null, ?PhabricatorRepositoryIdentity $author = null,
PhabricatorRepositoryIdentity $committer = null) { ?PhabricatorRepositoryIdentity $committer = null) {
$this->authorIdentity = $author; $this->authorIdentity = $author;
$this->committerIdentity = $committer; $this->committerIdentity = $committer;

View file

@ -59,7 +59,7 @@ final class PhabricatorRepositoryPullEvent
PhabricatorRepositoryPullEventPHIDType::TYPECONST); PhabricatorRepositoryPullEventPHIDType::TYPECONST);
} }
public function attachRepository(PhabricatorRepository $repository = null) { public function attachRepository(?PhabricatorRepository $repository = null) {
$this->repository = $repository; $this->repository = $repository;
return $this; return $this;
} }

View file

@ -93,7 +93,7 @@ final class PhabricatorUserPreferences
return $this; return $this;
} }
public function attachUser(PhabricatorUser $user = null) { public function attachUser(?PhabricatorUser $user = null) {
$this->user = $user; $this->user = $user;
return $this; return $this;
} }

View file

@ -96,7 +96,7 @@ final class PhabricatorWorkerTrigger
return $this->assertAttached($this->event); return $this->assertAttached($this->event);
} }
public function attachEvent(PhabricatorWorkerTriggerEvent $event = null) { public function attachEvent(?PhabricatorWorkerTriggerEvent $event = null) {
$this->event = $event; $this->event = $event;
return $this; return $this;
} }

View file

@ -159,7 +159,7 @@ abstract class PhabricatorLiskDAO extends LiskDAO {
$database)); $database));
} }
private function raiseUnreachable($database, Exception $proxy = null) { private function raiseUnreachable($database, ?Exception $proxy = null) {
$message = pht( $message = pht(
'Unable to establish a connection to any database host '. 'Unable to establish a connection to any database host '.
'(while trying "%s"). All masters and replicas are completely '. '(while trying "%s"). All masters and replicas are completely '.