1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-21 22:32:41 +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(
PhabricatorAuditTransactionComment $comment = null) {
?PhabricatorAuditTransactionComment $comment = null) {
$this->replyToComment = $comment;
return $this;
}
@ -93,7 +93,7 @@ final class PhabricatorAuditTransactionComment
}
public function attachInlineContext(
PhabricatorInlineCommentContext $context = null) {
?PhabricatorInlineCommentContext $context = null) {
$this->inlineContext = $context;
return $this;
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -3,6 +3,6 @@
interface DoorkeeperBridgedObjectInterface {
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);
}
public function attachResource(DrydockResource $resource = null) {
public function attachResource(?DrydockResource $resource = null) {
$this->resource = $resource;
return $this;
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -444,7 +444,7 @@ final class PhabricatorMetaMTAReceivedMail extends PhabricatorMetaMTADAO {
private function sendExceptionMail(
Exception $ex,
PhabricatorUser $viewer = null) {
?PhabricatorUser $viewer = null) {
// 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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -47,7 +47,7 @@ final class PhabricatorPolicy
public static function newFromPolicyAndHandle(
$policy_identifier,
PhabricatorObjectHandle $handle = null) {
?PhabricatorObjectHandle $handle = null) {
$is_global = PhabricatorPolicyQuery::isGlobalPolicy($policy_identifier);
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;
return $this;
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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