Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14065727
D9127.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
13 KB
Referenced Files
None
Subscribers
None
D9127.diff
View Options
diff --git a/src/applications/audit/conduit/ConduitAPI_audit_query_Method.php b/src/applications/audit/conduit/ConduitAPI_audit_query_Method.php
--- a/src/applications/audit/conduit/ConduitAPI_audit_query_Method.php
+++ b/src/applications/audit/conduit/ConduitAPI_audit_query_Method.php
@@ -10,11 +10,16 @@
}
public function defineParamTypes() {
+ $statuses = array(
+ 'status-any',
+ 'status-open',
+ );
+ $status_const = $this->formatStringConstants($statuses);
+
return array(
'auditorPHIDs' => 'optional list<phid>',
'commitPHIDs' => 'optional list<phid>',
- 'status' => 'optional enum<"status-any", "status-open"> '.
- '(default = "status-any")',
+ 'status' => 'optional '.$status_const.' (default = "status-any")',
'offset' => 'optional int',
'limit' => 'optional int (default = 100)',
);
diff --git a/src/applications/conduit/method/ConduitAPIMethod.php b/src/applications/conduit/method/ConduitAPIMethod.php
--- a/src/applications/conduit/method/ConduitAPIMethod.php
+++ b/src/applications/conduit/method/ConduitAPIMethod.php
@@ -165,6 +165,14 @@
}
}
+ protected function formatStringConstants($constants) {
+ foreach ($constants as $key => $value) {
+ $constants[$key] = '"'.$value.'"';
+ }
+ $constants = implode(', ', $constants);
+ return 'string-constant<'.$constants.'>';
+ }
+
/* -( Paging Results )----------------------------------------------------- */
@@ -261,4 +269,5 @@
return null;
}
+
}
diff --git a/src/applications/differential/conduit/ConduitAPI_differential_creatediff_Method.php b/src/applications/differential/conduit/ConduitAPI_differential_creatediff_Method.php
--- a/src/applications/differential/conduit/ConduitAPI_differential_creatediff_Method.php
+++ b/src/applications/differential/conduit/ConduitAPI_differential_creatediff_Method.php
@@ -8,21 +8,37 @@
}
public function defineParamTypes() {
+
+ $vcs_const = $this->formatStringConstants(
+ array(
+ 'svn',
+ 'git',
+ 'hg',
+ ));
+
+ $status_const = $this->formatStringConstants(
+ array(
+ 'none',
+ 'skip',
+ 'okay',
+ 'warn',
+ 'fail',
+ 'postponed',
+ ));
+
return array(
'changes' => 'required list<dict>',
'sourceMachine' => 'required string',
'sourcePath' => 'required string',
'branch' => 'required string',
'bookmark' => 'optional string',
- 'sourceControlSystem' => 'required enum<svn, git, hg>',
+ 'sourceControlSystem' => 'required '.$vcs_const,
'sourceControlPath' => 'required string',
'sourceControlBaseRevision' => 'required string',
'creationMethod' => 'optional string',
'arcanistProject' => 'optional string',
- 'lintStatus' =>
- 'required enum<none, skip, okay, warn, fail, postponed>',
- 'unitStatus' =>
- 'required enum<none, skip, okay, warn, fail, postponed>',
+ 'lintStatus' => 'required '.$status_const,
+ 'unitStatus' => 'required '.$status_const,
'repositoryPHID' => 'optional phid',
'parentRevisionID' => 'deprecated',
diff --git a/src/applications/differential/conduit/ConduitAPI_differential_find_Method.php b/src/applications/differential/conduit/ConduitAPI_differential_find_Method.php
--- a/src/applications/differential/conduit/ConduitAPI_differential_find_Method.php
+++ b/src/applications/differential/conduit/ConduitAPI_differential_find_Method.php
@@ -23,10 +23,8 @@
'phids',
);
- $types = implode(', ', $types);
-
return array(
- 'query' => 'required enum<'.$types.'>',
+ 'query' => 'required '.$this->formatStringConstants($types),
'guids' => 'required nonempty list<guids>',
);
}
diff --git a/src/applications/differential/conduit/ConduitAPI_differential_getcommitmessage_Method.php b/src/applications/differential/conduit/ConduitAPI_differential_getcommitmessage_Method.php
--- a/src/applications/differential/conduit/ConduitAPI_differential_getcommitmessage_Method.php
+++ b/src/applications/differential/conduit/ConduitAPI_differential_getcommitmessage_Method.php
@@ -8,10 +8,12 @@
}
public function defineParamTypes() {
+ $edit_types = array('edit', 'create');
+
return array(
'revision_id' => 'optional revision_id',
'fields' => 'optional dict<string, wild>',
- 'edit' => 'optional enum<"edit", "create">',
+ 'edit' => 'optional '.$this->formatStringConstants($edit_types),
);
}
diff --git a/src/applications/differential/conduit/ConduitAPI_differential_query_Method.php b/src/applications/differential/conduit/ConduitAPI_differential_query_Method.php
--- a/src/applications/differential/conduit/ConduitAPI_differential_query_Method.php
+++ b/src/applications/differential/conduit/ConduitAPI_differential_query_Method.php
@@ -9,7 +9,7 @@
public function defineParamTypes() {
$hash_types = ArcanistDifferentialRevisionHash::getTypes();
- $hash_types = implode(', ', $hash_types);
+ $hash_const = $this->formatStringConstants($hash_types);
$status_types = array(
DifferentialRevisionQuery::STATUS_ANY,
@@ -17,23 +17,22 @@
DifferentialRevisionQuery::STATUS_ACCEPTED,
DifferentialRevisionQuery::STATUS_CLOSED,
);
- $status_types = implode(', ', $status_types);
+ $status_const = $this->formatStringConstants($status_types);
$order_types = array(
DifferentialRevisionQuery::ORDER_MODIFIED,
DifferentialRevisionQuery::ORDER_CREATED,
);
- $order_types = implode(', ', $order_types);
+ $order_const = $this->formatStringConstants($order_types);
return array(
'authors' => 'optional list<phid>',
'ccs' => 'optional list<phid>',
'reviewers' => 'optional list<phid>',
'paths' => 'optional list<pair<callsign, path>>',
- 'commitHashes' => 'optional list<pair<enum<'.
- $hash_types.'>, string>>',
- 'status' => 'optional enum<'.$status_types.'>',
- 'order' => 'optional enum<'.$order_types.'>',
+ 'commitHashes' => 'optional list<pair<'.$hash_const.', string>>',
+ 'status' => 'optional '.$status_const,
+ 'order' => 'optional '.$order_const,
'limit' => 'optional uint',
'offset' => 'optional uint',
'ids' => 'optional list<uint>',
diff --git a/src/applications/harbormaster/conduit/ConduitAPI_harbormaster_sendmessage_Method.php b/src/applications/harbormaster/conduit/ConduitAPI_harbormaster_sendmessage_Method.php
--- a/src/applications/harbormaster/conduit/ConduitAPI_harbormaster_sendmessage_Method.php
+++ b/src/applications/harbormaster/conduit/ConduitAPI_harbormaster_sendmessage_Method.php
@@ -10,9 +10,11 @@
}
public function defineParamTypes() {
+ $type_const = $this->formatStringConstants(array('pass', 'fail'));
+
return array(
- 'buildTargetPHID' => 'phid',
- 'type' => 'enum<pass, fail>',
+ 'buildTargetPHID' => 'required phid',
+ 'type' => 'required '.$type_const,
);
}
diff --git a/src/applications/maniphest/conduit/ConduitAPI_maniphest_query_Method.php b/src/applications/maniphest/conduit/ConduitAPI_maniphest_query_Method.php
--- a/src/applications/maniphest/conduit/ConduitAPI_maniphest_query_Method.php
+++ b/src/applications/maniphest/conduit/ConduitAPI_maniphest_query_Method.php
@@ -27,14 +27,14 @@
ManiphestTaskQuery::STATUS_SPITE,
ManiphestTaskQuery::STATUS_DUPLICATE,
);
- $statuses = implode(', ', $statuses);
+ $status_const = $this->formatStringConstants($statuses);
$orders = array(
ManiphestTaskQuery::ORDER_PRIORITY,
ManiphestTaskQuery::ORDER_CREATED,
ManiphestTaskQuery::ORDER_MODIFIED,
);
- $orders = implode(', ', $orders);
+ $order_const = $this->formatStringConstants($orders);
return array(
'ids' => 'optional list<uint>',
@@ -45,8 +45,8 @@
'ccPHIDs' => 'optional list<phid>',
'fullText' => 'optional string',
- 'status' => 'optional enum<'.$statuses.'>',
- 'order' => 'optional enum<'.$orders.'>',
+ 'status' => 'optional '.$status_const,
+ 'order' => 'optional '.$order_const,
'limit' => 'optional int',
'offset' => 'optional int',
diff --git a/src/applications/people/conduit/ConduitAPI_user_addstatus_Method.php b/src/applications/people/conduit/ConduitAPI_user_addstatus_Method.php
--- a/src/applications/people/conduit/ConduitAPI_user_addstatus_Method.php
+++ b/src/applications/people/conduit/ConduitAPI_user_addstatus_Method.php
@@ -18,10 +18,12 @@
}
public function defineParamTypes() {
+ $status_const = $this->formatStringConstants(array('away', 'sporadic'));
+
return array(
'fromEpoch' => 'required int',
'toEpoch' => 'required int',
- 'status' => 'required enum<away, sporadic>',
+ 'status' => 'required '.$status_const,
'description' => 'optional string',
);
}
diff --git a/src/applications/project/conduit/ConduitAPI_project_query_Method.php b/src/applications/project/conduit/ConduitAPI_project_query_Method.php
--- a/src/applications/project/conduit/ConduitAPI_project_query_Method.php
+++ b/src/applications/project/conduit/ConduitAPI_project_query_Method.php
@@ -19,10 +19,12 @@
PhabricatorProjectQuery::STATUS_ARCHIVED,
);
+ $status_const = $this->formatStringConstants($statuses);
+
return array(
'ids' => 'optional list<int>',
'phids' => 'optional list<phid>',
- 'status' => 'optional enum<'.implode(', ', $statuses).'>',
+ 'status' => 'optional '.$status_const,
'members' => 'optional list<phid>',
diff --git a/src/applications/releeph/conduit/work/ConduitAPI_releephwork_getcommitmessage_Method.php b/src/applications/releeph/conduit/work/ConduitAPI_releephwork_getcommitmessage_Method.php
--- a/src/applications/releeph/conduit/work/ConduitAPI_releephwork_getcommitmessage_Method.php
+++ b/src/applications/releeph/conduit/work/ConduitAPI_releephwork_getcommitmessage_Method.php
@@ -14,9 +14,11 @@
}
public function defineParamTypes() {
+ $action_const = $this->formatStringConstants(array('pick', 'revert'));
+
return array(
'requestPHID' => 'required string',
- 'action' => 'required enum<"pick", "revert">',
+ 'action' => 'required '.$action_const,
);
}
diff --git a/src/applications/releeph/conduit/work/ConduitAPI_releephwork_record_Method.php b/src/applications/releeph/conduit/work/ConduitAPI_releephwork_record_Method.php
--- a/src/applications/releeph/conduit/work/ConduitAPI_releephwork_record_Method.php
+++ b/src/applications/releeph/conduit/work/ConduitAPI_releephwork_record_Method.php
@@ -26,9 +26,15 @@
}
public function defineParamTypes() {
+ $action_const = $this->formatStringConstants(
+ array(
+ 'pick',
+ 'revert',
+ ));
+
return array(
'requestPHID' => 'required string',
- 'action' => 'required enum<"pick", "revert">',
+ 'action' => 'required '.$action_const,
'commitIdentifier' => 'required string',
);
}
diff --git a/src/applications/releeph/conduit/work/ConduitAPI_releephwork_recordpickstatus_Method.php b/src/applications/releeph/conduit/work/ConduitAPI_releephwork_recordpickstatus_Method.php
--- a/src/applications/releeph/conduit/work/ConduitAPI_releephwork_recordpickstatus_Method.php
+++ b/src/applications/releeph/conduit/work/ConduitAPI_releephwork_recordpickstatus_Method.php
@@ -12,9 +12,15 @@
}
public function defineParamTypes() {
+ $action_const = $this->formatStringConstants(
+ array(
+ 'pick',
+ 'revert',
+ ));
+
return array(
'requestPHID' => 'required string',
- 'action' => 'required enum<"pick", "revert">',
+ 'action' => 'required '.$action_const,
'ok' => 'required bool',
'dryRun' => 'optional bool',
'details' => 'optional dict<string, wild>',
diff --git a/src/applications/remarkup/conduit/ConduitAPI_remarkup_process_Method.php b/src/applications/remarkup/conduit/ConduitAPI_remarkup_process_Method.php
--- a/src/applications/remarkup/conduit/ConduitAPI_remarkup_process_Method.php
+++ b/src/applications/remarkup/conduit/ConduitAPI_remarkup_process_Method.php
@@ -23,10 +23,10 @@
public function defineParamTypes() {
$available_contexts = array_keys($this->getEngineContexts());
- $available_contexts = implode(', ', $available_contexts);
+ $available_const = $this->formatStringConstants($available_contexts);
return array(
- 'context' => 'required enum<'.$available_contexts.'>',
+ 'context' => 'required '.$available_const,
'contents' => 'required list<string>',
);
}
diff --git a/src/applications/repository/conduit/ConduitAPI_repository_create_Method.php b/src/applications/repository/conduit/ConduitAPI_repository_create_Method.php
--- a/src/applications/repository/conduit/ConduitAPI_repository_create_Method.php
+++ b/src/applications/repository/conduit/ConduitAPI_repository_create_Method.php
@@ -19,9 +19,11 @@
}
public function defineParamTypes() {
+ $vcs_const = $this->formatStringConstants(array('git', 'hg', 'svn'));
+
return array(
'name' => 'required string',
- 'vcs' => 'required enum<git, hg, svn>',
+ 'vcs' => 'required '.$vcs_const,
'callsign' => 'required string',
'description' => 'optional string',
'encoding' => 'optional string',
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 20, 6:04 AM (7 h, 36 m ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6714020
Default Alt Text
D9127.diff (13 KB)
Attached To
Mode
D9127: When a conduit method requires a string constant, call it "string-const" not "enum"
Attached
Detach File
Event Timeline
Log In to Comment