Page MenuHomePhabricator

D13572.id32798.diff
No OneTemporary

D13572.id32798.diff

diff --git a/src/symbols/PhutilClassMapQuery.php b/src/symbols/PhutilClassMapQuery.php
--- a/src/symbols/PhutilClassMapQuery.php
+++ b/src/symbols/PhutilClassMapQuery.php
@@ -41,6 +41,7 @@
private $ancestorClass;
private $expandMethod;
+ private $filterNull;
private $uniqueMethod;
private $sortMethod;
@@ -79,8 +80,9 @@
* @return this
* @task config
*/
- public function setUniqueMethod($unique_method) {
+ public function setUniqueMethod($unique_method, $filter_null = false) {
$this->uniqueMethod = $unique_method;
+ $this->filterNull = $filter_null;
return $this;
}
@@ -224,6 +226,11 @@
$map = array();
foreach ($list as $object) {
$key = call_user_func(array($object, $unique));
+
+ if ($key === null && $this->filterNull) {
+ continue;
+ }
+
if (empty($map[$key])) {
$map[$key] = $object;
continue;

File Metadata

Mime Type
text/plain
Expires
Thu, Mar 20, 8:47 PM (1 d, 1 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7712799
Default Alt Text
D13572.id32798.diff (934 B)

Event Timeline