Page MenuHomePhabricator

D16823.diff
No OneTemporary

D16823.diff

diff --git a/src/applications/people/storage/PhabricatorUser.php b/src/applications/people/storage/PhabricatorUser.php
--- a/src/applications/people/storage/PhabricatorUser.php
+++ b/src/applications/people/storage/PhabricatorUser.php
@@ -572,7 +572,7 @@
return $this;
}
- public function getSex() {
+ public function getGender() {
return $this->getUserSetting(PhabricatorPronounSetting::SETTINGKEY);
}
diff --git a/src/infrastructure/internationalization/management/PhabricatorInternationalizationManagementExtractWorkflow.php b/src/infrastructure/internationalization/management/PhabricatorInternationalizationManagementExtractWorkflow.php
--- a/src/infrastructure/internationalization/management/PhabricatorInternationalizationManagementExtractWorkflow.php
+++ b/src/infrastructure/internationalization/management/PhabricatorInternationalizationManagementExtractWorkflow.php
@@ -175,10 +175,49 @@
try {
$string_value = $string_node->evalStatic();
+ $args = $params->getChildren();
+ $args = array_slice($args, 1);
+
+ $types = array();
+ foreach ($args as $child) {
+ $type = null;
+
+ switch ($child->getTypeName()) {
+ case 'n_FUNCTION_CALL':
+ $call = $child->getChildByIndex(0);
+ if ($call->getTypeName() == 'n_SYMBOL_NAME') {
+ switch ($call->getConcreteString()) {
+ case 'phutil_count':
+ $type = 'number';
+ break;
+ case 'phutil_person':
+ $type = 'person';
+ break;
+ }
+ }
+ break;
+ case 'n_NEW':
+ $class = $child->getChildByIndex(0);
+ if ($class->getTypeName() == 'n_CLASS_NAME') {
+ switch ($class->getConcreteString()) {
+ case 'PhutilNumber':
+ $type = 'number';
+ break;
+ }
+ }
+ break;
+ default:
+ break;
+ }
+
+ $types[] = $type;
+ }
+
$results[$hash][] = array(
'string' => $string_value,
'file' => Filesystem::readablePath($full_path, $root_path),
'line' => $string_line,
+ 'types' => $types,
);
} catch (Exception $ex) {
$messages[] = pht(
@@ -207,10 +246,23 @@
$map = array();
foreach ($strings as $hash => $string_list) {
foreach ($string_list as $string_info) {
- $map[$string_info['string']]['uses'][] = array(
+ $string = $string_info['string'];
+
+ $map[$string]['uses'][] = array(
'file' => $string_info['file'],
'line' => $string_info['line'],
);
+
+ if (!isset($map[$string]['types'])) {
+ $map[$string]['types'] = $string_info['types'];
+ } else if ($map[$string]['types'] !== $string_info['types']) {
+ echo tsprintf(
+ "**<bg:yellow> %s </bg>** %s\n",
+ pht('WARNING'),
+ pht(
+ 'Inferred types for string "%s" vary across callsites.',
+ $string_info['string']));
+ }
}
}

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 9, 9:17 PM (1 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6707576
Default Alt Text
D16823.diff (3 KB)

Event Timeline