]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Add hgsprintf() and jsprintf() to dynamic string lint warning
authorepriestley <git@epriestley.com>
Fri, 22 Feb 2013 00:44:34 +0000 (16:44 -0800)
committerepriestley <git@epriestley.com>
Fri, 22 Feb 2013 00:44:34 +0000 (16:44 -0800)
Summary: Soon all functions will accept only static parameters! glorious!

Test Plan: Added a couple tests.

Reviewers: vrana

Reviewed By: vrana

CC: aran
Differential Revision: https://secure.phabricator.com/D4811

src/lint/linter/ArcanistPhutilXHPASTLinter.php
src/lint/linter/__tests__/phlxhp/xsprintf.lint-test [new file with mode: 0644]

index 56d766766c0c20d20feadbe4af4af9983d222b6f..4ae868e1b282850f200aa2d0193f6bdac963bf97 100644 (file)
@@ -102,6 +102,9 @@ final class ArcanistPhutilXHPASTLinter extends ArcanistBaseXHPASTLinter {
       'pht' => 0,
 
       'hsprintf' => 0,
+      'jsprintf' => 0,
+
+      'hgsprintf' => 0,
 
       'csprintf' => 0,
       'vcsprintf' => 0,
diff --git a/src/lint/linter/__tests__/phlxhp/xsprintf.lint-test b/src/lint/linter/__tests__/phlxhp/xsprintf.lint-test
new file mode 100644 (file)
index 0000000..e33a24e
--- /dev/null
@@ -0,0 +1,13 @@
+<?php
+
+csprintf('x');
+csprintf($x);
+
+qsprintf();
+qsprintf('x');
+qsprintf('x', 'y');
+qsprintf('x', $y);
+
+~~~~~~~~~~
+warning:4:1
+warning:9:1