dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "Make transaction enforcement stricter"
[lhc/web/wiklou.git]
/
maintenance
/
findDeprecated.php
diff --git
a/maintenance/findDeprecated.php
b/maintenance/findDeprecated.php
index
8c7e242
..
94b7fb4
100644
(file)
--- a/
maintenance/findDeprecated.php
+++ b/
maintenance/findDeprecated.php
@@
-53,7
+53,7
@@
class DeprecatedInterfaceFinder extends FileAwareNodeVisitor {
private $currentClass = null;
private $currentClass = null;
- private $foundNodes =
array()
;
+ private $foundNodes =
[]
;
public function getFoundNodes() {
// Sort results by version, then by filename, then by name.
public function getFoundNodes() {
// Sort results by version, then by filename, then by name.
@@
-71,6
+71,9
@@
class DeprecatedInterfaceFinder extends FileAwareNodeVisitor {
* indicating that it is a hard-deprecated interface.
*/
public function isHardDeprecated( PhpParser\Node $node ) {
* indicating that it is a hard-deprecated interface.
*/
public function isHardDeprecated( PhpParser\Node $node ) {
+ if ( !$node->stmts ) {
+ return false;
+ }
foreach ( $node->stmts as $stmt ) {
if (
$stmt instanceof PhpParser\Node\Expr\FuncCall
foreach ( $node->stmts as $stmt ) {
if (
$stmt instanceof PhpParser\Node\Expr\FuncCall
@@
-105,12
+108,12
@@
class DeprecatedInterfaceFinder extends FileAwareNodeVisitor {
$name = $node->name;
}
$name = $node->name;
}
- $this->foundNodes[ $version ][] =
array(
+ $this->foundNodes[ $version ][] =
[
'filename' => $node->filename,
'line' => $node->getLine(),
'name' => $name,
'hard' => $this->isHardDeprecated( $node ),
'filename' => $node->filename,
'line' => $node->getLine(),
'name' => $name,
'hard' => $this->isHardDeprecated( $node ),
-
)
;
+
]
;
}
return $retVal;
}
return $retVal;
@@
-124,7
+127,7
@@
class DeprecatedInterfaceFinder extends FileAwareNodeVisitor {
class FindDeprecated extends Maintenance {
public function __construct() {
parent::__construct();
class FindDeprecated extends Maintenance {
public function __construct() {
parent::__construct();
- $this->
mDescription = 'Find deprecated interfaces'
;
+ $this->
addDescription( 'Find deprecated interfaces' )
;
}
public function getFiles() {
}
public function getFiles() {
@@
-142,7
+145,7
@@
class FindDeprecated extends Maintenance {
$files = $this->getFiles();
$chunkSize = ceil( count( $files ) / 72 );
$files = $this->getFiles();
$chunkSize = ceil( count( $files ) / 72 );
- $parser =
new PhpParser\Parser( new PhpParser\Lexer\Emulative
);
+ $parser =
( new PhpParser\ParserFactory )->create( PhpParser\ParserFactory::PREFER_PHP7
);
$traverser = new PhpParser\NodeTraverser;
$finder = new DeprecatedInterfaceFinder;
$traverser->addVisitor( $finder );
$traverser = new PhpParser\NodeTraverser;
$finder = new DeprecatedInterfaceFinder;
$traverser->addVisitor( $finder );
@@
-158,7
+161,7
@@
class FindDeprecated extends Maintenance {
}
$finder->setCurrentFile( substr( $file->getPathname(), strlen( $IP ) + 1 ) );
}
$finder->setCurrentFile( substr( $file->getPathname(), strlen( $IP ) + 1 ) );
- $nodes = $parser->parse( $code,
array( 'throwOnError' => false )
);
+ $nodes = $parser->parse( $code,
[ 'throwOnError' => false ]
);
$traverser->traverse( $nodes );
if ( $i % $chunkSize === 0 ) {
$traverser->traverse( $nodes );
if ( $i % $chunkSize === 0 ) {