Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15331538
D21024.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D21024.id.diff
View Options
diff --git a/src/filesystem/Filesystem.php b/src/filesystem/Filesystem.php
--- a/src/filesystem/Filesystem.php
+++ b/src/filesystem/Filesystem.php
@@ -1119,7 +1119,7 @@
}
public static function concatenatePaths(array $components) {
- $components = implode($components, DIRECTORY_SEPARATOR);
+ $components = implode(DIRECTORY_SEPARATOR, $components);
// Replace any extra sequences of directory separators with a single
// separator, so we don't end up with "path//to///thing.c".
diff --git a/src/lint/linter/xhpast/rules/ArcanistImplodeArgumentOrderXHPASTLinterRule.php b/src/lint/linter/xhpast/rules/ArcanistImplodeArgumentOrderXHPASTLinterRule.php
--- a/src/lint/linter/xhpast/rules/ArcanistImplodeArgumentOrderXHPASTLinterRule.php
+++ b/src/lint/linter/xhpast/rules/ArcanistImplodeArgumentOrderXHPASTLinterRule.php
@@ -23,7 +23,17 @@
}
$parameter = $parameters->getChildByIndex(1);
- if (!$parameter->isStaticScalar()) {
+
+ // If the value is a static scalar, like a string literal, it's probably
+ // the glue.
+ $is_scalar = $parameter->isStaticScalar();
+
+ // If the value is a constant, like "DIRECTORY_SEPARATOR", it's probably
+ // the glue.
+ $is_constant = ($parameter->getTypeName() === 'n_SYMBOL_NAME');
+
+ $looks_like_glue = ($is_scalar || $is_constant);
+ if (!$looks_like_glue) {
continue;
}
diff --git a/src/lint/linter/xhpast/rules/__tests__/implode-argument-order/implode.lint-test b/src/lint/linter/xhpast/rules/__tests__/implode-argument-order/implode.lint-test
--- a/src/lint/linter/xhpast/rules/__tests__/implode-argument-order/implode.lint-test
+++ b/src/lint/linter/xhpast/rules/__tests__/implode-argument-order/implode.lint-test
@@ -14,5 +14,10 @@
implode($x);
implode($x, $y, $z);
+// This should raise a warning by guessing that "DIRECTORY_SEPARATOR" is
+// glue.
+implode($path_list, DIRECTORY_SEPARATOR);
+
~~~~~~~~~~
error:7:1:XHP129:Implode With Glue First
+error:19:1:XHP129:Implode With Glue First
diff --git a/src/workflow/ArcanistCloseWorkflow.php b/src/workflow/ArcanistCloseWorkflow.php
--- a/src/workflow/ArcanistCloseWorkflow.php
+++ b/src/workflow/ArcanistCloseWorkflow.php
@@ -90,7 +90,7 @@
"%s\n",
pht(
"Valid status options are:\n\t%s",
- implode($this->getStatusOptions(), ', ')));
+ implode(', ', $this->getStatusOptions())));
return 0;
}
$ids = $this->getArgument('task_id');
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Mar 8, 11:14 AM (4 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7382007
Default Alt Text
D21024.id.diff (2 KB)
Attached To
Mode
D21024: Fix two "implode()" order issues arising from wilds/experimental collapse
Attached
Detach File
Event Timeline
Log In to Comment