diff --git a/src/applications/audit/storage/PhabricatorAuditTransactionComment.php b/src/applications/audit/storage/PhabricatorAuditTransactionComment.php
--- a/src/applications/audit/storage/PhabricatorAuditTransactionComment.php
+++ b/src/applications/audit/storage/PhabricatorAuditTransactionComment.php
@@ -66,7 +66,7 @@
   }
 
   public function attachReplyToComment(
-    PhabricatorAuditTransactionComment $comment = null) {
+    ?PhabricatorAuditTransactionComment $comment = null) {
     $this->replyToComment = $comment;
     return $this;
   }
@@ -93,7 +93,7 @@
   }
 
   public function attachInlineContext(
-    PhabricatorInlineCommentContext $context = null) {
+    ?PhabricatorInlineCommentContext $context = null) {
     $this->inlineContext = $context;
     return $this;
   }
diff --git a/src/applications/base/PhabricatorApplication.php b/src/applications/base/PhabricatorApplication.php
--- a/src/applications/base/PhabricatorApplication.php
+++ b/src/applications/base/PhabricatorApplication.php
@@ -338,7 +338,7 @@
    */
   public function buildMainMenuItems(
     PhabricatorUser $user,
-    PhabricatorController $controller = null) {
+    ?PhabricatorController $controller = null) {
     return array();
   }
 
diff --git a/src/applications/calendar/storage/PhabricatorCalendarEvent.php b/src/applications/calendar/storage/PhabricatorCalendarEvent.php
--- a/src/applications/calendar/storage/PhabricatorCalendarEvent.php
+++ b/src/applications/calendar/storage/PhabricatorCalendarEvent.php
@@ -130,7 +130,7 @@
   private function newChild(
     PhabricatorUser $actor,
     $sequence,
-    PhutilCalendarDateTime $start = null) {
+    ?PhutilCalendarDateTime $start = null) {
     if (!$this->isParentEvent()) {
       throw new Exception(
         pht(
@@ -188,7 +188,7 @@
 
   public function copyFromParent(
     PhabricatorUser $actor,
-    PhutilCalendarDateTime $start = null) {
+    ?PhutilCalendarDateTime $start = null) {
 
     if (!$this->isChildEvent()) {
       throw new Exception(
@@ -287,7 +287,7 @@
   public function newGhost(
     PhabricatorUser $actor,
     $sequence,
-    PhutilCalendarDateTime $start = null) {
+    ?PhutilCalendarDateTime $start = null) {
 
     $ghost = $this->newChild($actor, $sequence, $start);
 
@@ -559,7 +559,7 @@
     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 @@
       $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 @@
   }
 
   public function attachImportSource(
-    PhabricatorCalendarImport $import = null) {
+    ?PhabricatorCalendarImport $import = null) {
     $this->importSource = $import;
     return $this;
   }
diff --git a/src/applications/config/schema/PhabricatorConfigSchemaQuery.php b/src/applications/config/schema/PhabricatorConfigSchemaQuery.php
--- a/src/applications/config/schema/PhabricatorConfigSchemaQuery.php
+++ b/src/applications/config/schema/PhabricatorConfigSchemaQuery.php
@@ -349,8 +349,8 @@
   }
 
   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);
diff --git a/src/applications/differential/storage/DifferentialChangeset.php b/src/applications/differential/storage/DifferentialChangeset.php
--- a/src/applications/differential/storage/DifferentialChangeset.php
+++ b/src/applications/differential/storage/DifferentialChangeset.php
@@ -290,8 +290,8 @@
   }
 
   public function getAbsoluteRepositoryPath(
-    PhabricatorRepository $repository = null,
-    DifferentialDiff $diff = null) {
+    ?PhabricatorRepository $repository = null,
+    ?DifferentialDiff $diff = null) {
 
     $base = '/';
     if ($diff && $diff->getSourceControlPath()) {
@@ -550,7 +550,7 @@
   }
 
   public function newComparisonChangeset(
-    DifferentialChangeset $against = null) {
+    ?DifferentialChangeset $against = null) {
 
     $left = $this;
     $right = $against;
diff --git a/src/applications/differential/storage/DifferentialDiff.php b/src/applications/differential/storage/DifferentialDiff.php
--- a/src/applications/differential/storage/DifferentialDiff.php
+++ b/src/applications/differential/storage/DifferentialDiff.php
@@ -332,7 +332,7 @@
     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 @@
     return $this->assertAttached($this->properties);
   }
 
-  public function attachBuildable(HarbormasterBuildable $buildable = null) {
+  public function attachBuildable(?HarbormasterBuildable $buildable = null) {
     $this->buildable = $buildable;
     return $this;
   }
diff --git a/src/applications/differential/storage/DifferentialHunk.php b/src/applications/differential/storage/DifferentialHunk.php
--- a/src/applications/differential/storage/DifferentialHunk.php
+++ b/src/applications/differential/storage/DifferentialHunk.php
@@ -435,7 +435,7 @@
   private function destroyData(
     $type,
     $data,
-    PhabricatorDestructionEngine $engine = null) {
+    ?PhabricatorDestructionEngine $engine = null) {
 
     if (!$engine) {
       $engine = new PhabricatorDestructionEngine();
diff --git a/src/applications/differential/storage/DifferentialRevision.php b/src/applications/differential/storage/DifferentialRevision.php
--- a/src/applications/differential/storage/DifferentialRevision.php
+++ b/src/applications/differential/storage/DifferentialRevision.php
@@ -592,7 +592,7 @@
     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 @@
 
   public function attachFlag(
     PhabricatorUser $viewer,
-    PhabricatorFlag $flag = null) {
+    ?PhabricatorFlag $flag = null) {
     $this->flags[$viewer->getPHID()] = $flag;
     return $this;
   }
diff --git a/src/applications/differential/storage/DifferentialTransactionComment.php b/src/applications/differential/storage/DifferentialTransactionComment.php
--- a/src/applications/differential/storage/DifferentialTransactionComment.php
+++ b/src/applications/differential/storage/DifferentialTransactionComment.php
@@ -25,7 +25,7 @@
   }
 
   public function attachReplyToComment(
-    DifferentialTransactionComment $comment = null) {
+    ?DifferentialTransactionComment $comment = null) {
     $this->replyToComment = $comment;
     return $this;
   }
@@ -139,7 +139,7 @@
   }
 
   public function attachInlineContext(
-    PhabricatorInlineCommentContext $context = null) {
+    ?PhabricatorInlineCommentContext $context = null) {
     $this->inlineContext = $context;
     return $this;
   }
diff --git a/src/applications/diviner/storage/DivinerLiveBook.php b/src/applications/diviner/storage/DivinerLiveBook.php
--- a/src/applications/diviner/storage/DivinerLiveBook.php
+++ b/src/applications/diviner/storage/DivinerLiveBook.php
@@ -72,7 +72,7 @@
     return idx($spec, 'name', $group);
   }
 
-  public function attachRepository(PhabricatorRepository $repository = null) {
+  public function attachRepository(?PhabricatorRepository $repository = null) {
     $this->repository = $repository;
     return $this;
   }
diff --git a/src/applications/diviner/storage/DivinerLiveSymbol.php b/src/applications/diviner/storage/DivinerLiveSymbol.php
--- a/src/applications/diviner/storage/DivinerLiveSymbol.php
+++ b/src/applications/diviner/storage/DivinerLiveSymbol.php
@@ -102,7 +102,7 @@
     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 @@
     return $this->assertAttached($this->atom);
   }
 
-  public function attachAtom(DivinerLiveAtom $atom = null) {
+  public function attachAtom(?DivinerLiveAtom $atom = null) {
     if ($atom === null) {
       $this->atom = null;
     } else {
diff --git a/src/applications/doorkeeper/bridge/DoorkeeperBridgedObjectInterface.php b/src/applications/doorkeeper/bridge/DoorkeeperBridgedObjectInterface.php
--- a/src/applications/doorkeeper/bridge/DoorkeeperBridgedObjectInterface.php
+++ b/src/applications/doorkeeper/bridge/DoorkeeperBridgedObjectInterface.php
@@ -3,6 +3,6 @@
 interface DoorkeeperBridgedObjectInterface {
 
   public function getBridgedObject();
-  public function attachBridgedObject(DoorkeeperExternalObject $object = null);
+  public function attachBridgedObject(?DoorkeeperExternalObject $object = null);
 
 }
diff --git a/src/applications/drydock/storage/DrydockLease.php b/src/applications/drydock/storage/DrydockLease.php
--- a/src/applications/drydock/storage/DrydockLease.php
+++ b/src/applications/drydock/storage/DrydockLease.php
@@ -139,7 +139,7 @@
     return $this->assertAttached($this->resource);
   }
 
-  public function attachResource(DrydockResource $resource = null) {
+  public function attachResource(?DrydockResource $resource = null) {
     $this->resource = $resource;
     return $this;
   }
diff --git a/src/applications/drydock/storage/DrydockLog.php b/src/applications/drydock/storage/DrydockLog.php
--- a/src/applications/drydock/storage/DrydockLog.php
+++ b/src/applications/drydock/storage/DrydockLog.php
@@ -49,7 +49,7 @@
     ) + parent::getConfiguration();
   }
 
-  public function attachBlueprint(DrydockBlueprint $blueprint = null) {
+  public function attachBlueprint(?DrydockBlueprint $blueprint = null) {
     $this->blueprint = $blueprint;
     return $this;
   }
@@ -58,7 +58,7 @@
     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 @@
     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 @@
   }
 
   public function attachOperation(
-    DrydockRepositoryOperation $operation = null) {
+    ?DrydockRepositoryOperation $operation = null) {
     $this->operation = $operation;
     return $this;
   }
diff --git a/src/applications/files/storage/PhabricatorFile.php b/src/applications/files/storage/PhabricatorFile.php
--- a/src/applications/files/storage/PhabricatorFile.php
+++ b/src/applications/files/storage/PhabricatorFile.php
@@ -1314,7 +1314,7 @@
     return $this->assertAttached($this->originalFile);
   }
 
-  public function attachOriginalFile(PhabricatorFile $file = null) {
+  public function attachOriginalFile(?PhabricatorFile $file = null) {
     $this->originalFile = $file;
     return $this;
   }
diff --git a/src/applications/files/storage/PhabricatorFileAttachment.php b/src/applications/files/storage/PhabricatorFileAttachment.php
--- a/src/applications/files/storage/PhabricatorFileAttachment.php
+++ b/src/applications/files/storage/PhabricatorFileAttachment.php
@@ -71,7 +71,7 @@
     return $this->assertAttached($this->object);
   }
 
-  public function attachFile(PhabricatorFile $file = null) {
+  public function attachFile(?PhabricatorFile $file = null) {
     $this->file = $file;
     return $this;
   }
diff --git a/src/applications/files/storage/PhabricatorFileChunk.php b/src/applications/files/storage/PhabricatorFileChunk.php
--- a/src/applications/files/storage/PhabricatorFileChunk.php
+++ b/src/applications/files/storage/PhabricatorFileChunk.php
@@ -44,7 +44,7 @@
       ->setByteEnd($end);
   }
 
-  public function attachDataFile(PhabricatorFile $file = null) {
+  public function attachDataFile(?PhabricatorFile $file = null) {
     $this->dataFile = $file;
     return $this;
   }
diff --git a/src/applications/fund/storage/FundBacker.php b/src/applications/fund/storage/FundBacker.php
--- a/src/applications/fund/storage/FundBacker.php
+++ b/src/applications/fund/storage/FundBacker.php
@@ -64,7 +64,7 @@
     return $this->assertAttached($this->initiative);
   }
 
-  public function attachInitiative(FundInitiative $initiative = null) {
+  public function attachInitiative(?FundInitiative $initiative = null) {
     $this->initiative = $initiative;
     return $this;
   }
diff --git a/src/applications/harbormaster/storage/build/HarbormasterBuild.php b/src/applications/harbormaster/storage/build/HarbormasterBuild.php
--- a/src/applications/harbormaster/storage/build/HarbormasterBuild.php
+++ b/src/applications/harbormaster/storage/build/HarbormasterBuild.php
@@ -90,7 +90,7 @@
   }
 
   public function attachBuildPlan(
-    HarbormasterBuildPlan $build_plan = null) {
+    ?HarbormasterBuildPlan $build_plan = null) {
     $this->buildPlan = $build_plan;
     return $this;
   }
diff --git a/src/applications/harbormaster/storage/build/HarbormasterBuildLog.php b/src/applications/harbormaster/storage/build/HarbormasterBuildLog.php
--- a/src/applications/harbormaster/storage/build/HarbormasterBuildLog.php
+++ b/src/applications/harbormaster/storage/build/HarbormasterBuildLog.php
@@ -715,7 +715,7 @@
     $this->delete();
   }
 
-  public function destroyFile(PhabricatorDestructionEngine $engine = null) {
+  public function destroyFile(?PhabricatorDestructionEngine $engine = null) {
     if (!$engine) {
       $engine = new PhabricatorDestructionEngine();
     }
diff --git a/src/applications/harbormaster/storage/build/HarbormasterBuildTarget.php b/src/applications/harbormaster/storage/build/HarbormasterBuildTarget.php
--- a/src/applications/harbormaster/storage/build/HarbormasterBuildTarget.php
+++ b/src/applications/harbormaster/storage/build/HarbormasterBuildTarget.php
@@ -146,7 +146,7 @@
     return $this->assertAttached($this->build);
   }
 
-  public function attachBuildStep(HarbormasterBuildStep $step = null) {
+  public function attachBuildStep(?HarbormasterBuildStep $step = null) {
     $this->buildStep = $step;
     return $this;
   }
diff --git a/src/applications/legalpad/storage/LegalpadDocument.php b/src/applications/legalpad/storage/LegalpadDocument.php
--- a/src/applications/legalpad/storage/LegalpadDocument.php
+++ b/src/applications/legalpad/storage/LegalpadDocument.php
@@ -131,7 +131,7 @@
 
   public function attachUserSignature(
     $user_phid,
-    LegalpadDocumentSignature $signature = null) {
+    ?LegalpadDocumentSignature $signature = null) {
     $this->userSignatures[$user_phid] = $signature;
     return $this;
   }
diff --git a/src/applications/macro/storage/PhabricatorFileImageMacro.php b/src/applications/macro/storage/PhabricatorFileImageMacro.php
--- a/src/applications/macro/storage/PhabricatorFileImageMacro.php
+++ b/src/applications/macro/storage/PhabricatorFileImageMacro.php
@@ -32,7 +32,7 @@
     return $this->assertAttached($this->file);
   }
 
-  public function attachAudio(PhabricatorFile $audio = null) {
+  public function attachAudio(?PhabricatorFile $audio = null) {
     $this->audio = $audio;
     return $this;
   }
diff --git a/src/applications/maniphest/storage/ManiphestTask.php b/src/applications/maniphest/storage/ManiphestTask.php
--- a/src/applications/maniphest/storage/ManiphestTask.php
+++ b/src/applications/maniphest/storage/ManiphestTask.php
@@ -539,7 +539,7 @@
   }
 
   public function attachBridgedObject(
-    DoorkeeperExternalObject $object = null) {
+    ?DoorkeeperExternalObject $object = null) {
     $this->bridgedObject = $object;
     return $this;
   }
diff --git a/src/applications/metamta/storage/PhabricatorMetaMTAReceivedMail.php b/src/applications/metamta/storage/PhabricatorMetaMTAReceivedMail.php
--- a/src/applications/metamta/storage/PhabricatorMetaMTAReceivedMail.php
+++ b/src/applications/metamta/storage/PhabricatorMetaMTAReceivedMail.php
@@ -444,7 +444,7 @@
 
   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
diff --git a/src/applications/nuance/storage/NuanceItem.php b/src/applications/nuance/storage/NuanceItem.php
--- a/src/applications/nuance/storage/NuanceItem.php
+++ b/src/applications/nuance/storage/NuanceItem.php
@@ -180,7 +180,7 @@
     return $this->assertAttached($this->queue);
   }
 
-  public function attachQueue(NuanceQueue $queue = null) {
+  public function attachQueue(?NuanceQueue $queue = null) {
     $this->queue = $queue;
     return $this;
   }
diff --git a/src/applications/passphrase/storage/PassphraseCredential.php b/src/applications/passphrase/storage/PassphraseCredential.php
--- a/src/applications/passphrase/storage/PassphraseCredential.php
+++ b/src/applications/passphrase/storage/PassphraseCredential.php
@@ -91,7 +91,7 @@
       PassphraseCredentialPHIDType::TYPECONST);
   }
 
-  public function attachSecret(PhutilOpaqueEnvelope $secret = null) {
+  public function attachSecret(?PhutilOpaqueEnvelope $secret = null) {
     $this->secret = $secret;
     return $this;
   }
diff --git a/src/applications/people/storage/PhabricatorUserLog.php b/src/applications/people/storage/PhabricatorUserLog.php
--- a/src/applications/people/storage/PhabricatorUserLog.php
+++ b/src/applications/people/storage/PhabricatorUserLog.php
@@ -13,7 +13,7 @@
   protected $session;
 
   public static function initializeNewLog(
-    PhabricatorUser $actor = null,
+    ?PhabricatorUser $actor = null,
     $object_phid = null,
     $action = null) {
 
diff --git a/src/applications/phortune/storage/PhortuneCart.php b/src/applications/phortune/storage/PhortuneCart.php
--- a/src/applications/phortune/storage/PhortuneCart.php
+++ b/src/applications/phortune/storage/PhortuneCart.php
@@ -106,7 +106,7 @@
   public function willApplyCharge(
     PhabricatorUser $actor,
     PhortunePaymentProvider $provider,
-    PhortunePaymentMethod $method = null) {
+    ?PhortunePaymentMethod $method = null) {
 
     $account = $this->getAccount();
 
diff --git a/src/applications/phortune/storage/PhortuneCharge.php b/src/applications/phortune/storage/PhortuneCharge.php
--- a/src/applications/phortune/storage/PhortuneCharge.php
+++ b/src/applications/phortune/storage/PhortuneCharge.php
@@ -137,7 +137,7 @@
     return $this->assertAttached($this->cart);
   }
 
-  public function attachCart(PhortuneCart $cart = null) {
+  public function attachCart(?PhortuneCart $cart = null) {
     $this->cart = $cart;
     return $this;
   }
diff --git a/src/applications/policy/storage/PhabricatorPolicy.php b/src/applications/policy/storage/PhabricatorPolicy.php
--- a/src/applications/policy/storage/PhabricatorPolicy.php
+++ b/src/applications/policy/storage/PhabricatorPolicy.php
@@ -47,7 +47,7 @@
 
   public static function newFromPolicyAndHandle(
     $policy_identifier,
-    PhabricatorObjectHandle $handle = null) {
+    ?PhabricatorObjectHandle $handle = null) {
 
     $is_global = PhabricatorPolicyQuery::isGlobalPolicy($policy_identifier);
     if ($is_global) {
diff --git a/src/applications/ponder/storage/PonderAnswer.php b/src/applications/ponder/storage/PonderAnswer.php
--- a/src/applications/ponder/storage/PonderAnswer.php
+++ b/src/applications/ponder/storage/PonderAnswer.php
@@ -40,7 +40,7 @@
 
   }
 
-  public function attachQuestion(PonderQuestion $question = null) {
+  public function attachQuestion(?PonderQuestion $question = null) {
     $this->question = $question;
     return $this;
   }
diff --git a/src/applications/project/storage/PhabricatorProject.php b/src/applications/project/storage/PhabricatorProject.php
--- a/src/applications/project/storage/PhabricatorProject.php
+++ b/src/applications/project/storage/PhabricatorProject.php
@@ -67,7 +67,7 @@
 
   public static function initializeNewProject(
     PhabricatorUser $actor,
-    PhabricatorProject $parent = null) {
+    ?PhabricatorProject $parent = null) {
 
     $app = id(new PhabricatorApplicationQuery())
       ->setViewer(PhabricatorUser::getOmnipotentUser())
@@ -498,7 +498,7 @@
     return $this->assertAttached($this->parentProject);
   }
 
-  public function attachParentProject(PhabricatorProject $project = null) {
+  public function attachParentProject(?PhabricatorProject $project = null) {
     $this->parentProject = $project;
     return $this;
   }
diff --git a/src/applications/project/storage/PhabricatorProjectColumn.php b/src/applications/project/storage/PhabricatorProjectColumn.php
--- a/src/applications/project/storage/PhabricatorProjectColumn.php
+++ b/src/applications/project/storage/PhabricatorProjectColumn.php
@@ -186,7 +186,7 @@
     return sprintf('%s%012d', $group, $sequence);
   }
 
-  public function attachTrigger(PhabricatorProjectTrigger $trigger = null) {
+  public function attachTrigger(?PhabricatorProjectTrigger $trigger = null) {
     $this->trigger = $trigger;
     return $this;
   }
diff --git a/src/applications/repository/storage/PhabricatorRepository.php b/src/applications/repository/storage/PhabricatorRepository.php
--- a/src/applications/repository/storage/PhabricatorRepository.php
+++ b/src/applications/repository/storage/PhabricatorRepository.php
@@ -250,7 +250,7 @@
   }
 
   public function attachMostRecentCommit(
-    PhabricatorRepositoryCommit $commit = null) {
+    ?PhabricatorRepositoryCommit $commit = null) {
     $this->mostRecentCommit = $commit;
     return $this;
   }
diff --git a/src/applications/repository/storage/PhabricatorRepositoryCommit.php b/src/applications/repository/storage/PhabricatorRepositoryCommit.php
--- a/src/applications/repository/storage/PhabricatorRepositoryCommit.php
+++ b/src/applications/repository/storage/PhabricatorRepositoryCommit.php
@@ -169,7 +169,7 @@
   }
 
   public function attachCommitData(
-    PhabricatorRepositoryCommitData $data = null) {
+    ?PhabricatorRepositoryCommitData $data = null) {
     $this->commitData = $data;
     return $this;
   }
@@ -198,8 +198,8 @@
   }
 
   public function attachIdentities(
-    PhabricatorRepositoryIdentity $author = null,
-    PhabricatorRepositoryIdentity $committer = null) {
+    ?PhabricatorRepositoryIdentity $author = null,
+    ?PhabricatorRepositoryIdentity $committer = null) {
 
     $this->authorIdentity = $author;
     $this->committerIdentity = $committer;
diff --git a/src/applications/repository/storage/PhabricatorRepositoryPullEvent.php b/src/applications/repository/storage/PhabricatorRepositoryPullEvent.php
--- a/src/applications/repository/storage/PhabricatorRepositoryPullEvent.php
+++ b/src/applications/repository/storage/PhabricatorRepositoryPullEvent.php
@@ -59,7 +59,7 @@
       PhabricatorRepositoryPullEventPHIDType::TYPECONST);
   }
 
-  public function attachRepository(PhabricatorRepository $repository = null) {
+  public function attachRepository(?PhabricatorRepository $repository = null) {
     $this->repository = $repository;
     return $this;
   }
diff --git a/src/applications/settings/storage/PhabricatorUserPreferences.php b/src/applications/settings/storage/PhabricatorUserPreferences.php
--- a/src/applications/settings/storage/PhabricatorUserPreferences.php
+++ b/src/applications/settings/storage/PhabricatorUserPreferences.php
@@ -93,7 +93,7 @@
     return $this;
   }
 
-  public function attachUser(PhabricatorUser $user = null) {
+  public function attachUser(?PhabricatorUser $user = null) {
     $this->user = $user;
     return $this;
   }
diff --git a/src/infrastructure/daemon/workers/storage/PhabricatorWorkerTrigger.php b/src/infrastructure/daemon/workers/storage/PhabricatorWorkerTrigger.php
--- a/src/infrastructure/daemon/workers/storage/PhabricatorWorkerTrigger.php
+++ b/src/infrastructure/daemon/workers/storage/PhabricatorWorkerTrigger.php
@@ -96,7 +96,7 @@
     return $this->assertAttached($this->event);
   }
 
-  public function attachEvent(PhabricatorWorkerTriggerEvent $event = null) {
+  public function attachEvent(?PhabricatorWorkerTriggerEvent $event = null) {
     $this->event = $event;
     return $this;
   }
diff --git a/src/infrastructure/storage/lisk/PhabricatorLiskDAO.php b/src/infrastructure/storage/lisk/PhabricatorLiskDAO.php
--- a/src/infrastructure/storage/lisk/PhabricatorLiskDAO.php
+++ b/src/infrastructure/storage/lisk/PhabricatorLiskDAO.php
@@ -159,7 +159,7 @@
         $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 '.