]> khamidou — GitHub mirrors - arcanist.git/commit
Warn before using `strpos($a, $b) === 0`
authorvrana <jakubv@fb.com>
Wed, 15 Aug 2012 19:56:36 +0000 (12:56 -0700)
committervrana <jakubv@fb.com>
Wed, 15 Aug 2012 20:20:25 +0000 (13:20 -0700)
commit34efe49e1252d64103b222a61332b24ad22cac67
treea5aa8d435bed0d6ac9a459f9466dd45e4cce879f
parent390bb280e13418dd02c8b9cfa64565a6d5cbc8a4
Warn before using `strpos($a, $b) === 0`

Summary:
I'm not sure if we are interested in this kind of linters ("Don't use slow function if there is a fast alternative").
I didn't find a case where `strpos() === 0` could be useful except [[ http://www.php.net/manual/en/mbstring.overload.php | mbstring.func_overload ]] craziness.

Test Plan:
New unit test.
Linted Arcanist, libphutil, Phabricator repositories, found no false positive and one real positive.

Reviewers: btrahan, epriestley

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D3296
src/lint/linter/ArcanistXHPASTLinter.php
src/lint/linter/__tests__/xhpast/slowness.lint-test [new file with mode: 0644]