mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/ParserFunctions
synced 2024-11-27 09:41:37 +00:00
Upgrade to newer phan
Bug: T216933 Change-Id: If8a63da99343597b7f8c131f3656945eaf67d819
This commit is contained in:
parent
fce9a05cd2
commit
ab601a2ca7
|
@ -1,18 +1,18 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$cfg = require __DIR__ . '/../../vendor/mediawiki/mediawiki-phan-config/src/config.php';
|
$cfg = require __DIR__ . '/../vendor/mediawiki/mediawiki-phan-config/src/config.php';
|
||||||
|
|
||||||
$cfg['directory_list'] = array_merge(
|
$cfg['directory_list'] = array_merge(
|
||||||
$cfg['directory_list'],
|
$cfg['directory_list'],
|
||||||
[
|
[
|
||||||
'./../../extensions/Scribunto',
|
'../../extensions/Scribunto',
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
$cfg['exclude_analysis_directory_list'] = array_merge(
|
$cfg['exclude_analysis_directory_list'] = array_merge(
|
||||||
$cfg['exclude_analysis_directory_list'],
|
$cfg['exclude_analysis_directory_list'],
|
||||||
[
|
[
|
||||||
'./../../extensions/Scribunto',
|
'../../extensions/Scribunto',
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
"jakub-onderka/php-console-highlighter": "0.3.2",
|
"jakub-onderka/php-console-highlighter": "0.3.2",
|
||||||
"mediawiki/mediawiki-codesniffer": "24.0.0",
|
"mediawiki/mediawiki-codesniffer": "24.0.0",
|
||||||
"mediawiki/minus-x": "0.3.1",
|
"mediawiki/minus-x": "0.3.1",
|
||||||
"mediawiki/mediawiki-phan-config": "0.3.0"
|
"mediawiki/mediawiki-phan-config": "0.5.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"fix": [
|
"fix": [
|
||||||
|
|
|
@ -202,10 +202,12 @@ class ExprParser {
|
||||||
|
|
||||||
// First the unlimited length classes
|
// First the unlimited length classes
|
||||||
|
|
||||||
|
// @phan-suppress-next-line PhanParamSuspiciousOrder false positive
|
||||||
if ( false !== strpos( EXPR_WHITE_CLASS, $char ) ) {
|
if ( false !== strpos( EXPR_WHITE_CLASS, $char ) ) {
|
||||||
// Whitespace
|
// Whitespace
|
||||||
$p += strspn( $expr, EXPR_WHITE_CLASS, $p );
|
$p += strspn( $expr, EXPR_WHITE_CLASS, $p );
|
||||||
continue;
|
continue;
|
||||||
|
// @phan-suppress-next-line PhanParamSuspiciousOrder false positive
|
||||||
} elseif ( false !== strpos( EXPR_NUMBER_CLASS, $char ) ) {
|
} elseif ( false !== strpos( EXPR_NUMBER_CLASS, $char ) ) {
|
||||||
// Number
|
// Number
|
||||||
if ( $expecting !== 'expression' ) {
|
if ( $expecting !== 'expression' ) {
|
||||||
|
|
|
@ -85,8 +85,8 @@ class ExtParserFunctions {
|
||||||
*/
|
*/
|
||||||
public static function ifexprObj( $parser, $frame, $args ) {
|
public static function ifexprObj( $parser, $frame, $args ) {
|
||||||
$expr = isset( $args[0] ) ? trim( $frame->expand( $args[0] ) ) : '';
|
$expr = isset( $args[0] ) ? trim( $frame->expand( $args[0] ) ) : '';
|
||||||
$then = isset( $args[1] ) ? $args[1] : '';
|
$then = $args[1] ?? '';
|
||||||
$else = isset( $args[2] ) ? $args[2] : '';
|
$else = $args[2] ?? '';
|
||||||
$result = self::ifexpr( $parser, $expr, $then, $else );
|
$result = self::ifexpr( $parser, $expr, $then, $else );
|
||||||
if ( is_object( $result ) ) {
|
if ( is_object( $result ) ) {
|
||||||
$result = trim( $frame->expand( $result ) );
|
$result = trim( $frame->expand( $result ) );
|
||||||
|
@ -156,8 +156,8 @@ class ExtParserFunctions {
|
||||||
*/
|
*/
|
||||||
public static function iferrorObj( $parser, $frame, $args ) {
|
public static function iferrorObj( $parser, $frame, $args ) {
|
||||||
$test = isset( $args[0] ) ? trim( $frame->expand( $args[0] ) ) : '';
|
$test = isset( $args[0] ) ? trim( $frame->expand( $args[0] ) ) : '';
|
||||||
$then = isset( $args[1] ) ? $args[1] : false;
|
$then = $args[1] ?? false;
|
||||||
$else = isset( $args[2] ) ? $args[2] : false;
|
$else = $args[2] ?? false;
|
||||||
$result = self::iferror( $parser, $test, $then, $else );
|
$result = self::iferror( $parser, $test, $then, $else );
|
||||||
if ( $result === false ) {
|
if ( $result === false ) {
|
||||||
return '';
|
return '';
|
||||||
|
@ -379,8 +379,8 @@ class ExtParserFunctions {
|
||||||
*/
|
*/
|
||||||
public static function ifexistObj( $parser, $frame, $args ) {
|
public static function ifexistObj( $parser, $frame, $args ) {
|
||||||
$title = isset( $args[0] ) ? trim( $frame->expand( $args[0] ) ) : '';
|
$title = isset( $args[0] ) ? trim( $frame->expand( $args[0] ) ) : '';
|
||||||
$then = isset( $args[1] ) ? $args[1] : null;
|
$then = $args[1] ?? null;
|
||||||
$else = isset( $args[2] ) ? $args[2] : null;
|
$else = $args[2] ?? null;
|
||||||
|
|
||||||
$result = self::ifexistCommon( $parser, $frame, $title, $then, $else );
|
$result = self::ifexistCommon( $parser, $frame, $title, $then, $else );
|
||||||
if ( $result === null ) {
|
if ( $result === null ) {
|
||||||
|
|
Loading…
Reference in a new issue