Permalink
Browse files

Document extra parameters retrieved by func_get_args()

Test Plan: /libphutil/docs/function/execx.html

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Koolvin

Differential Revision: https://secure.phabricator.com/D2348
  • Loading branch information...
1 parent 6105e65 commit 488167ce1cda280243aff55a6cda82daf75b1d2b vrana committed Apr 30, 2012
Showing with 23 additions and 8 deletions.
  1. +13 −1 src/engine/base/DivinerEngine.php
  2. +10 −7 src/engine/xhp/DivinerXHPEngine.php
@@ -1,7 +1,7 @@
<?php
/*
- * Copyright 2011 Facebook, Inc.
+ * Copyright 2012 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -43,4 +43,16 @@
return idx($this->engineConfig, $key, $default);
}
+ protected function parseParamDoc($doc) {
+ $dict = array();
+ $split = preg_split('/\s+/', trim($doc), $limit = 2);
+ if (!empty($split[0])) {
+ $dict['doctype'] = $split[0];
+ }
+ if (!empty($split[1])) {
+ $dict['docs'] = $split[1];
+ }
+ return $dict;
+ }
+
}
@@ -184,17 +184,20 @@ private function parseParams(DivinerAtom $atom, AASTNodeList $params) {
if ($docs) {
$doc = array_shift($docs);
if ($doc) {
- $split = preg_split('/\s+/', trim($doc), $limit = 2);
- if (!empty($split[0])) {
- $dict['doctype'] = $split[0];
- }
- if (!empty($split[1])) {
- $dict['docs'] = $split[1];
- }
+ $dict += $this->parseParamDoc($doc);
}
}
$atom->addParameter($name->getConcreteString(), $dict);
}
+
+ // Add extra parameters retrieved by func_get_args().
+ if ($docs) {
+ foreach ($docs as $doc) {
+ if ($doc) {
+ $atom->addParameter('', $this->parseParamDoc($doc));
+ }
+ }
+ }
}
private function parseReturnType(DivinerAtom $atom, XHPASTNode $decl) {

0 comments on commit 488167c

Please sign in to comment.