mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Scribunto
synced 2024-11-27 17:50:06 +00:00
Add missing @var and improve documentation
Change-Id: Idb7ff848ba702eac2cde31c6198a70311e3bdb69
This commit is contained in:
parent
11244fed16
commit
cb39fead91
|
@ -1,11 +1,6 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<ruleset name="Scribunto">
|
<ruleset name="Scribunto">
|
||||||
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki">
|
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki">
|
||||||
<exclude name="MediaWiki.Commenting.FunctionComment.ObjectTypeHintParam" />
|
|
||||||
<exclude name="MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationPrivate" />
|
|
||||||
<exclude name="MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationProtected" />
|
|
||||||
<exclude name="MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationPublic" />
|
|
||||||
<exclude name="MediaWiki.Commenting.PropertyDocumentation.WrongStyle" />
|
|
||||||
<exclude name="MediaWiki.Files.ClassMatchesFilename.NotMatch" />
|
<exclude name="MediaWiki.Files.ClassMatchesFilename.NotMatch" />
|
||||||
<exclude name="MediaWiki.Usage.ForbiddenFunctions.popen" />
|
<exclude name="MediaWiki.Usage.ForbiddenFunctions.popen" />
|
||||||
<exclude name="MediaWiki.Usage.ForbiddenFunctions.proc_open" />
|
<exclude name="MediaWiki.Usage.ForbiddenFunctions.proc_open" />
|
||||||
|
|
|
@ -3,8 +3,11 @@
|
||||||
use MediaWiki\MediaWikiServices;
|
use MediaWiki\MediaWikiServices;
|
||||||
|
|
||||||
class Scribunto_LuaLanguageLibrary extends Scribunto_LuaLibraryBase {
|
class Scribunto_LuaLanguageLibrary extends Scribunto_LuaLibraryBase {
|
||||||
|
/** @var Language[] */
|
||||||
public $langCache = [];
|
public $langCache = [];
|
||||||
|
/** @var array */
|
||||||
public $timeCache = [];
|
public $timeCache = [];
|
||||||
|
/** @var int */
|
||||||
public $maxLangCacheSize;
|
public $maxLangCacheSize;
|
||||||
|
|
||||||
public function register() {
|
public function register() {
|
||||||
|
|
|
@ -30,6 +30,7 @@ abstract class Scribunto_LuaEngine extends ScribuntoEngineBase {
|
||||||
'ustring',
|
'ustring',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
/** @var bool */
|
||||||
protected $loaded = false;
|
protected $loaded = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -46,7 +47,13 @@ abstract class Scribunto_LuaEngine extends ScribuntoEngineBase {
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $currentFrames = [];
|
protected $currentFrames = [];
|
||||||
|
/**
|
||||||
|
* @var array|null
|
||||||
|
*/
|
||||||
protected $expandCache = [];
|
protected $expandCache = [];
|
||||||
|
/**
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
protected $availableLibraries = [];
|
protected $availableLibraries = [];
|
||||||
|
|
||||||
private const MAX_EXPAND_CACHE_SIZE = 100;
|
private const MAX_EXPAND_CACHE_SIZE = 100;
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
use UtfNormal\Validator;
|
use UtfNormal\Validator;
|
||||||
|
|
||||||
class Scribunto_LuaError extends ScribuntoException {
|
class Scribunto_LuaError extends ScribuntoException {
|
||||||
|
/** @var string */
|
||||||
public $luaMessage;
|
public $luaMessage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -25,14 +25,14 @@ abstract class Scribunto_LuaInterpreter {
|
||||||
* Lua. If an error occurs, a Scribunto_LuaError will be thrown.
|
* Lua. If an error occurs, a Scribunto_LuaError will be thrown.
|
||||||
*
|
*
|
||||||
* @param callable $callable The PHP callable
|
* @param callable $callable The PHP callable
|
||||||
* @return object a Lua function
|
* @return LuaSandboxFunction a Lua function
|
||||||
*/
|
*/
|
||||||
abstract public function wrapPhpFunction( $callable );
|
abstract public function wrapPhpFunction( $callable );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test whether an object is a Lua function.
|
* Test whether an object is a Lua function.
|
||||||
*
|
*
|
||||||
* @param object $object
|
* @param mixed|LuaSandboxFunction $object
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
abstract public function isLuaFunction( $object );
|
abstract public function isLuaFunction( $object );
|
||||||
|
|
|
@ -3,9 +3,13 @@
|
||||||
use MediaWiki\MediaWikiServices;
|
use MediaWiki\MediaWikiServices;
|
||||||
|
|
||||||
class Scribunto_LuaSiteLibrary extends Scribunto_LuaLibraryBase {
|
class Scribunto_LuaSiteLibrary extends Scribunto_LuaLibraryBase {
|
||||||
|
/** @var string|null */
|
||||||
private static $namespacesCacheLang = null;
|
private static $namespacesCacheLang = null;
|
||||||
|
/** @var array[]|null */
|
||||||
private static $namespacesCache = null;
|
private static $namespacesCache = null;
|
||||||
|
/** @var array[] */
|
||||||
private static $interwikiMapCache = [];
|
private static $interwikiMapCache = [];
|
||||||
|
/** @var int[][] */
|
||||||
private $pagesInCategoryCache = [];
|
private $pagesInCategoryCache = [];
|
||||||
|
|
||||||
public function register() {
|
public function register() {
|
||||||
|
|
|
@ -10,7 +10,9 @@ class Scribunto_LuaTitleLibrary extends Scribunto_LuaLibraryBase {
|
||||||
// $wgExpensiveParserFunctionLimit + 1 actual Title objects because any
|
// $wgExpensiveParserFunctionLimit + 1 actual Title objects because any
|
||||||
// addition besides the one for the current page calls
|
// addition besides the one for the current page calls
|
||||||
// incrementExpensiveFunctionCount()
|
// incrementExpensiveFunctionCount()
|
||||||
|
/** @var Title[] */
|
||||||
private $titleCache = [];
|
private $titleCache = [];
|
||||||
|
/** @var (Title|null)[] */
|
||||||
private $idCache = [ 0 => null ];
|
private $idCache = [ 0 => null ];
|
||||||
|
|
||||||
public function register() {
|
public function register() {
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
class Scribunto_LuaSandboxEngine extends Scribunto_LuaEngine {
|
class Scribunto_LuaSandboxEngine extends Scribunto_LuaEngine {
|
||||||
public $options, $loaded = false;
|
/** @var array */
|
||||||
|
public $options;
|
||||||
|
/** @var bool */
|
||||||
|
public $loaded = false;
|
||||||
|
/** @var array */
|
||||||
protected $lineCache = [];
|
protected $lineCache = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -3,8 +3,9 @@
|
||||||
use MediaWiki\Logger\LoggerFactory;
|
use MediaWiki\Logger\LoggerFactory;
|
||||||
|
|
||||||
class Scribunto_LuaStandaloneEngine extends Scribunto_LuaEngine {
|
class Scribunto_LuaStandaloneEngine extends Scribunto_LuaEngine {
|
||||||
|
/** @var int|null */
|
||||||
protected static $clockTick;
|
protected static $clockTick;
|
||||||
/** @var array|bool */
|
/** @var array|false */
|
||||||
public $initialStatus;
|
public $initialStatus;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -76,7 +77,7 @@ class Scribunto_LuaStandaloneEngine extends Scribunto_LuaEngine {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return mixed
|
* @return int
|
||||||
*/
|
*/
|
||||||
protected function getClockTick() {
|
protected function getClockTick() {
|
||||||
if ( self::$clockTick === null ) {
|
if ( self::$clockTick === null ) {
|
||||||
|
|
|
@ -4,6 +4,7 @@ use Psr\Log\LoggerInterface;
|
||||||
use Psr\Log\NullLogger;
|
use Psr\Log\NullLogger;
|
||||||
|
|
||||||
class Scribunto_LuaStandaloneInterpreter extends Scribunto_LuaInterpreter {
|
class Scribunto_LuaStandaloneInterpreter extends Scribunto_LuaInterpreter {
|
||||||
|
/** @var int */
|
||||||
protected static $nextInterpreterId = 0;
|
protected static $nextInterpreterId = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
class Scribunto_LuaStandaloneInterpreterFunction {
|
class Scribunto_LuaStandaloneInterpreterFunction {
|
||||||
|
/** @var bool[] */
|
||||||
public static $anyChunksDestroyed = [];
|
public static $anyChunksDestroyed = [];
|
||||||
|
/** @var int[][] */
|
||||||
public static $activeChunkIds = [];
|
public static $activeChunkIds = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
class Scribunto_LuaDataProvider implements Iterator {
|
class Scribunto_LuaDataProvider implements Iterator {
|
||||||
|
/** @var Scribunto_LuaEngine|null */
|
||||||
protected $engine = null;
|
protected $engine = null;
|
||||||
|
/** @var mixed|null */
|
||||||
protected $exports = null;
|
protected $exports = null;
|
||||||
|
/** @var int */
|
||||||
protected $key = 1;
|
protected $key = 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -12,9 +12,13 @@
|
||||||
abstract class Scribunto_LuaEngineTestBase extends MediaWikiLangTestCase {
|
abstract class Scribunto_LuaEngineTestBase extends MediaWikiLangTestCase {
|
||||||
use Scribunto_LuaEngineTestHelper;
|
use Scribunto_LuaEngineTestHelper;
|
||||||
|
|
||||||
|
/** @var string|null */
|
||||||
private static $staticEngineName = null;
|
private static $staticEngineName = null;
|
||||||
|
/** @var string|null */
|
||||||
private $engineName = null;
|
private $engineName = null;
|
||||||
|
/** @var Scribunto_LuaEngine|null */
|
||||||
private $engine = null;
|
private $engine = null;
|
||||||
|
/** @var Scribunto_LuaDataProvider|null */
|
||||||
private $luaDataProvider = null;
|
private $luaDataProvider = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -11,6 +11,7 @@ use PHPUnit\Util\Test;
|
||||||
* Trait that helps LuaEngineTestBase and LuaEngineUnitTestBase
|
* Trait that helps LuaEngineTestBase and LuaEngineUnitTestBase
|
||||||
*/
|
*/
|
||||||
trait Scribunto_LuaEngineTestHelper {
|
trait Scribunto_LuaEngineTestHelper {
|
||||||
|
/** @var array[] */
|
||||||
private static $engineConfigurations = [
|
private static $engineConfigurations = [
|
||||||
'LuaSandbox' => [
|
'LuaSandbox' => [
|
||||||
'memoryLimit' => 50000000,
|
'memoryLimit' => 50000000,
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
class Scribunto_LuaEngineTestSkip extends PHPUnit\Framework\TestCase {
|
class Scribunto_LuaEngineTestSkip extends PHPUnit\Framework\TestCase {
|
||||||
|
/** @var string */
|
||||||
private $className = '';
|
private $className = '';
|
||||||
|
/** @var string */
|
||||||
private $message = '';
|
private $message = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -13,9 +13,13 @@ abstract class Scribunto_LuaEngineUnitTestBase extends \PHPUnit\Framework\TestCa
|
||||||
use MediaWikiCoversValidator;
|
use MediaWikiCoversValidator;
|
||||||
use Scribunto_LuaEngineTestHelper;
|
use Scribunto_LuaEngineTestHelper;
|
||||||
|
|
||||||
|
/** @var string|null */
|
||||||
private static $staticEngineName = null;
|
private static $staticEngineName = null;
|
||||||
|
/** @var string|null */
|
||||||
private $engineName = null;
|
private $engineName = null;
|
||||||
|
/** @var Scribunto_LuaEngine|null */
|
||||||
private $engine = null;
|
private $engine = null;
|
||||||
|
/** @var Scribunto_LuaDataProvider|null */
|
||||||
private $luaDataProvider = null;
|
private $luaDataProvider = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
class UstringLibraryNormalizationTestProvider extends Scribunto_LuaDataProvider {
|
class UstringLibraryNormalizationTestProvider extends Scribunto_LuaDataProvider {
|
||||||
|
/** @var resource|null */
|
||||||
protected $file = null;
|
protected $file = null;
|
||||||
|
/** @var string[]|null */
|
||||||
protected $current = null;
|
protected $current = null;
|
||||||
|
/** @var array */
|
||||||
protected static $static = [
|
protected static $static = [
|
||||||
'1E0A 0323;1E0C 0307;0044 0323 0307;1E0C 0307;0044 0323 0307;',
|
'1E0A 0323;1E0C 0307;0044 0323 0307;1E0C 0307;0044 0323 0307;',
|
||||||
false
|
false
|
||||||
|
|
Loading…
Reference in a new issue