mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-26 00:32:41 +01:00
Modify the lint-test
file format to allow for more powerful assertions
Summary: Fixes T6854. The current format for `lint-test` files is somewhat inflexible and does not allow us to make assertions regarding the code or name of the linter messages (of class `ArcanistLintMessage`) that are raised. Specifically, the `${severity}:${line}:${char}` format is hardcoded in `ArcanistLinterTestCase`. In this diff, I extend the this format to achieve the following goals: - Allow for the lint message code and name to be specified. Specifically, the full format is `${severity}:${line}:${char}:${code}:${name}`. - Make all fields optional. `error:3:` will match any and all errors occuring on line 3. - Provide more useful output when assertions fail. Specifically, output //all// lint messages that are missing and/or surplus. Previously, only the first lint message was output. Test Plan: `arc unit` Reviewers: #blessed_reviewers, epriestley, chad Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T6854 Differential Revision: https://secure.phabricator.com/D11176
This commit is contained in:
parent
82445bb605
commit
dd514e268b
167 changed files with 580 additions and 512 deletions
|
@ -75,8 +75,8 @@ abstract class ArcanistLinterTestCase extends PhutilTestCase {
|
||||||
$config,
|
$config,
|
||||||
array(
|
array(
|
||||||
'config' => 'optional map<string, wild>',
|
'config' => 'optional map<string, wild>',
|
||||||
'path' => 'optional string',
|
|
||||||
'mode' => 'optional string',
|
'mode' => 'optional string',
|
||||||
|
'path' => 'optional string',
|
||||||
'stopped' => 'optional bool',
|
'stopped' => 'optional bool',
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -171,81 +171,131 @@ abstract class ArcanistLinterTestCase extends PhutilTestCase {
|
||||||
$this->compareTransform($xform, $after_lint);
|
$this->compareTransform($xform, $after_lint);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function compareLint($file, $expect, ArcanistLintResult $result) {
|
private function compareLint($file, $expect, ArcanistLintResult $results) {
|
||||||
$seen = array();
|
$expected_results = new ArcanistLintResult();
|
||||||
$raised = array();
|
|
||||||
$message_map = array();
|
|
||||||
|
|
||||||
foreach ($result->getMessages() as $message) {
|
|
||||||
$sev = $message->getSeverity();
|
|
||||||
$line = $message->getLine();
|
|
||||||
$char = $message->getChar();
|
|
||||||
$code = $message->getCode();
|
|
||||||
$name = $message->getName();
|
|
||||||
$message_key = $sev.':'.$line.':'.$char;
|
|
||||||
$message_map[$message_key] = $message;
|
|
||||||
$seen[] = $message_key;
|
|
||||||
$raised[] = sprintf(
|
|
||||||
' %s: %s %s',
|
|
||||||
pht('%s at line %d, char %d', $sev, $line, $char),
|
|
||||||
$code,
|
|
||||||
$name);
|
|
||||||
}
|
|
||||||
$expect = trim($expect);
|
$expect = trim($expect);
|
||||||
if ($expect) {
|
if ($expect) {
|
||||||
$expect = explode("\n", $expect);
|
$expect = explode("\n", $expect);
|
||||||
} else {
|
} else {
|
||||||
$expect = array();
|
$expect = array();
|
||||||
}
|
}
|
||||||
foreach ($expect as $key => $expected) {
|
|
||||||
$expect[$key] = head(explode(' ', $expected));
|
foreach ($expect as $result) {
|
||||||
|
$parts = explode(':', $result);
|
||||||
|
|
||||||
|
$message = new ArcanistLintMessage();
|
||||||
|
|
||||||
|
$severity = idx($parts, 0);
|
||||||
|
$line = idx($parts, 1);
|
||||||
|
$char = idx($parts, 2);
|
||||||
|
$code = idx($parts, 3);
|
||||||
|
|
||||||
|
if ($severity !== null) {
|
||||||
|
$message->setSeverity($severity);
|
||||||
}
|
}
|
||||||
|
|
||||||
$expect = array_fill_keys($expect, true);
|
if ($line !== null) {
|
||||||
$seen = array_fill_keys($seen, true);
|
$message->setLine($line);
|
||||||
|
|
||||||
if (!$raised) {
|
|
||||||
$raised = array(pht('No messages.'));
|
|
||||||
}
|
}
|
||||||
$raised = sprintf(
|
|
||||||
"%s:\n%s",
|
|
||||||
pht('Actually raised'),
|
|
||||||
implode("\n", $raised));
|
|
||||||
|
|
||||||
foreach (array_diff_key($expect, $seen) as $missing => $ignored) {
|
if ($char !== null) {
|
||||||
$missing = explode(':', $missing);
|
$message->setChar($char);
|
||||||
$sev = array_shift($missing);
|
}
|
||||||
$pos = $missing;
|
|
||||||
|
|
||||||
$this->assertFailure(
|
if ($code !== null) {
|
||||||
|
$message->setCode($code);
|
||||||
|
}
|
||||||
|
|
||||||
|
$expected_results->addMessage($message);
|
||||||
|
}
|
||||||
|
|
||||||
|
$missing = array();
|
||||||
|
$surprising = $results->getMessages();
|
||||||
|
|
||||||
|
// TODO: Make this more efficient.
|
||||||
|
foreach ($expected_results->getMessages() as $expected_message) {
|
||||||
|
$found = false;
|
||||||
|
|
||||||
|
foreach ($results->getMessages() as $ii => $actual_message) {
|
||||||
|
if (!self::compareLintMessageProperty(
|
||||||
|
$expected_message->getSeverity(),
|
||||||
|
$actual_message->getSeverity())) {
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!self::compareLintMessageProperty(
|
||||||
|
$expected_message->getLine(),
|
||||||
|
$actual_message->getLine())) {
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!self::compareLintMessageProperty(
|
||||||
|
$expected_message->getChar(),
|
||||||
|
$actual_message->getChar())) {
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!self::compareLintMessageProperty(
|
||||||
|
$expected_message->getCode(),
|
||||||
|
$actual_message->getCode())) {
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$found = true;
|
||||||
|
unset($surprising[$ii]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$found) {
|
||||||
|
$missing[] = $expected_message;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($missing || $surprising) {
|
||||||
|
$expected = pht('EXPECTED MESSAGES');
|
||||||
|
if ($missing) {
|
||||||
|
foreach ($missing as $message) {
|
||||||
|
$expected .= sprintf(
|
||||||
|
"\n %s: %s %s",
|
||||||
pht(
|
pht(
|
||||||
"In '%s', expected lint to raise %s on line %d at char %d, ".
|
'%s at line %d, char %d',
|
||||||
"but no %s was raised. %s",
|
$message->getSeverity(),
|
||||||
$file,
|
$message->getLine(),
|
||||||
$sev,
|
$message->getChar()),
|
||||||
idx($pos, 0),
|
$message->getCode(),
|
||||||
idx($pos, 1),
|
$message->getName());
|
||||||
$sev,
|
}
|
||||||
$raised));
|
} else {
|
||||||
|
$expected .= "\n ".pht('No messages');
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (array_diff_key($seen, $expect) as $surprising => $ignored) {
|
$actual = pht('UNEXPECTED MESSAGES');
|
||||||
$message = $message_map[$surprising];
|
if ($surprising) {
|
||||||
$message_info = $message->getDescription();
|
foreach ($surprising as $message) {
|
||||||
|
$actual .= sprintf(
|
||||||
|
"\n %s: %s %s",
|
||||||
|
pht(
|
||||||
|
'%s at line %d, char %d',
|
||||||
|
$message->getSeverity(),
|
||||||
|
$message->getLine(),
|
||||||
|
$message->getChar()),
|
||||||
|
$message->getCode(),
|
||||||
|
$message->getName());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$actual .= "\n ".pht('No messages');
|
||||||
|
}
|
||||||
|
|
||||||
list($sev, $line, $char) = explode(':', $surprising);
|
|
||||||
$this->assertFailure(
|
$this->assertFailure(
|
||||||
sprintf(
|
sprintf(
|
||||||
"%s:\n\n%s\n\n%s",
|
"%s\n\n%s\n\n%s",
|
||||||
pht(
|
pht("Lint failed for '%s'.", $file),
|
||||||
"In '%s', lint raised %s on line %d at char %d, ".
|
$expected,
|
||||||
"but nothing was expected",
|
$actual));
|
||||||
$file,
|
|
||||||
$sev,
|
|
||||||
$line,
|
|
||||||
$char),
|
|
||||||
$message_info,
|
|
||||||
$raised));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,4 +309,18 @@ abstract class ArcanistLinterTestCase extends PhutilTestCase {
|
||||||
pht('File as patched by lint did not match the expected patched file.'));
|
pht('File as patched by lint did not match the expected patched file.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compare properties of @{class:ArcanistLintMessage} instances.
|
||||||
|
*
|
||||||
|
* The expectation is that if one (or both) of the properties is null, then
|
||||||
|
* we don't care about its value.
|
||||||
|
*
|
||||||
|
* @param wild
|
||||||
|
* @param wild
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
private static function compareLintMessageProperty($x, $y) {
|
||||||
|
return $x === null || $y === null || $x === $y;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
warning::
|
warning:0:0:CHMOD1:Invalid Executable
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
{"mode": "0755"}
|
{"mode": "0755"}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
x = 1234
|
x = 1234
|
||||||
y = 1
|
y = 1
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
error:1:
|
error:1:0
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
error::
|
error:0:0:NAME1:Bad Filename
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
{"path": "bad@filename"}
|
{"path": "bad@filename"}
|
||||||
|
|
|
@ -3,5 +3,5 @@ x = 'y'
|
||||||
def hello():
|
def hello():
|
||||||
return foo
|
return foo
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
error:3:1
|
error:3:1:E302
|
||||||
error:4:12
|
error:4:12:F821
|
||||||
|
|
|
@ -2,5 +2,5 @@ var args = {};
|
||||||
args['foo'] = 'bar';
|
args['foo'] = 'bar';
|
||||||
args['bar'] = 'baz';
|
args['bar'] = 'baz';
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
warning:2:5
|
warning:2:5:W069
|
||||||
warning:3:5
|
warning:3:5:W069
|
||||||
|
|
|
@ -3,4 +3,4 @@ if (foo = 'bar') {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
warning:2:16
|
warning:2:16:W084
|
||||||
|
|
|
@ -7,6 +7,6 @@ function f() {
|
||||||
{
|
{
|
||||||
|
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
warning:3:8
|
warning:3:8:W033
|
||||||
error:7:1
|
error:7:1:E019
|
||||||
error:9:1
|
error:9:1:E041
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
console.log('foobar')
|
console.log('foobar')
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
warning:1:22
|
warning:1:22:W033
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* jshint maxerr: 1 */
|
/* jshint maxerr: 1 */
|
||||||
console.log('foobar')
|
console.log('foobar')
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
disabled:2:22
|
disabled:2:22:E043
|
||||||
warning:2:22
|
warning:2:22:W033
|
||||||
|
|
|
@ -2,4 +2,4 @@ function main() {
|
||||||
return 'Hello, World!';
|
return 'Hello, World!';
|
||||||
};
|
};
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
warning:3:2
|
warning:3:2:W032
|
||||||
|
|
|
@ -7,4 +7,4 @@
|
||||||
>>>>>>> branch2
|
>>>>>>> branch2
|
||||||
}
|
}
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
error:5:1
|
error:5:1:MERGECONFLICT1:Unresolved merge conflict
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
import os, sys
|
import os, sys
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
error:1:10
|
error:1:10:E401
|
||||||
|
|
|
@ -4,4 +4,4 @@ function f() {
|
||||||
$this = "cannot be re-assigned";
|
$this = "cannot be re-assigned";
|
||||||
}
|
}
|
||||||
~~~~~~~~~
|
~~~~~~~~~
|
||||||
error:4:
|
error:4:0:PHP2:Fatal Error
|
||||||
|
|
|
@ -4,4 +4,4 @@ function f() {
|
||||||
this is bad syntax;
|
this is bad syntax;
|
||||||
}
|
}
|
||||||
~~~~~~~~~
|
~~~~~~~~~
|
||||||
error:4:
|
error:4:0:PHP1:Parse Error
|
||||||
|
|
|
@ -2,6 +2,6 @@ import sys, os
|
||||||
|
|
||||||
x += 1
|
x += 1
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
warning:1:
|
warning:1:0
|
||||||
warning:1:
|
warning:1:0
|
||||||
error:3:
|
error:3:0
|
||||||
|
|
|
@ -3,4 +3,4 @@
|
||||||
"""
|
"""
|
||||||
Useless string """
|
Useless string """
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
warning:4:0 See T9257.
|
warning:4:0:W0105:Pointless String Statement
|
||||||
|
|
|
@ -2,6 +2,8 @@ import sys, os
|
||||||
|
|
||||||
x += 1
|
x += 1
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
warning:1:0
|
advice:1:0:C0111:Missing Docstring
|
||||||
advice:1:0
|
advice:1:0:C0410:Multiple Imports
|
||||||
error:3:0
|
warning:1:0:W0611:Unused Import
|
||||||
|
warning:1:0:W0611:Unused Import
|
||||||
|
error:3:0:E0602:Undefined Variable
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
def hello()
|
def hello()
|
||||||
end
|
end
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
warning:1:10
|
warning:1:10:-
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
def hello()
|
def hello()
|
||||||
puts "hello world"
|
puts "hello world"
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
error:2:
|
error:2:0:RUBY:Syntax Error
|
||||||
|
|
|
@ -10,11 +10,11 @@ didn't remove acording
|
||||||
Added ZZZZsupermnZZZZ
|
Added ZZZZsupermnZZZZ
|
||||||
Added full batmn batmnZZZZ
|
Added full batmn batmnZZZZ
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
warning:2:1
|
warning:2:1:SPELL1:Possible Spelling Mistake
|
||||||
warning:4:10
|
warning:4:10:SPELL2:Possible Spelling Mistake
|
||||||
warning:5:15
|
warning:5:15:SPELL2:Possible Spelling Mistake
|
||||||
warning:7:7
|
warning:7:7:SPELL2:Possible Spelling Mistake
|
||||||
warning:7:12
|
warning:7:12:SPELL2:Possible Spelling Mistake
|
||||||
warning:9:15
|
warning:9:15:SPELL1:Possible Spelling Mistake
|
||||||
warning:10:11
|
warning:10:11:SPELL2:Possible Spelling Mistake
|
||||||
warning:11:12
|
warning:11:12:SPELL1:Possible Spelling Mistake
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
❤♎☀★☂♞
|
❤♎☀★☂♞
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
error:1:1
|
error:1:1:TXT5:Bad Charset
|
||||||
|
|
|
@ -4,6 +4,6 @@
|
||||||
|
|
||||||
The quick brown fox jumps over the lazy dog.
|
The quick brown fox jumps over the lazy dog.
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
autofix:1:1
|
autofix:1:1:TXT8:Leading Whitespace at BOF
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
The quick brown fox jumps over the lazy dog.
|
The quick brown fox jumps over the lazy dog.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
The quick brown fox
|
The quick brown fox
|
||||||
jumps over the lazy dog.
|
jumps over the lazy dog.
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
error:1:1
|
error:1:1:TXT1:DOS Newlines
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
The quick brown fox
|
The quick brown fox
|
||||||
jumps over the lazy dog.
|
jumps over the lazy dog.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
|
|
||||||
|
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
error::
|
error:0:0:TXT10:Empty File
|
||||||
|
|
|
@ -4,6 +4,6 @@ The quick brown fox jumps over the lazy dog.
|
||||||
|
|
||||||
|
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
autofix:2:1
|
autofix:2:1:TXT9:Trailing Whitespace at EOF
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
The quick brown fox jumps over the lazy dog.
|
The quick brown fox jumps over the lazy dog.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
The quick brown fox jumps over the lazy dog.
|
The quick brown fox jumps over the lazy dog.
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
warning:1:1
|
warning:1:1:TXT3:Line Too Long
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
{"config": {"text.max-line-length": 40}}
|
{"config": {"text.max-line-length": 40}}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
The quick brown fox
|
The quick brown fox
|
||||||
jumps over the lazy dog.
|
jumps over the lazy dog.
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
autofix:1:20
|
autofix:1:20:TXT6:Trailing Whitespace
|
||||||
autofix:2:25
|
autofix:2:25:TXT6:Trailing Whitespace
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
The quick brown fox
|
The quick brown fox
|
||||||
jumps over the lazy dog.
|
jumps over the lazy dog.
|
||||||
|
|
|
@ -3,11 +3,11 @@ consectetur adipiscing elit.
|
||||||
Phasellus sodales nibh erat,
|
Phasellus sodales nibh erat,
|
||||||
in hendrerit nulla dictum interdum.
|
in hendrerit nulla dictum interdum.
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
error:1:28
|
error:1:28:TXT2:Tab Literal
|
||||||
autofix:1:28
|
autofix:1:28:TXT6:Trailing Whitespace
|
||||||
autofix:2:29
|
autofix:2:29:TXT6:Trailing Whitespace
|
||||||
autofix:3:29
|
autofix:3:29:TXT6:Trailing Whitespace
|
||||||
autofix:4:36
|
autofix:4:36:TXT6:Trailing Whitespace
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
Lorem ipsum dolor sit amet,
|
Lorem ipsum dolor sit amet,
|
||||||
consectetur adipiscing elit.
|
consectetur adipiscing elit.
|
||||||
|
|
|
@ -3,11 +3,11 @@ consectetur adipiscing elit.
|
||||||
Phasellus sodales nibh erat,
|
Phasellus sodales nibh erat,
|
||||||
in hendrerit nulla dictum interdum.
|
in hendrerit nulla dictum interdum.
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
error:1:28
|
error:1:28:TXT2:Tab Literal
|
||||||
autofix:1:28
|
autofix:1:28:TXT6:Trailing Whitespace
|
||||||
autofix:2:29
|
autofix:2:29:TXT6:Trailing Whitespace
|
||||||
autofix:3:29
|
autofix:3:29:TXT6:Trailing Whitespace
|
||||||
autofix:4:36
|
autofix:4:36:TXT6:Trailing Whitespace
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
Lorem ipsum dolor sit amet,
|
Lorem ipsum dolor sit amet,
|
||||||
consectetur adipiscing elit.
|
consectetur adipiscing elit.
|
||||||
|
|
|
@ -2,4 +2,4 @@
|
||||||
|
|
||||||
This shouldn't fatal the parser.
|
This shouldn't fatal the parser.
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
disabled:2:1
|
disabled:2:1:XHP78:Inline HTML
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
warning::
|
warning:0:0:XHP82:Empty File
|
||||||
|
|
|
@ -3,5 +3,5 @@
|
||||||
abstract class A {}
|
abstract class A {}
|
||||||
final class F {}
|
final class F {}
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
disabled:3:1
|
disabled:3:1:XHP88:Class Not Extending `Phobject`
|
||||||
disabled:4:1
|
disabled:4:1:XHP88:Class Not Extending `Phobject`
|
||||||
|
|
|
@ -6,8 +6,12 @@ function f( ) {
|
||||||
g( );
|
g( );
|
||||||
}
|
}
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
warning:5:12
|
warning:5:12:XHP38:Declaration Formatting
|
||||||
warning:6:5
|
warning:5:12:XHP25:Spaces Inside Parentheses
|
||||||
|
warning:5:12:XHP25:Spaces Inside Parentheses
|
||||||
|
warning:6:5:XHP37:Call Formatting
|
||||||
|
warning:6:5:XHP25:Spaces Inside Parentheses
|
||||||
|
warning:6:5:XHP25:Spaces Inside Parentheses
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
char *buf = null;
|
char *buf = null;
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
error:2:1
|
error:2:1:XHP1:PHP Syntax Error!
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
error:2:1
|
error:2:1:XML4:LibXML Error
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
<bla>�</bla>
|
<bla>�</bla>
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
error:1:63
|
error:1:63:XML9:LibXML Error
|
||||||
|
|
|
@ -3,4 +3,4 @@
|
||||||
<>
|
<>
|
||||||
</languages>
|
</languages>
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
error:3:6
|
error:3:6:XML68:LibXML Error
|
||||||
|
|
|
@ -3,5 +3,5 @@
|
||||||
</lang>
|
</lang>
|
||||||
</languages>
|
</languages>
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
error:3:16
|
error:3:16:XML76:LibXML Error
|
||||||
error:4:1
|
error:4:1:XML5:LibXML Error
|
||||||
|
|
|
@ -2,4 +2,4 @@
|
||||||
|
|
||||||
function __lambda_func() {}
|
function __lambda_func() {}
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
error:3:1
|
error:3:1:XHP68:`__lambda_func` Function
|
||||||
|
|
|
@ -24,4 +24,4 @@ abstract class SomeAbstractClass {
|
||||||
abstract public function __toString();
|
abstract public function __toString();
|
||||||
}
|
}
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
error:6:7
|
error:6:7:XHP67:Throwing Exception in `__toString` Method
|
||||||
|
|
|
@ -3,4 +3,4 @@ abstract class SomeClass {
|
||||||
abstract public function someMethod() {}
|
abstract public function someMethod() {}
|
||||||
}
|
}
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
error:3:41
|
error:3:41:XHP108:`abstract` Method Cannot Contain Body
|
||||||
|
|
|
@ -3,4 +3,4 @@ abstract class SomeClass {
|
||||||
private abstract function someMethod();
|
private abstract function someMethod();
|
||||||
}
|
}
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
error:3:3
|
error:3:3:XHP107:`abstract` Method Cannot Be Declared `private`
|
||||||
|
|
|
@ -5,9 +5,9 @@ sizeof($x);
|
||||||
die();
|
die();
|
||||||
sizeOf($x);
|
sizeOf($x);
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
advice:4:1
|
advice:4:1:XHP65:Alias Functions
|
||||||
advice:5:1
|
advice:5:1:XHP65:Alias Functions
|
||||||
advice:6:1
|
advice:6:1:XHP65:Alias Functions
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
|
@ -3,4 +3,4 @@
|
||||||
array_combine($x, $x);
|
array_combine($x, $x);
|
||||||
array_combine($x, $y);
|
array_combine($x, $y);
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
disabled:3:1
|
disabled:3:1:XHP84:`array_combine()` Unreliable
|
||||||
|
|
|
@ -5,8 +5,8 @@ $a[] = 1;
|
||||||
$a[]=1;
|
$a[]=1;
|
||||||
$a [] = 1;
|
$a [] = 1;
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
warning:3:3
|
warning:3:3:XHP28:Spacing Before Array Index
|
||||||
warning:6:3
|
warning:6:3:XHP28:Spacing Before Array Index
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
|
@ -34,12 +34,12 @@ array(
|
||||||
2,
|
2,
|
||||||
3, /* comment */ );
|
3, /* comment */ );
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
advice:4:14
|
advice:4:14:XHP48:Array Separator
|
||||||
advice:13:3
|
advice:13:3:XHP48:Array Separator
|
||||||
advice:17:3
|
advice:17:3:XHP48:Array Separator
|
||||||
advice:27:3
|
advice:27:3:XHP48:Array Separator
|
||||||
advice:31:3
|
advice:31:3:XHP48:Array Separator
|
||||||
advice:35:20
|
advice:35:20:XHP48:Array Separator
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
|
@ -20,12 +20,12 @@ array(
|
||||||
array('quack',
|
array('quack',
|
||||||
);
|
);
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
warning:4:5
|
warning:4:5:XHP76:Array Element
|
||||||
warning:4:8
|
warning:4:8:XHP76:Array Element
|
||||||
warning:8:18
|
warning:8:18:XHP76:Array Element
|
||||||
warning:12:17
|
warning:12:17:XHP76:Array Element
|
||||||
warning:12:32
|
warning:12:32:XHP76:Array Element
|
||||||
warning:20:7
|
warning:20:7:XHP76:Array Element
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
|
@ -16,10 +16,10 @@ array(
|
||||||
$x=>$y,
|
$x=>$y,
|
||||||
);
|
);
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
warning:4:9
|
warning:4:9:XHP27:Space Around Binary Operator
|
||||||
warning:5:10
|
warning:5:10:XHP27:Space Around Binary Operator
|
||||||
warning:6:9
|
warning:6:9:XHP27:Space Around Binary Operator
|
||||||
warning:16:5
|
warning:16:5:XHP27:Space Around Binary Operator
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
|
@ -24,19 +24,19 @@ if ($x instanceof z &&$w) {}
|
||||||
if ($x instanceof z && $w) {}
|
if ($x instanceof z && $w) {}
|
||||||
f(1,2);
|
f(1,2);
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
warning:4:3
|
warning:4:3:XHP27:Space Around Binary Operator
|
||||||
warning:5:4
|
warning:5:4:XHP27:Space Around Binary Operator
|
||||||
warning:6:3
|
warning:6:3:XHP27:Space Around Binary Operator
|
||||||
warning:8:3
|
warning:8:3:XHP27:Space Around Binary Operator
|
||||||
warning:9:3
|
warning:9:3:XHP27:Space Around Binary Operator
|
||||||
warning:10:4
|
warning:10:4:XHP27:Space Around Binary Operator
|
||||||
warning:11:3
|
warning:11:3:XHP27:Space Around Binary Operator
|
||||||
warning:12:3
|
warning:12:3:XHP27:Space Around Binary Operator
|
||||||
warning:14:14
|
warning:14:14:XHP27:Space Around Binary Operator
|
||||||
warning:21:52
|
warning:21:52:XHP27:Space Around Binary Operator
|
||||||
warning:22:54
|
warning:22:54:XHP27:Space Around Binary Operator
|
||||||
warning:23:21
|
warning:23:21:XHP27:Space Around Binary Operator
|
||||||
warning:25:4
|
warning:25:4:XHP27:Space Around Binary Operator
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
|
@ -2,4 +2,4 @@
|
||||||
0b1;
|
0b1;
|
||||||
0B1;
|
0B1;
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
warning:3:1
|
warning:3:1:XHP131:Binary Integer Casing
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
eval('evil code');
|
eval('evil code');
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
error:3:1
|
error:3:1:XHP51:Use of Blacklisted Function
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,8 +4,8 @@ class SomeClass {}
|
||||||
class SomeOtherClass{}
|
class SomeOtherClass{}
|
||||||
class YetAnotherClass extends SomeClass{}
|
class YetAnotherClass extends SomeClass{}
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
warning:4:21
|
warning:4:21:XHP24:Brace Placement
|
||||||
warning:5:40
|
warning:5:40:XHP24:Brace Placement
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
|
@ -22,17 +22,17 @@ else {}
|
||||||
|
|
||||||
if ($x) {}else{}
|
if ($x) {}else{}
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
warning:3:7
|
warning:3:7:XHP24:Brace Placement
|
||||||
warning:6:20
|
warning:6:20:XHP24:Brace Placement
|
||||||
warning:9:10
|
warning:9:10:XHP24:Brace Placement
|
||||||
warning:12:11
|
warning:12:11:XHP24:Brace Placement
|
||||||
warning:15:9
|
warning:15:9:XHP24:Brace Placement
|
||||||
warning:16:6
|
warning:16:6:XHP24:Brace Placement
|
||||||
warning:17:4
|
warning:17:4:XHP24:Brace Placement
|
||||||
warning:19:11
|
warning:19:11:XHP24:Brace Placement
|
||||||
warning:20:16
|
warning:20:16:XHP24:Brace Placement
|
||||||
warning:23:11
|
warning:23:11:XHP24:Brace Placement
|
||||||
warning:23:15
|
warning:23:15:XHP24:Brace Placement
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,8 @@ function g()
|
||||||
|
|
||||||
function h(){}
|
function h(){}
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
warning:7:13
|
warning:7:13:XHP24:Brace Placement
|
||||||
warning:12:13
|
warning:12:13:XHP24:Brace Placement
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,8 @@ try
|
||||||
catch (Exception $x)
|
catch (Exception $x)
|
||||||
{}
|
{}
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
warning:3:4
|
warning:3:4:XHP24:Brace Placement
|
||||||
warning:5:21
|
warning:5:21:XHP24:Brace Placement
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
|
@ -4,9 +4,9 @@ array ( 1, 2, 3 );
|
||||||
list ( $x, $y ) = array();
|
list ( $x, $y ) = array();
|
||||||
[ 1, 2 , 3 ];
|
[ 1, 2 , 3 ];
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
warning:3:6
|
warning:3:6:XHP37:Call Formatting
|
||||||
warning:4:5
|
warning:4:5:XHP37:Call Formatting
|
||||||
warning:4:14
|
warning:4:14:XHP37:Call Formatting
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
|
@ -18,9 +18,9 @@ EODOC
|
||||||
);
|
);
|
||||||
f (1);
|
f (1);
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
warning:4:4
|
warning:4:4:XHP37:Call Formatting
|
||||||
warning:9:4
|
warning:9:4:XHP37:Call Formatting
|
||||||
warning:19:2
|
warning:19:2:XHP37:Call Formatting
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
|
@ -25,9 +25,9 @@ $foo(&$myvar);
|
||||||
array_walk(array(), function () use (&$x) {});
|
array_walk(array(), function () use (&$x) {});
|
||||||
MyClass::myfunc(array(&$x, &$y));
|
MyClass::myfunc(array(&$x, &$y));
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
error:10:8
|
error:10:8:XHP53:Call-Time Pass-By-Reference
|
||||||
error:13:15
|
error:13:15:XHP53:Call-Time Pass-By-Reference
|
||||||
error:16:17
|
error:16:17:XHP53:Call-Time Pass-By-Reference
|
||||||
error:19:24
|
error:19:24:XHP53:Call-Time Pass-By-Reference
|
||||||
error:19:39
|
error:19:39:XHP53:Call-Time Pass-By-Reference
|
||||||
error:23:6
|
error:23:6:XHP53:Call-Time Pass-By-Reference
|
||||||
|
|
|
@ -4,8 +4,8 @@ echo (double)0;
|
||||||
echo (int) 1;
|
echo (int) 1;
|
||||||
echo (string) 2;
|
echo (string) 2;
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
advice:4:11
|
advice:4:11:XHP66:Cast Spacing
|
||||||
advice:5:14
|
advice:5:14:XHP66:Cast Spacing
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
|
@ -4,4 +4,4 @@ abstract class A extends Phobject {}
|
||||||
final class B extends A {}
|
final class B extends A {}
|
||||||
final class C {}
|
final class C {}
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
disabled:5:1
|
disabled:5:1:XHP88:Class Not Extending `Phobject`
|
||||||
|
|
|
@ -3,4 +3,4 @@ class SomeClass {
|
||||||
abstract public function someMethod();
|
abstract public function someMethod();
|
||||||
}
|
}
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
error:2:1
|
error:2:1:XHP113:`class` Containing `abstract` Methods Must Be Declared `abstract`
|
||||||
|
|
|
@ -18,8 +18,8 @@ $c = new class {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
advice:5:12
|
advice:5:12:XHP62:Class Name Literal
|
||||||
advice:9:10
|
advice:9:10:XHP62:Class Name Literal
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
|
@ -21,11 +21,11 @@
|
||||||
/** yes */
|
/** yes */
|
||||||
/**** yes ****/
|
/**** yes ****/
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
error:3:1
|
error:3:1:XHP18:Comment Style
|
||||||
error:4:1
|
error:4:1:XHP18:Comment Style
|
||||||
error:6:1
|
error:6:1:XHP18:Comment Style
|
||||||
error:7:11
|
error:7:11:XHP18:Comment Style
|
||||||
error:16:1
|
error:16:1:XHP18:Comment Style
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
|
@ -9,10 +9,10 @@ $b;
|
||||||
$a. // This should be okay.
|
$a. // This should be okay.
|
||||||
$b;
|
$b;
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
warning:4:3
|
warning:4:3:XHP44:Concatenation Spacing
|
||||||
warning:4:5
|
warning:4:5:XHP44:Concatenation Spacing
|
||||||
warning:5:4
|
warning:5:4:XHP44:Concatenation Spacing
|
||||||
warning:6:3
|
warning:6:3:XHP44:Concatenation Spacing
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,8 @@ new Bar();
|
||||||
new Foo\Bar;
|
new Foo\Bar;
|
||||||
new class {};
|
new class {};
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
advice:3:5
|
advice:3:5:XHP49:Constructor Parentheses
|
||||||
advice:5:5
|
advice:5:5:XHP49:Constructor Parentheses
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
|
@ -18,4 +18,3 @@ do {
|
||||||
continue;
|
continue;
|
||||||
} while ($x);
|
} while ($x);
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
~~~~~~~~~~
|
|
||||||
|
|
|
@ -21,4 +21,3 @@ switch ($x) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
~~~~~~~~~~
|
|
||||||
|
|
|
@ -10,8 +10,8 @@ switch ($x) {
|
||||||
continue /* CRITICAL: Nuclear launch code is 1234. */ ;
|
continue /* CRITICAL: Nuclear launch code is 1234. */ ;
|
||||||
}
|
}
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
error:5:5
|
error:5:5:XHP128:Continue Inside Switch
|
||||||
error:10:5
|
error:10:5:XHP128:Continue Inside Switch
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
|
@ -26,18 +26,18 @@ do {
|
||||||
|
|
||||||
try {} catch(Exception $ex) {}
|
try {} catch(Exception $ex) {}
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
warning:3:1
|
warning:3:1:XHP26:Space After Control Statement
|
||||||
warning:4:1
|
warning:4:1:XHP26:Space After Control Statement
|
||||||
warning:5:1
|
warning:5:1:XHP26:Space After Control Statement
|
||||||
warning:6:1
|
warning:6:1:XHP26:Space After Control Statement
|
||||||
warning:7:1
|
warning:7:1:XHP26:Space After Control Statement
|
||||||
warning:8:1
|
warning:8:1:XHP26:Space After Control Statement
|
||||||
warning:8:6
|
warning:8:6:XHP26:Space After Control Statement
|
||||||
warning:9:1
|
warning:9:1:XHP26:Space After Control Statement
|
||||||
warning:14:3
|
warning:14:3:XHP26:Space After Control Statement
|
||||||
warning:15:3
|
warning:15:3:XHP26:Space After Control Statement
|
||||||
warning:25:3
|
warning:25:3:XHP26:Space After Control Statement
|
||||||
warning:27:8
|
warning:27:8:XHP26:Space After Control Statement
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
$x['key'];
|
$x['key'];
|
||||||
$y{'key'};
|
$y{'key'};
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
warning:3:1
|
warning:3:1:XHP119:Curly Brace Array Index
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
<?php
|
<?php
|
||||||
$x['key'];
|
$x['key'];
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
$x[$y{'key'}];
|
$x[$y{'key'}];
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
warning:2:4
|
warning:2:4:XHP119:Curly Brace Array Index
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
<?php
|
<?php
|
||||||
$x[$y['key']];
|
$x[$y['key']];
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
$x { 'key' /* comment */ };
|
$x { 'key' /* comment */ };
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
warning:2:1
|
warning:2:1:XHP119:Curly Brace Array Index
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
<?php
|
<?php
|
||||||
$x [ 'key' /* comment */ ];
|
$x [ 'key' /* comment */ ];
|
||||||
|
|
|
@ -25,16 +25,16 @@ f(function ($x ) {});
|
||||||
f(function ($x ) use ($z) {});
|
f(function ($x ) use ($z) {});
|
||||||
f(function ($x)use($z) {});
|
f(function ($x)use($z) {});
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
warning:4:14
|
warning:4:14:XHP38:Declaration Formatting
|
||||||
warning:5:11
|
warning:5:11:XHP38:Declaration Formatting
|
||||||
warning:8:15
|
warning:8:15:XHP38:Declaration Formatting
|
||||||
warning:13:23
|
warning:13:23:XHP38:Declaration Formatting
|
||||||
warning:16:31
|
warning:16:31:XHP38:Declaration Formatting
|
||||||
warning:19:33
|
warning:19:33:XHP38:Declaration Formatting
|
||||||
warning:24:15
|
warning:24:15:XHP38:Declaration Formatting
|
||||||
warning:25:15
|
warning:25:15:XHP38:Declaration Formatting
|
||||||
warning:26:16
|
warning:26:16:XHP38:Declaration Formatting
|
||||||
warning:26:19
|
warning:26:19:XHP38:Declaration Formatting
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
|
@ -8,5 +8,5 @@ class MyClass {
|
||||||
public function myMethod($x, $y = null, $z) {}
|
public function myMethod($x, $y = null, $z) {}
|
||||||
}
|
}
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
warning:4:13
|
warning:4:13:XHP60:Default Parameters
|
||||||
warning:8:27
|
warning:8:27:XHP60:Default Parameters
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
deprecated_function();
|
deprecated_function();
|
||||||
modern_function();
|
modern_function();
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
warning:3:1
|
warning:3:1:XHP85:Use of Deprecated Function
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,7 +13,7 @@ pht(
|
||||||
"This string also requires \123\345 double quotes, but ".
|
"This string also requires \123\345 double quotes, but ".
|
||||||
"this string does not. Here, they are used for consistency.");
|
"this string does not. Here, they are used for consistency.");
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
advice:4:1
|
advice:4:1:XHP41:Unnecessary Double Quotes
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
|
@ -35,9 +35,9 @@ $f = array(
|
||||||
$a => 'var2',
|
$a => 'var2',
|
||||||
);
|
);
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
error:6:3
|
error:6:3:XHP22:Duplicate Keys in Array
|
||||||
error:9:3
|
error:9:3:XHP22:Duplicate Keys in Array
|
||||||
error:16:3
|
error:16:3:XHP22:Duplicate Keys in Array
|
||||||
error:21:3
|
error:21:3:XHP22:Duplicate Keys in Array
|
||||||
error:26:3
|
error:26:3:XHP22:Duplicate Keys in Array
|
||||||
error:35:3
|
error:35:3:XHP22:Duplicate Keys in Array
|
||||||
|
|
|
@ -25,5 +25,5 @@ switch ($x) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
error:16:3
|
error:16:3:XHP50:Duplicate Case Statements
|
||||||
error:23:7
|
error:23:7:XHP50:Duplicate Case Statements
|
||||||
|
|
|
@ -5,5 +5,5 @@ define($pony, 'cute');
|
||||||
define('PONY', $cute);
|
define('PONY', $cute);
|
||||||
define($pony, $cute);
|
define($pony, $cute);
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
error:4:8 dynamic define
|
error:4:8:XHP12:Dynamic `define`
|
||||||
error:6:8 dynamic define
|
error:6:8:XHP12:Dynamic `define`
|
||||||
|
|
|
@ -8,7 +8,7 @@ if (true) {
|
||||||
echo 'baz';
|
echo 'baz';
|
||||||
}
|
}
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
advice:5:3
|
advice:5:3:XHP42:`elseif` Usage
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,8 @@ function z() {
|
||||||
|
|
||||||
}
|
}
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
advice:7:14
|
advice:7:14:XHP47:Empty Block Statement
|
||||||
advice:8:14
|
advice:8:14:XHP47:Empty Block Statement
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
|
@ -4,5 +4,5 @@ exit(-1);
|
||||||
exit -1;
|
exit -1;
|
||||||
strtoupper(33 * exit - 6);
|
strtoupper(33 * exit - 6);
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
error:4:1
|
error:4:1:XHP17:`exit` Used as Expression
|
||||||
error:5:17
|
error:5:17:XHP17:`exit` Used as Expression
|
||||||
|
|
|
@ -2,4 +2,4 @@
|
||||||
|
|
||||||
extract();
|
extract();
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
error:3:1
|
error:3:1:XHP4:Use of `extract`
|
||||||
|
|
|
@ -12,11 +12,11 @@ queryfx(null, 'x', 'y');
|
||||||
|
|
||||||
foobar(null, null, '%s');
|
foobar(null, null, '%s');
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
error:3:1
|
error:3:1:XHP54:Formatted String
|
||||||
error:7:1
|
error:7:1:XHP54:Formatted String
|
||||||
error:8:1
|
error:8:1:XHP54:Formatted String
|
||||||
error:11:1
|
error:11:1:XHP54:Formatted String
|
||||||
error:13:1
|
error:13:1:XHP54:Formatted String
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,8 +3,8 @@ intval($x);
|
||||||
intval($x, 8);
|
intval($x, 8);
|
||||||
intval($x, 10);
|
intval($x, 10);
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
advice:2:1
|
advice:2:1:XHP105:Function Call Should Be Type Cast
|
||||||
advice:4:1
|
advice:4:1:XHP105:Function Call Should Be Type Cast
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
<?php
|
<?php
|
||||||
(int)$x;
|
(int)$x;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
intval($x / 2) + 1;
|
intval($x / 2) + 1;
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
advice:2:1
|
advice:2:1:XHP105:Function Call Should Be Type Cast
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
<?php
|
<?php
|
||||||
(int)($x / 2) + 1;
|
(int)($x / 2) + 1;
|
||||||
|
|
|
@ -5,11 +5,11 @@ floatval($x);
|
||||||
intval($x);
|
intval($x);
|
||||||
strval($x);
|
strval($x);
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
advice:2:1
|
advice:2:1:XHP105:Function Call Should Be Type Cast
|
||||||
advice:3:1
|
advice:3:1:XHP105:Function Call Should Be Type Cast
|
||||||
advice:4:1
|
advice:4:1:XHP105:Function Call Should Be Type Cast
|
||||||
advice:5:1
|
advice:5:1:XHP105:Function Call Should Be Type Cast
|
||||||
advice:6:1
|
advice:6:1:XHP105:Function Call Should Be Type Cast
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
<?php
|
<?php
|
||||||
(bool)$x;
|
(bool)$x;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
// we don't provide an autofix.
|
// we don't provide an autofix.
|
||||||
strval($x, $y);
|
strval($x, $y);
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
advice:4:1
|
advice:4:1:XHP105:Function Call Should Be Type Cast
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
<?php
|
<?php
|
||||||
// If the function call doesn't have exactly one parameter,
|
// If the function call doesn't have exactly one parameter,
|
||||||
|
|
|
@ -5,5 +5,5 @@ function foo() {
|
||||||
global $x, $y;
|
global $x, $y;
|
||||||
}
|
}
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
warning:3:1
|
warning:3:1:XHP79:Global Variables
|
||||||
warning:5:3
|
warning:5:3:XHP79:Global Variables
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
0xff;
|
0xff;
|
||||||
0XFF;
|
0XFF;
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
warning:3:1
|
warning:3:1:XHP127:Hexadecimal Integer Casing
|
||||||
warning:4:1
|
warning:4:1:XHP127:Hexadecimal Integer Casing
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
<?php
|
<?php
|
||||||
0xFF;
|
0xFF;
|
||||||
|
|
|
@ -6,4 +6,4 @@ final class Platypus {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
error:4:19
|
error:4:19:XHP10:Implicit Constructor
|
||||||
|
|
|
@ -84,13 +84,13 @@ switch ($x) {
|
||||||
throw_exception();
|
throw_exception();
|
||||||
}
|
}
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
warning:41:3
|
warning:41:3:XHP30:Implicit Fallthrough
|
||||||
warning:48:3
|
warning:48:3:XHP30:Implicit Fallthrough
|
||||||
warning:53:3
|
warning:53:3:XHP30:Implicit Fallthrough
|
||||||
warning:57:3
|
warning:57:3:XHP30:Implicit Fallthrough
|
||||||
warning:66:3
|
warning:66:3:XHP30:Implicit Fallthrough
|
||||||
warning:71:3
|
warning:71:3:XHP30:Implicit Fallthrough
|
||||||
warning:75:3
|
warning:75:3:XHP30:Implicit Fallthrough
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
{
|
{
|
||||||
|
|
|
@ -11,10 +11,10 @@ final class Foo {
|
||||||
private $z;
|
private $z;
|
||||||
}
|
}
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
advice:5:3
|
advice:5:3:XHP52:Implicit Method Visibility
|
||||||
advice:6:3
|
advice:6:3:XHP52:Implicit Method Visibility
|
||||||
advice:9:3
|
advice:9:3:XHP52:Implicit Method Visibility
|
||||||
advice:10:3
|
advice:10:3:XHP52:Implicit Method Visibility
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env php
|
#!/usr/bin/env php
|
||||||
<html>
|
<html>
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
disabled:2:1
|
disabled:2:1:XHP78:Inline HTML
|
||||||
|
|
|
@ -11,4 +11,4 @@ function my_func($foo) {
|
||||||
function () {};
|
function () {};
|
||||||
}
|
}
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
warning:5:5
|
warning:5:5:XHP59:Inner Functions
|
||||||
|
|
|
@ -5,6 +5,6 @@ var_dump(123 instanceof stdClass);
|
||||||
var_dump(null instanceof stdClass);
|
var_dump(null instanceof stdClass);
|
||||||
var_dump($x instanceof stdClass);
|
var_dump($x instanceof stdClass);
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
error:3:10
|
error:3:10:XHP69:`instanceof` Operator
|
||||||
error:4:10
|
error:4:10:XHP69:`instanceof` Operator
|
||||||
error:5:10
|
error:5:10:XHP69:`instanceof` Operator
|
||||||
|
|
|
@ -4,4 +4,4 @@ interface SomeInterface {
|
||||||
abstract public function someMethod();
|
abstract public function someMethod();
|
||||||
}
|
}
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
error:4:3
|
error:4:3:XHP118:`interface` Methods Cannot Be Marked `abstract`
|
||||||
|
|
|
@ -4,4 +4,4 @@ interface SomeInterface {
|
||||||
public function someMethod() {}
|
public function someMethod() {}
|
||||||
}
|
}
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
error:4:32
|
error:4:32:XHP114:`interface` Method Cannot Contain Body
|
||||||
|
|
|
@ -13,6 +13,6 @@ function func_eight(stdClass $x) {}
|
||||||
function func_nine(stdClass $x = null) {}
|
function func_nine(stdClass $x = null) {}
|
||||||
function func_ten(stdClass $x = array()) {}
|
function func_ten(stdClass $x = array()) {}
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
error:6:31
|
error:6:31:XHP70:Invalid Default Parameter
|
||||||
error:10:35
|
error:10:35:XHP70:Invalid Default Parameter
|
||||||
error:14:33
|
error:14:33:XHP70:Invalid Default Parameter
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue