X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FfindDeprecated.php;h=03035f756a2c805db73c015cc8d270a045ec033f;hb=efbfa0a727a196e63a2b71f0a82f09150c2be354;hp=94b7fb4429222c1808506e1abc8c14a3542dec55;hpb=64b83bdb3afd0ee4f8fc1893a865409c198e601e;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/findDeprecated.php b/maintenance/findDeprecated.php index 94b7fb4429..03035f756a 100644 --- a/maintenance/findDeprecated.php +++ b/maintenance/findDeprecated.php @@ -20,6 +20,7 @@ * * @file * @ingroup Maintenance + * @phan-file-suppress PhanUndeclaredProperty Lots of custom properties */ require_once __DIR__ . '/Maintenance.php'; @@ -59,7 +60,7 @@ class DeprecatedInterfaceFinder extends FileAwareNodeVisitor { // Sort results by version, then by filename, then by name. foreach ( $this->foundNodes as $version => &$nodes ) { uasort( $nodes, function ( $a, $b ) { - return ( $a['filename'] . $a['name'] ) < ( $b['filename'] . $b['name'] ) ? -1 : 1; + return ( $a['filename'] . $a['name'] ) <=> ( $b['filename'] . $b['name'] ); } ); } ksort( $this->foundNodes ); @@ -69,6 +70,8 @@ class DeprecatedInterfaceFinder extends FileAwareNodeVisitor { /** * Check whether a function or method includes a call to wfDeprecated(), * indicating that it is a hard-deprecated interface. + * @param PhpParser\Node $node + * @return bool */ public function isHardDeprecated( PhpParser\Node $node ) { if ( !$node->stmts ) { @@ -130,6 +133,9 @@ class FindDeprecated extends Maintenance { $this->addDescription( 'Find deprecated interfaces' ); } + /** + * @return SplFileInfo[] + */ public function getFiles() { global $IP; @@ -161,7 +167,7 @@ class FindDeprecated extends Maintenance { } $finder->setCurrentFile( substr( $file->getPathname(), strlen( $IP ) + 1 ) ); - $nodes = $parser->parse( $code, [ 'throwOnError' => false ] ); + $nodes = $parser->parse( $code ); $traverser->traverse( $nodes ); if ( $i % $chunkSize === 0 ) { @@ -197,5 +203,5 @@ class FindDeprecated extends Maintenance { } } -$maintClass = 'FindDeprecated'; +$maintClass = FindDeprecated::class; require_once RUN_MAINTENANCE_IF_MAIN;