Class ArcanistXHPASTLinter
Uses XHPAST to apply lint rules to PHP.
Tasks
Methods
protected buildFutures(array $paths)
| parameters | array | $paths | |
| return | wild | | |
This method is not documented.
private mixed evaluateStaticBoolean($string)
| parameters | string | $string | The "semantic string" of a single value. |
| return | mixed | | true or false if the value could be evaluated statically; null if static evaluation was not possible. |
Statically evaluate a boolean value from an XHP tree.
TODO: Improve this and move it to XHPAST proper?
public getCacheVersion()
This method is not documented.
private getConcreteVariableString($var)
| parameters | wild | $var | |
| return | wild | | |
This method is not documented.
public getLintNameMap()
This method is not documented.
public getLintSeverityMap()
This method is not documented.
public getLinterName()
This method is not documented.
public getSuperGlobalNames()
This method is not documented.
public getXHPASTTreeForPath($path)
| parameters | wild | $path | |
| return | wild | | |
This method is not documented.
private lintArrayIndexWhitespace($root)
| parameters | wild | $root | |
| return | wild | | |
This method is not documented.
private lintBraceFormatting($root)
| parameters | wild | $root | |
| return | wild | | |
This method is not documented.
private lintClosingCallParen($root)
| parameters | wild | $root | |
| return | wild | | |
This method is not documented.
private lintClosingDeclarationParen($root)
| parameters | wild | $root | |
| return | wild | | |
This method is not documented.
protected lintCommentSpaces($root)
| parameters | wild | $root | |
| return | wild | | |
This method is not documented.
private lintDuplicateKeysInArray($root)
| parameters | wild | $root | |
| return | wild | | |
Finds duplicate keys in array initializers, as in
array(1 => 'anything', 1 => 'foo'). Since the first entry is ignored,
this is almost certainly an error.
protected lintDynamicDefines($root)
| parameters | wild | $root | |
| return | wild | | |
This method is not documented.
protected lintExitExpressions($root)
| parameters | wild | $root | |
| return | wild | | |
Exit is parsed as an expression, but using it as such is almost always
wrong. That is, this is valid:
When exit is used as an expression, it causes the program to terminate with
exit code 0. This is likely not what is intended; these statements have
different effects:
The former exits with a failure code, the latter with a success code!
protected lintHashComments($root)
| parameters | wild | $root | |
| return | wild | | |
This method is not documented.
private lintImplicitFallthrough($root)
| parameters | wild | $root | |
| return | wild | | |
This method is not documented.
private lintKeywordCasing($root)
| parameters | wild | $root | |
| return | wild | | |
This method is not documented.
protected lintNamingConventions($root)
| parameters | wild | $root | |
| return | wild | | |
This method is not documented.
public lintPHP53Features($root)
| parameters | wild | $root | |
| return | wild | | |
This method is not documented.
private lintPHP53Functions($root)
| parameters | wild | $root | |
| return | wild | | |
This method is not documented.
public lintPHP54Features($root)
| parameters | wild | $root | |
| return | wild | | |
This method is not documented.
protected lintPHPTagUse($root)
| parameters | wild | $root | |
| return | wild | | |
This method is not documented.
protected lintParenthesesShouldHugExpressions($root)
| parameters | wild | $root | |
| return | wild | | |
This method is not documented.
private lintPlusOperatorOnStrings($root)
| parameters | wild | $root | |
| return | wild | | |
This method is not documented.
protected lintPregQuote($root)
| parameters | wild | $root | |
| return | wild | | |
preg_quote() takes two arguments, but the second one is optional because
it is possible to use (), [] or {} as regular expression delimiters. If
you don't pass a second argument, you're probably going to get something
wrong.
private lintPrimaryDeclarationFilenameMatch($root)
| parameters | wild | $root | |
| return | wild | | |
Lint that if the file declares exactly one interface or class,
the name of the file matches the name of the class,
unless the classname is funky like an XHP element.
private lintRaggedClasstreeEdges($root)
| parameters | wild | $root | |
| return | wild | | |
This method is not documented.
protected lintReusedIteratorReferences($root)
| parameters | wild | $root | |
| return | wild | | |
Find cases where a foreach loop is being iterated using a variable
reference and the same variable is used outside of the loop without
calling unset() or reassigning the variable to another variable
reference.
COUNTEREXAMPLE
foreach ($ar as &$a) {
...
}
$a = 1; <-- Raises an error for using $a
private lintReusedIterators($root)
| parameters | wild | $root | |
| return | wild | | |
Find cases where loops get nested inside each other but use the same
iterator variable. For example:
COUNTEREXAMPLE
foreach ($list as $thing) {
foreach ($stuff as $thing) { <-- Raises an error for reuse of $thing
...
}
}
protected lintSpaceAfterControlStatementKeywords($root)
| parameters | wild | $root | |
| return | wild | | |
This method is not documented.
protected lintSpaceAroundBinaryOperators($root)
| parameters | wild | $root | |
| return | wild | | |
This method is not documented.
public lintStrposUsedForStart($root)
| parameters | wild | $root | |
| return | wild | | |
This method is not documented.
public lintStrstrUsedForCheck($root)
| parameters | wild | $root | |
| return | wild | | |
This method is not documented.
protected lintSurpriseConstructors($root)
| parameters | wild | $root | |
| return | wild | | |
This method is not documented.
protected lintTODOComments($root)
| parameters | wild | $root | |
| return | wild | | |
This method is not documented.
private lintTautologicalExpressions($root)
| parameters | wild | $root | |
| return | wild | | |
This method is not documented.
protected lintUndeclaredVariables($root)
| parameters | wild | $root | |
| return | wild | | |
This method is not documented.
protected lintUseOfThisInStaticMethods($root)
| parameters | wild | $root | |
| return | wild | | |
This method is not documented.
protected lintVariableVariables($root)
| parameters | wild | $root | |
| return | wild | | |
This method is not documented.
protected resolveFuture($path, Future $future)
| parameters | wild | $path | |
| Future | $future | |
| return | wild | | |
This method is not documented.