Diviner

Class ArcanistXHPASTLinter

Definedsrc/lint/linter/ArcanistXHPASTLinter.php:8
GroupLinters
ExtendsArcanistBaseXHPASTLinter

Uses XHPAST to apply lint rules to PHP.

Tasks

Methods

protected buildFutures(array $paths)

parametersarray$paths
returnwild
This method is not documented.

private mixed evaluateStaticBoolean($string)

parametersstring$stringThe "semantic string" of a single value.
returnmixedtrue 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()

returnwild
This method is not documented.

private getConcreteVariableString($var)

parameterswild$var
returnwild
This method is not documented.

public getLintNameMap()

returnwild
This method is not documented.

public getLintSeverityMap()

returnwild
This method is not documented.

public getLinterName()

returnwild
This method is not documented.

public getSuperGlobalNames()

returnwild
This method is not documented.

public getXHPASTTreeForPath($path)

parameterswild$path
returnwild
This method is not documented.

private lintArrayIndexWhitespace($root)

parameterswild$root
returnwild
This method is not documented.

private lintBraceFormatting($root)

parameterswild$root
returnwild
This method is not documented.

private lintClosingCallParen($root)

parameterswild$root
returnwild
This method is not documented.

private lintClosingDeclarationParen($root)

parameterswild$root
returnwild
This method is not documented.

protected lintCommentSpaces($root)

parameterswild$root
returnwild
This method is not documented.

private lintDuplicateKeysInArray($root)

parameterswild$root
returnwild

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)

parameterswild$root
returnwild
This method is not documented.

protected lintExitExpressions($root)

parameterswild$root
returnwild

Exit is parsed as an expression, but using it as such is almost always wrong. That is, this is valid:

strtoupper(33 * exit - 6);

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:

exit(-1);
exit -1;

The former exits with a failure code, the latter with a success code!

protected lintHashComments($root)

parameterswild$root
returnwild
This method is not documented.

private lintImplicitFallthrough($root)

parameterswild$root
returnwild
This method is not documented.

private lintKeywordCasing($root)

parameterswild$root
returnwild
This method is not documented.

protected lintNamingConventions($root)

parameterswild$root
returnwild
This method is not documented.

public lintPHP53Features($root)

parameterswild$root
returnwild
This method is not documented.

private lintPHP53Functions($root)

parameterswild$root
returnwild
This method is not documented.

public lintPHP54Features($root)

parameterswild$root
returnwild
This method is not documented.

protected lintPHPTagUse($root)

parameterswild$root
returnwild
This method is not documented.

protected lintParenthesesShouldHugExpressions($root)

parameterswild$root
returnwild
This method is not documented.

private lintPlusOperatorOnStrings($root)

parameterswild$root
returnwild
This method is not documented.

protected lintPregQuote($root)

parameterswild$root
returnwild

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)

parameterswild$root
returnwild

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)

parameterswild$root
returnwild
This method is not documented.

protected lintReusedIteratorReferences($root)

parameterswild$root
returnwild

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)

parameterswild$root
returnwild

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)

parameterswild$root
returnwild
This method is not documented.

protected lintSpaceAroundBinaryOperators($root)

parameterswild$root
returnwild
This method is not documented.

public lintStrposUsedForStart($root)

parameterswild$root
returnwild
This method is not documented.

public lintStrstrUsedForCheck($root)

parameterswild$root
returnwild
This method is not documented.

protected lintSurpriseConstructors($root)

parameterswild$root
returnwild
This method is not documented.

protected lintTODOComments($root)

parameterswild$root
returnwild
This method is not documented.

private lintTautologicalExpressions($root)

parameterswild$root
returnwild
This method is not documented.

protected lintUndeclaredVariables($root)

parameterswild$root
returnwild
This method is not documented.

protected lintUseOfThisInStaticMethods($root)

parameterswild$root
returnwild
This method is not documented.

protected lintVariableVariables($root)

parameterswild$root
returnwild
This method is not documented.

protected resolveFuture($path, Future $future)

parameterswild$path
Future$future
returnwild
This method is not documented.