1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-19 03:50:54 +01:00

Add some missing type hints

Summary: Add some typehints for Remarkup rules.

Test Plan: Browsed around some Remarkup text.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12694
This commit is contained in:
Joshua Spence 2015-05-05 07:33:00 +10:00
parent 6bebb3c69a
commit 4ea9d76f66
16 changed files with 73 additions and 29 deletions

View file

@ -15,7 +15,11 @@ final class PhabricatorCountdownRemarkupRule
->execute();
}
protected function renderObjectEmbed($object, $handle, $options) {
protected function renderObjectEmbed(
$object,
PhabricatorObjectHandle $handle,
$options) {
$viewer = $this->getEngine()->getConfig('viewer');
return id(new PhabricatorCountdownView())

View file

@ -14,10 +14,13 @@ final class PhabricatorDashboardRemarkupRule
->setViewer($viewer)
->withIDs($ids)
->execute();
}
protected function renderObjectEmbed($object, $handle, $options) {
protected function renderObjectEmbed(
$object,
PhabricatorObjectHandle $handle,
$options) {
$viewer = $this->getEngine()->getConfig('viewer');
return id(new PhabricatorDashboardPanelRenderingEngine())

View file

@ -33,7 +33,7 @@ final class DivinerSymbolRemarkupRule extends PhutilRemarkupRule {
$text);
}
public function markupSymbol($matches) {
public function markupSymbol(array $matches) {
if (!$this->isFlatText($matches[0])) {
return $matches[0];
}

View file

@ -28,7 +28,11 @@ final class PhabricatorEmbedFileRemarkupRule
return $objects;
}
protected function renderObjectEmbed($object, $handle, $options) {
protected function renderObjectEmbed(
$object,
PhabricatorObjectHandle $handle,
$options) {
$options = $this->getFileOptions($options) + array(
'name' => $object->getName(),
);

View file

@ -13,7 +13,7 @@ final class PhabricatorEmojiRemarkupRule extends PhutilRemarkupRule {
$text);
}
public function markupEmoji($matches) {
public function markupEmoji(array $matches) {
if (!$this->isFlatText($matches[0])) {
return $matches[0];
}

View file

@ -13,7 +13,7 @@ final class PhabricatorIconRemarkupRule extends PhutilRemarkupRule {
$text);
}
public function markupIcon($matches) {
public function markupIcon(array $matches) {
$engine = $this->getEngine();
$text_mode = $engine->isTextMode();
$mail_mode = $engine->isHTMLMailMode();
@ -73,7 +73,6 @@ final class PhabricatorIconRemarkupRule extends PhutilRemarkupRule {
$icon_view = id(new PHUIIconView())
->setIconFont('fa-'.$icon, $color);
return $this->getEngine()->storeText($icon_view);
}

View file

@ -13,7 +13,7 @@ final class PhabricatorImageMacroRemarkupRule extends PhutilRemarkupRule {
$text);
}
public function markupImageMacro($matches) {
public function markupImageMacro(array $matches) {
if ($this->macros === null) {
$this->macros = array();

View file

@ -15,7 +15,7 @@ final class PhabricatorMemeRemarkupRule extends PhutilRemarkupRule {
$text);
}
public function markupMeme($matches) {
public function markupMeme(array $matches) {
if (!$this->isFlatText($matches[0])) {
return $matches[0];
}

View file

@ -17,7 +17,11 @@ final class PhabricatorPasteRemarkupRule extends PhabricatorObjectRemarkupRule {
}
protected function renderObjectEmbed($object, $handle, $options) {
protected function renderObjectEmbed(
$object,
PhabricatorObjectHandle $handle,
$options) {
$embed_paste = id(new PasteEmbedView())
->setPaste($object)
->setHandle($handle);

View file

@ -26,7 +26,7 @@ final class PhabricatorMentionRemarkupRule extends PhutilRemarkupRule {
$text);
}
protected function markupMention($matches) {
protected function markupMention(array $matches) {
$engine = $this->getEngine();
if ($engine->isTextMode()) {

View file

@ -12,7 +12,11 @@ final class PholioRemarkupRule extends PhabricatorObjectRemarkupRule {
return '[1-9]\d*(?:/[1-9]\d*/?)?';
}
protected function getObjectHref($object, $handle, $id) {
protected function getObjectHref(
$object,
PhabricatorObjectHandle $handle,
$id) {
$href = $handle->getURI();
// If the ID has a `M123/456` component, link to that specific image.
@ -51,7 +55,11 @@ final class PholioRemarkupRule extends PhabricatorObjectRemarkupRule {
return $results;
}
protected function renderObjectEmbed($object, $handle, $options) {
protected function renderObjectEmbed(
$object,
PhabricatorObjectHandle $handle,
$options) {
$embed_mock = id(new PholioMockEmbedView())
->setMock($object);

View file

@ -13,8 +13,7 @@ final class PhrictionRemarkupRule extends PhutilRemarkupRule {
$text);
}
public function markupDocumentLink($matches) {
public function markupDocumentLink(array $matches) {
$link = trim($matches[1]);
$name = trim(idx($matches, 2, $link));
if (empty($matches[2])) {

View file

@ -6,7 +6,12 @@ final class ProjectRemarkupRule extends PhabricatorObjectRemarkupRule {
return '#';
}
protected function renderObjectRef($object, $handle, $anchor, $id) {
protected function renderObjectRef(
$object,
PhabricatorObjectHandle $handle,
$anchor,
$id) {
if ($this->getEngine()->isTextMode()) {
return '#'.$id;
}

View file

@ -18,7 +18,11 @@ final class SlowvoteRemarkupRule extends PhabricatorObjectRemarkupRule {
->execute();
}
protected function renderObjectEmbed($object, $handle, $options) {
protected function renderObjectEmbed(
$object,
PhabricatorObjectHandle $handle,
$options) {
$viewer = $this->getEngine()->getConfig('viewer');
$embed = id(new SlowvoteEmbedView())

View file

@ -13,7 +13,7 @@ final class PhabricatorNavigationRemarkupRule extends PhutilRemarkupRule {
$text);
}
public function markupNavigation($matches) {
public function markupNavigation(array $matches) {
if (!$this->isFlatText($matches[0])) {
return $matches[0];
}

View file

@ -45,10 +45,11 @@ abstract class PhabricatorObjectRemarkupRule extends PhutilRemarkupRule {
}
protected function renderObjectRefForAnyMedia (
$object,
$handle,
$anchor,
$id) {
$object,
PhabricatorObjectHandle $handle,
$anchor,
$id) {
$href = $this->getObjectHref($object, $handle, $id);
$text = $this->getObjectNamePrefix().$id;
@ -68,7 +69,12 @@ abstract class PhabricatorObjectRemarkupRule extends PhutilRemarkupRule {
}
protected function renderObjectRef($object, $handle, $anchor, $id) {
protected function renderObjectRef(
$object,
PhabricatorObjectHandle $handle,
$anchor,
$id) {
$href = $this->getObjectHref($object, $handle, $id);
$text = $this->getObjectNamePrefix().$id;
$status_closed = PhabricatorObjectHandleStatus::STATUS_CLOSED;
@ -86,7 +92,11 @@ abstract class PhabricatorObjectRemarkupRule extends PhutilRemarkupRule {
return $this->renderHovertag($text, $href, $attr);
}
protected function renderObjectEmbedForAnyMedia($object, $handle, $options) {
protected function renderObjectEmbedForAnyMedia(
$object,
PhabricatorObjectHandle $handle,
$options) {
$name = $handle->getFullName();
$href = $handle->getURI();
@ -100,7 +110,11 @@ abstract class PhabricatorObjectRemarkupRule extends PhutilRemarkupRule {
return $this->renderObjectEmbed($object, $handle, $options);
}
protected function renderObjectEmbed($object, $handle, $options) {
protected function renderObjectEmbed(
$object,
PhabricatorObjectHandle $handle,
$options) {
$name = $handle->getFullName();
$href = $handle->getURI();
$status_closed = PhabricatorObjectHandleStatus::STATUS_CLOSED;
@ -115,7 +129,7 @@ abstract class PhabricatorObjectRemarkupRule extends PhutilRemarkupRule {
protected function renderObjectTagForMail(
$text,
$href,
$handle) {
PhabricatorObjectHandle $handle) {
$status_closed = PhabricatorObjectHandleStatus::STATUS_CLOSED;
$strikethrough = $handle->getStatus() == $status_closed ?
@ -243,7 +257,7 @@ abstract class PhabricatorObjectRemarkupRule extends PhutilRemarkupRule {
return $results;
}
public function markupObjectEmbed($matches) {
public function markupObjectEmbed(array $matches) {
if (!$this->isFlatText($matches[0])) {
return $matches[0];
}
@ -256,7 +270,7 @@ abstract class PhabricatorObjectRemarkupRule extends PhutilRemarkupRule {
));
}
public function markupObjectReference($matches) {
public function markupObjectReference(array $matches) {
if (!$this->isFlatText($matches[0])) {
return $matches[0];
}