-
Notifications
You must be signed in to change notification settings - Fork 581
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c8ddbaa
commit b4f9235
Showing
3 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from coalib.bearlib.abstractions.Linter import linter | ||
|
||
|
||
@linter(executable='phan', | ||
output_format='regex', | ||
output_regex=r'(?P<filename>.+):(?P<line>\d+)\s(?P<message>.+)') | ||
class PhanBear: | ||
""" | ||
Phan is a static analyzer for PHP that looks for common issues and will | ||
verify type compatibility on various operations when type information is | ||
available or can be deduced. | ||
See <https://github.com/etsy/phan> for more information. | ||
""" | ||
LANGUAGES = {'PHP'} | ||
AUTHORS = {'The coala developers'} | ||
AUTHORS_EMAILS = {'[email protected]'} | ||
LICENSE = 'AGPL-3.0' | ||
CAN_DETECT = {'Formatting', 'Syntax', 'Documentation', | ||
'Code Simplification'} | ||
ASCIINEMA_URL = '' | ||
|
||
def create_argument(file, filename, config_file): | ||
return (filename,) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from coalib.testing.LocalBearTestHelper import verify_local_bear | ||
from bears.php.PhanBear import PhanBear | ||
|
||
bad_file_closure = '''<?php | ||
$closure = function() { | ||
return 42; | ||
}; | ||
class A { | ||
private $a = 42; | ||
public function f() { | ||
$b = 2; | ||
$closure = function(int $p) use (&$b, $c) { | ||
return ($p + $this->a + $b); | ||
}; | ||
return $closure(3); | ||
} | ||
} | ||
''' | ||
|
||
PhanBearTest = verify_local_bear( | ||
PhanBear, | ||
valid_files=(), | ||
invalid_files=(bad_file_closure,)) |