Changeset View
Changeset View
Standalone View
Standalone View
src/applications/project/typeahead/PhabricatorProjectDatasource.php
Show First 20 Lines • Show All 77 Lines • ▼ Show 20 Lines | public function loadResults() { | ||||
foreach ($projs as $proj) { | foreach ($projs as $proj) { | ||||
$phid = $proj->getPHID(); | $phid = $proj->getPHID(); | ||||
if (!isset($has_cols[$phid])) { | if (!isset($has_cols[$phid])) { | ||||
continue; | continue; | ||||
} | } | ||||
$slug = $proj->getPrimarySlug(); | $slug = $proj->getPrimarySlug(); | ||||
if (!strlen($slug)) { | if (!phutil_nonempty_string($slug)) { | ||||
valerio.bozzolan: ✅ I verified that the above line just contains a string (or maybe null for some weird cases). | |||||
foreach ($proj->getSlugs() as $slug_object) { | foreach ($proj->getSlugs() as $slug_object) { | ||||
$slug = $slug_object->getSlug(); | $slug = $slug_object->getSlug(); | ||||
if (strlen($slug)) { | if (strlen($slug)) { | ||||
break; | break; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
Show All 32 Lines | foreach ($projs as $proj) { | ||||
->setDisplayType($proj->getDisplayIconName()) | ->setDisplayType($proj->getDisplayIconName()) | ||||
->setURI($proj->getURI()) | ->setURI($proj->getURI()) | ||||
->setPHID($phid) | ->setPHID($phid) | ||||
->setIcon($proj->getDisplayIconIcon()) | ->setIcon($proj->getDisplayIconIcon()) | ||||
->setColor($proj->getColor()) | ->setColor($proj->getColor()) | ||||
->setPriorityType('proj') | ->setPriorityType('proj') | ||||
->setClosed($closed); | ->setClosed($closed); | ||||
if (strlen($slug)) { | if (phutil_nonempty_string($slug)) { | ||||
Done Inline Actions✅ Same as above valerio.bozzolan: ✅ Same as above | |||||
$proj_result->setAutocomplete('#'.$slug); | $proj_result->setAutocomplete('#'.$slug); | ||||
} | } | ||||
$proj_result->setImageURI($proj->getProfileImageURI()); | $proj_result->setImageURI($proj->getProfileImageURI()); | ||||
if ($is_browse) { | if ($is_browse) { | ||||
$proj_result->addAttribute($proj->getDisplayIconName()); | $proj_result->addAttribute($proj->getDisplayIconName()); | ||||
Show All 14 Lines |
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
✅ I verified that the above line just contains a string (or maybe null for some weird cases).
The function phutil_nonempty_string() will report alien types (like objects), and that is OK.