Changeset View
Changeset View
Standalone View
Standalone View
src/ref/user/ArcanistUserSymbolRef.php
Context not available. | |||||
protected function resolveSymbol($symbol) { | protected function resolveSymbol($symbol) { | ||||
$matches = null; | $matches = null; | ||||
$is_id = preg_match('/^([1-9]\d*)\z/', $symbol, $matches); | $is_id = @preg_match('/^([1-9]\d*)\z/', $symbol, $matches); | ||||
if ($is_id) { | if ($is_id) { | ||||
$this->type = self::TYPE_ID; | $this->type = self::TYPE_ID; | ||||
return (int)$matches[1]; | return (int)$matches[1]; | ||||
} | } | ||||
$is_phid = preg_match('/^PHID-USER-\S+\z/', $symbol, $matches); | $is_phid = @preg_match('/^PHID-USER-\S+\z/', $symbol, $matches); | ||||
if ($is_phid) { | if ($is_phid) { | ||||
$this->type = self::TYPE_PHID; | $this->type = self::TYPE_PHID; | ||||
return $matches[0]; | return $matches[0]; | ||||
} | } | ||||
$is_function = preg_match('/^\S+\(\s*\)\s*\z/', $symbol, $matches); | $is_function = @preg_match('/^\S+\(\s*\)\s*\z/', $symbol, $matches); | ||||
if ($is_function) { | if ($is_function) { | ||||
$this->type = self::TYPE_FUNCTION; | $this->type = self::TYPE_FUNCTION; | ||||
return $matches[0]; | return $matches[0]; | ||||
} | } | ||||
$is_username = preg_match('/^@?(\S+)\z/', $symbol, $matches); | $is_username = @preg_match('/^@?(\S+)\z/', $symbol, $matches); | ||||
if ($is_username) { | if ($is_username) { | ||||
$this->type = self::TYPE_USERNAME; | $this->type = self::TYPE_USERNAME; | ||||
return $matches[1]; | return $matches[1]; | ||||
Context not available. |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0