Upgrade to newer phan
authorKunal Mehta <legoktm@member.fsf.org>
Thu, 21 Mar 2019 23:59:32 +0000 (16:59 -0700)
committerKunal Mehta <legoktm@member.fsf.org>
Sun, 24 Mar 2019 01:06:35 +0000 (18:06 -0700)
MediaWiki core now runs phan 1.2.6, bringing in nearly 2+ years of upstream
fixes.

Configuration was moved from `tests/phan` to `.phan/`. The legacy bash wrapper
script is still kept in the repository in its own location for any extensions
that are still using it. It should be removed before 1.33 is released.

Since there's a lot of new issues being flagged, all currently failing issues
are suppressed, and will be fixed in follow-up patches.

We're dropping the jetbrains/phpstorm-stubs repository in favor of just
the minimal stubs we need. Stubs for PHP extensions are kept in
the new `.phan/internal_stubs` directory, since they're in a slightly
different format than normal stubs.

Normal stubs are kept in `.phan/stubs`. wikidiff2 and excimer are kept with
these since we're also the upstream for them.

Change-Id: I3fe437befa17f4fbaf97aa6271f659b56021f396

25 files changed:
.phan/config.php [new file with mode: 0644]
.phan/internal_stubs/memcached.phan_php [new file with mode: 0644]
.phan/internal_stubs/oci8.phan_php [new file with mode: 0644]
.phan/internal_stubs/sqlsrv.phan_php [new file with mode: 0644]
.phan/internal_stubs/tideways.phan_php [new file with mode: 0644]
.phan/stubs/README [new file with mode: 0644]
.phan/stubs/excimer.php [new file with mode: 0644]
.phan/stubs/hhvm.php [new file with mode: 0644]
.phan/stubs/mail.php [new file with mode: 0644]
.phan/stubs/password.php [new file with mode: 0644]
.phan/stubs/phpunit4.php [new file with mode: 0644]
.phan/stubs/wikidiff.php [new file with mode: 0644]
composer.json
includes/cache/localisation/LocalisationCache.php
includes/installer/Installer.php
includes/libs/filebackend/FileBackendMultiWrite.php
tests/phan/config.php [deleted file]
tests/phan/stubs/README [deleted file]
tests/phan/stubs/excimer.php [deleted file]
tests/phan/stubs/hhvm.php [deleted file]
tests/phan/stubs/mail.php [deleted file]
tests/phan/stubs/memcached.php [deleted file]
tests/phan/stubs/phpunit4.php [deleted file]
tests/phan/stubs/tideways.php [deleted file]
tests/phan/stubs/wikidiff.php [deleted file]

diff --git a/.phan/config.php b/.phan/config.php
new file mode 100644 (file)
index 0000000..52d5d99
--- /dev/null
@@ -0,0 +1,201 @@
+<?php
+/**
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
+
+$cfg = require __DIR__ . '/../vendor/mediawiki/mediawiki-phan-config/src/config.php';
+
+$cfg['file_list'] = array_merge(
+       $cfg['file_list'],
+       function_exists( 'register_postsend_function' ) ? [] : [ '.phan/stubs/hhvm.php' ],
+       function_exists( 'wikidiff2_do_diff' ) ? [] : [ '.phan/stubs/wikidiff.php' ],
+       class_exists( PEAR::class ) ? [] : [ '.phan/stubs/mail.php' ],
+       defined( 'PASSWORD_ARGON2I' ) ? [] : [ '.phan/stubs/password.php' ],
+       // Per composer.json, PHPUnit 6 is used for PHP 7.0+, PHPUnit 4 otherwise.
+       // Load the interface for the version of PHPUnit that isn't installed.
+       // Phan only supports PHP 7.0+ (and not HHVM), so we only need to stub PHPUnit 4.
+       class_exists( PHPUnit_TextUI_Command::class ) ? [] : [ '.phan/stubs/phpunit4.php' ],
+       class_exists( ProfilerExcimer::class ) ? [] : [ '.phan/stubs/excimer.php' ],
+       [
+               'maintenance/7zip.inc',
+               'maintenance/cleanupTable.inc',
+               'maintenance/CodeCleanerGlobalsPass.inc',
+               'maintenance/commandLine.inc',
+               'maintenance/sqlite.inc',
+               'maintenance/userDupes.inc',
+               'maintenance/language/checkLanguage.inc',
+               'maintenance/language/languages.inc',
+       ]
+);
+
+$cfg['autoload_internal_extension_signatures'] = [
+       'memcached' => '.phan/internal_stubs/memcached.phan_php',
+       'oci8' => '.phan/internal_stubs/oci8.phan_php',
+       'sqlsrv' => '.phan/internal_stubs/sqlsrv.phan_php',
+       'tideways' => '.phan/internal_stubs/tideways.phan_php',
+];
+
+$cfg['directory_list'] = [
+       'includes/',
+       'languages/',
+       'maintenance/',
+       'mw-config/',
+       'resources/',
+       'vendor/',
+       '.phan/stubs/',
+];
+
+$cfg['exclude_analysis_directory_list'] = [
+       'vendor/',
+       '.phan/stubs/',
+       // The referenced classes are not available in vendor, only when
+       // included from composer.
+       'includes/composer/',
+       // Directly references classes that only exist in Translate extension
+       'maintenance/language/',
+       // External class
+       'includes/libs/jsminplus.php',
+];
+
+$cfg['suppress_issue_types'] = array_merge( $cfg['suppress_issue_types'], [
+       // approximate error count: 18
+       "PhanAccessMethodInternal",
+       // approximate error count: 17
+       "PhanCommentParamOnEmptyParamList",
+       // approximate error count: 30
+       "PhanCommentParamWithoutRealParam",
+       // approximate error count: 2
+       "PhanCompatibleNegativeStringOffset",
+       // approximate error count: 1
+       "PhanEmptyFQSENInCallable",
+       // approximate error count: 1
+       "PhanInvalidCommentForDeclarationType",
+       // approximate error count: 6
+       "PhanNonClassMethodCall",
+       // approximate error count: 21
+       "PhanParamReqAfterOpt",
+       // approximate error count: 27
+       "PhanParamSignatureMismatch",
+       // approximate error count: 4
+       "PhanParamSignatureMismatchInternal",
+       // approximate error count: 1
+       "PhanParamSignatureRealMismatchTooFewParameters",
+       // approximate error count: 1
+       "PhanParamSuspiciousOrder",
+       // approximate error count: 127
+       "PhanParamTooMany",
+       // approximate error count: 2
+       "PhanParamTooManyCallable",
+       // approximate error count: 1
+       "PhanParamTooManyInternal",
+       // approximate error count: 2
+       "PhanPluginDuplicateConditionalNullCoalescing",
+       // approximate error count: 1
+       "PhanPluginDuplicateConditionalTernaryDuplication",
+       // approximate error count: 2
+       "PhanPluginDuplicateExpressionBinaryOp",
+       // approximate error count: 2
+       "PhanTraitParentReference",
+       // approximate error count: 27
+       "PhanTypeArraySuspicious",
+       // approximate error count: 33
+       "PhanTypeArraySuspiciousNullable",
+       // approximate error count: 26
+       "PhanTypeComparisonFromArray",
+       // approximate error count: 2
+       "PhanTypeComparisonToArray",
+       // approximate error count: 1
+       "PhanTypeConversionFromArray",
+       // approximate error count: 2
+       "PhanTypeExpectedObjectOrClassName",
+       // approximate error count: 7
+       "PhanTypeExpectedObjectPropAccess",
+       // approximate error count: 3
+       "PhanTypeInstantiateAbstract",
+       // approximate error count: 1
+       "PhanTypeInvalidCallableArraySize",
+       // approximate error count: 62
+       "PhanTypeInvalidDimOffset",
+       // approximate error count: 10
+       "PhanTypeInvalidExpressionArrayDestructuring",
+       // approximate error count: 1
+       "PhanTypeInvalidLeftOperand",
+       // approximate error count: 7
+       "PhanTypeInvalidLeftOperandOfIntegerOp",
+       // approximate error count: 2
+       "PhanTypeInvalidRightOperand",
+       // approximate error count: 2
+       "PhanTypeInvalidRightOperandOfIntegerOp",
+       // approximate error count: 1
+       "PhanTypeMagicVoidWithReturn",
+       // approximate error count: 152
+       "PhanTypeMismatchArgument",
+       // approximate error count: 28
+       "PhanTypeMismatchArgumentInternal",
+       // approximate error count: 1
+       "PhanTypeMismatchBitwiseBinaryOperands",
+       // approximate error count: 1
+       "PhanTypeMismatchDeclaredParam",
+       // approximate error count: 2
+       "PhanTypeMismatchDimEmpty",
+       // approximate error count: 29
+       "PhanTypeMismatchDimFetch",
+       // approximate error count: 10
+       "PhanTypeMismatchForeach",
+       // approximate error count: 77
+       "PhanTypeMismatchProperty",
+       // approximate error count: 88
+       "PhanTypeMismatchReturn",
+       // approximate error count: 43
+       "PhanTypeMissingReturn",
+       // approximate error count: 1
+       "PhanTypeNoAccessiblePropertiesForeach",
+       // approximate error count: 4
+       "PhanTypeNonVarPassByRef",
+       // approximate error count: 12
+       "PhanTypeObjectUnsetDeclaredProperty",
+       // approximate error count: 9
+       "PhanTypeSuspiciousNonTraversableForeach",
+       // approximate error count: 3
+       "PhanTypeSuspiciousStringExpression",
+       // approximate error count: 22
+       "PhanUndeclaredConstant",
+       // approximate error count: 3
+       "PhanUndeclaredInvokeInCallable",
+       // approximate error count: 242
+       "PhanUndeclaredMethod",
+       // approximate error count: 847
+       "PhanUndeclaredProperty",
+       // approximate error count: 1
+       "PhanUndeclaredTypeReturnType",
+       // approximate error count: 3
+       "PhanUndeclaredTypeThrowsType",
+       // approximate error count: 2
+       "PhanUndeclaredVariableAssignOp",
+       // approximate error count: 55
+       "PhanUndeclaredVariableDim",
+       // approximate error count: 4
+       "PhanUnextractableAnnotationElementName",
+       // approximate error count: 4
+       "PhanUnextractableAnnotationSuffix",
+] );
+
+$cfg['ignore_undeclared_variables_in_global_scope'] = true;
+$cfg['globals_type_map']['IP'] = 'string';
+
+return $cfg;
diff --git a/.phan/internal_stubs/memcached.phan_php b/.phan/internal_stubs/memcached.phan_php
new file mode 100644 (file)
index 0000000..8a85baf
--- /dev/null
@@ -0,0 +1,180 @@
+<?php
+// These stubs were generated by the phan stub generator.
+// @phan-stub-for-extension memcached@3.0.1
+
+namespace {
+class Memcached {
+
+    // constants
+    const LIBMEMCACHED_VERSION_HEX = 16777240;
+    const OPT_COMPRESSION = -1001;
+    const OPT_COMPRESSION_TYPE = -1004;
+    const OPT_PREFIX_KEY = -1002;
+    const OPT_SERIALIZER = -1003;
+    const OPT_USER_FLAGS = -1006;
+    const OPT_STORE_RETRY_COUNT = -1005;
+    const HAVE_IGBINARY = true;
+    const HAVE_JSON = true;
+    const HAVE_MSGPACK = true;
+    const HAVE_SESSION = true;
+    const HAVE_SASL = true;
+    const OPT_HASH = 2;
+    const HASH_DEFAULT = 0;
+    const HASH_MD5 = 1;
+    const HASH_CRC = 2;
+    const HASH_FNV1_64 = 3;
+    const HASH_FNV1A_64 = 4;
+    const HASH_FNV1_32 = 5;
+    const HASH_FNV1A_32 = 6;
+    const HASH_HSIEH = 7;
+    const HASH_MURMUR = 8;
+    const OPT_DISTRIBUTION = 9;
+    const DISTRIBUTION_MODULA = 0;
+    const DISTRIBUTION_CONSISTENT = 1;
+    const DISTRIBUTION_VIRTUAL_BUCKET = 6;
+    const OPT_LIBKETAMA_COMPATIBLE = 16;
+    const OPT_LIBKETAMA_HASH = 17;
+    const OPT_TCP_KEEPALIVE = 32;
+    const OPT_BUFFER_WRITES = 10;
+    const OPT_BINARY_PROTOCOL = 18;
+    const OPT_NO_BLOCK = 0;
+    const OPT_TCP_NODELAY = 1;
+    const OPT_SOCKET_SEND_SIZE = 4;
+    const OPT_SOCKET_RECV_SIZE = 5;
+    const OPT_CONNECT_TIMEOUT = 14;
+    const OPT_RETRY_TIMEOUT = 15;
+    const OPT_DEAD_TIMEOUT = 36;
+    const OPT_SEND_TIMEOUT = 19;
+    const OPT_RECV_TIMEOUT = 20;
+    const OPT_POLL_TIMEOUT = 8;
+    const OPT_CACHE_LOOKUPS = 6;
+    const OPT_SERVER_FAILURE_LIMIT = 21;
+    const OPT_AUTO_EJECT_HOSTS = 28;
+    const OPT_HASH_WITH_PREFIX_KEY = 25;
+    const OPT_NOREPLY = 26;
+    const OPT_SORT_HOSTS = 12;
+    const OPT_VERIFY_KEY = 13;
+    const OPT_USE_UDP = 27;
+    const OPT_NUMBER_OF_REPLICAS = 29;
+    const OPT_RANDOMIZE_REPLICA_READ = 30;
+    const OPT_REMOVE_FAILED_SERVERS = 35;
+    const OPT_SERVER_TIMEOUT_LIMIT = 37;
+    const RES_SUCCESS = 0;
+    const RES_FAILURE = 1;
+    const RES_HOST_LOOKUP_FAILURE = 2;
+    const RES_UNKNOWN_READ_FAILURE = 7;
+    const RES_PROTOCOL_ERROR = 8;
+    const RES_CLIENT_ERROR = 9;
+    const RES_SERVER_ERROR = 10;
+    const RES_WRITE_FAILURE = 5;
+    const RES_DATA_EXISTS = 12;
+    const RES_NOTSTORED = 14;
+    const RES_NOTFOUND = 16;
+    const RES_PARTIAL_READ = 18;
+    const RES_SOME_ERRORS = 19;
+    const RES_NO_SERVERS = 20;
+    const RES_END = 21;
+    const RES_ERRNO = 26;
+    const RES_BUFFERED = 32;
+    const RES_TIMEOUT = 31;
+    const RES_BAD_KEY_PROVIDED = 33;
+    const RES_STORED = 15;
+    const RES_DELETED = 22;
+    const RES_STAT = 24;
+    const RES_ITEM = 25;
+    const RES_NOT_SUPPORTED = 28;
+    const RES_FETCH_NOTFINISHED = 30;
+    const RES_SERVER_MARKED_DEAD = 35;
+    const RES_UNKNOWN_STAT_KEY = 36;
+    const RES_INVALID_HOST_PROTOCOL = 34;
+    const RES_MEMORY_ALLOCATION_FAILURE = 17;
+    const RES_CONNECTION_SOCKET_CREATE_FAILURE = 11;
+    const RES_E2BIG = 37;
+    const RES_KEY_TOO_BIG = 39;
+    const RES_SERVER_TEMPORARILY_DISABLED = 47;
+    const RES_SERVER_MEMORY_ALLOCATION_FAILURE = 48;
+    const RES_AUTH_PROBLEM = 40;
+    const RES_AUTH_FAILURE = 41;
+    const RES_AUTH_CONTINUE = 42;
+    const RES_PAYLOAD_FAILURE = -1001;
+    const SERIALIZER_PHP = 1;
+    const SERIALIZER_IGBINARY = 2;
+    const SERIALIZER_JSON = 3;
+    const SERIALIZER_JSON_ARRAY = 4;
+    const SERIALIZER_MSGPACK = 5;
+    const COMPRESSION_FASTLZ = 2;
+    const COMPRESSION_ZLIB = 1;
+    const GET_PRESERVE_ORDER = 1;
+    const GET_EXTENDED = 2;
+    const GET_ERROR_RETURN_VALUE = false;
+
+    // methods
+    public function __construct($persistent_id = null, $callback = null) {}
+    public function getResultCode() {}
+    public function getResultMessage() {}
+    public function get($key, $cache_cb = null, $get_flags = null) {}
+    public function getByKey($server_key, $key, $cache_cb = null, $get_flags = null) {}
+    public function getMulti(array $keys, $get_flags = null) {}
+    public function getMultiByKey($server_key, array $keys, $get_flags = null) {}
+    public function getDelayed(array $keys, $with_cas = null, $value_cb = null) {}
+    public function getDelayedByKey($server_key, array $keys, $with_cas = null, $value_cb = null) {}
+    public function fetch() {}
+    public function fetchAll() {}
+    public function set($key, $value, $expiration = null) {}
+    public function setByKey($server_key, $key, $value, $expiration = null) {}
+    public function touch($key, $expiration) {}
+    public function touchByKey($server_key, $key, $expiration) {}
+    public function setMulti(array $items, $expiration = null) {}
+    public function setMultiByKey($server_key, array $items, $expiration = null) {}
+    public function cas($cas_token, $key, $value, $expiration = null) {}
+    public function casByKey($cas_token, $server_key, $key, $value, $expiration = null) {}
+    public function add($key, $value, $expiration = null) {}
+    public function addByKey($server_key, $key, $value, $expiration = null) {}
+    public function append($key, $value, $expiration = null) {}
+    public function appendByKey($server_key, $key, $value, $expiration = null) {}
+    public function prepend($key, $value, $expiration = null) {}
+    public function prependByKey($server_key, $key, $value, $expiration = null) {}
+    public function replace($key, $value, $expiration = null) {}
+    public function replaceByKey($server_key, $key, $value, $expiration = null) {}
+    public function delete($key, $time = null) {}
+    public function deleteMulti($keys, $time = null) {}
+    public function deleteByKey($server_key, $key, $time = null) {}
+    public function deleteMultiByKey($server_key, $keys, $time = null) {}
+    public function increment($key, $offset = null, $initial_value = null, $expiry = null) {}
+    public function decrement($key, $offset = null, $initial_value = null, $expiry = null) {}
+    public function incrementByKey($server_key, $key, $offset = null, $initial_value = null, $expiry = null) {}
+    public function decrementByKey($server_key, $key, $offset = null, $initial_value = null, $expiry = null) {}
+    public function addServer($host, $port, $weight = null) {}
+    public function addServers(array $servers) {}
+    public function getServerList() {}
+    public function getServerByKey($server_key) {}
+    public function resetServerList() {}
+    public function quit() {}
+    public function flushBuffers() {}
+    public function getLastErrorMessage() {}
+    public function getLastErrorCode() {}
+    public function getLastErrorErrno() {}
+    public function getLastDisconnectedServer() {}
+    public function getStats($args) {}
+    public function getVersion() {}
+    public function getAllKeys() {}
+    public function flush($delay = null) {}
+    public function getOption($option) {}
+    public function setOption($option, $value) {}
+    public function setOptions($options) {}
+    public function setBucket($host_map, $forward_map, $replicas) {}
+    public function setSaslAuthData($username, $password) {}
+    public function isPersistent() {}
+    public function isPristine() {}
+}
+
+class MemcachedException extends \RuntimeException {
+
+    // properties
+    protected $message;
+    protected $code;
+    protected $file;
+    protected $line;
+}
+
+}
diff --git a/.phan/internal_stubs/oci8.phan_php b/.phan/internal_stubs/oci8.phan_php
new file mode 100644 (file)
index 0000000..78f334e
--- /dev/null
@@ -0,0 +1,589 @@
+<?php
+
+// @phan-stub-for-extension oci8@2.0.7
+
+
+class OCI_Lob  {
+
+       
+       public function load () {}
+
+       
+       public function tell () {}
+
+       
+       public function truncate ($length = 0) {}
+
+       
+       public function erase ($offset = null, $length = null) {}
+
+       
+       public function flush ($flag = null) {}
+
+       
+       public function setbuffering ($on_off) {}
+
+       
+       public function getbuffering () {}
+
+       
+       public function rewind () {}
+
+       
+       public function read ($length) {}
+
+       
+       public function eof () {}
+
+       
+       public function seek ($offset, $whence = OCI_SEEK_SET) {}
+
+       
+       public function write ($data, $length = null) {}
+
+       
+       public function append (OCI_Lob $lob_from) {}
+
+       
+       public function size () {}
+
+       
+       public function writetofile ($filename, $start, $length) {}
+
+       
+       public function export ($filename, $start = null, $length = null) {}
+
+       
+       public function import ($filename) {}
+
+       
+       public function writeTemporary ($data, $lob_type = OCI_TEMP_CLOB) {}
+
+       
+       public function close () {}
+
+       
+       public function save ($data, $offset = null) {}
+
+       
+       public function savefile ($filename) {}
+
+       
+       public function free () {}
+
+}
+
+
+class OCI_Collection  {
+
+       
+       public function append ($value) {}
+
+       
+       public function getelem ($index) {}
+
+       
+       public function assignelem ($index, $value) {}
+
+       
+       public function assign (OCI_Collection $from) {}
+
+       
+       public function size () {}
+
+       
+       public function max () {}
+
+       
+       public function trim ($num) {}
+
+       
+       public function free () {}
+
+}
+
+
+function oci_define_by_name ($statement, $column_name, &$variable, $type = SQLT_CHR) {}
+
+
+function oci_bind_by_name ($statement, $bv_name, &$variable, $maxlength = -1, $type = SQLT_CHR) {}
+
+
+function oci_bind_array_by_name ($statement, $name, array &$var_array, $max_table_length, $max_item_length = -1, $type = SQLT_AFC) {}
+
+
+function oci_field_is_null ($statement, $field) {}
+
+
+function oci_field_name ($statement, $field) {}
+
+
+function oci_field_size ($statement, $field) {}
+
+
+function oci_field_scale ($statement, $field) {}
+
+
+function oci_field_precision ($statement, $field) {}
+
+
+function oci_field_type ($statement, $field) {}
+
+
+function oci_field_type_raw ($statement, $field) {}
+
+
+function oci_execute ($statement, $mode = OCI_COMMIT_ON_SUCCESS) {}
+
+
+function oci_cancel ($statement) {}
+
+
+function oci_fetch ($statement) {}
+
+
+function oci_fetch_object ($statement) {}
+
+
+function oci_fetch_row ($statement) {}
+
+
+function oci_fetch_assoc ($statement) {}
+
+
+function oci_fetch_array ($statement, $mode = null) {}
+
+
+function ocifetchinto ($statement_resource, &$result, $mode = null) {}
+
+
+function oci_fetch_all ($statement, array &$output, $skip = 0, $maxrows = -1, $flags = OCI_FETCHSTATEMENT_BY_COLUMN | OCI_ASSOC) {}
+
+
+function oci_free_statement ($statement) {}
+
+
+function oci_internal_debug ($onoff) {}
+
+
+function oci_num_fields ($statement) {}
+
+
+function oci_parse ($connection, $sql_text) {}
+
+
+function oci_get_implicit_resultset ($statement) {}
+
+
+function oci_new_cursor ($connection) {}
+
+
+function oci_result ($statement, $field) {}
+
+
+function oci_client_version () {}
+
+
+function oci_server_version ($connection) {}
+
+
+function oci_statement_type ($statement) {}
+
+
+function oci_num_rows ($statement) {}
+
+
+function oci_close ($connection) {}
+
+
+function oci_connect ($username, $password, $connection_string = null, $character_set = null, $session_mode = null) {}
+
+
+function oci_new_connect ($username, $password, $connection_string = null, $character_set = null, $session_mode = null) {}
+
+
+function oci_pconnect ($username, $password, $connection_string = null, $character_set = null, $session_mode = null) {}
+
+
+function oci_error ($resource = null) {}
+
+
+function oci_free_descriptor ($descriptor) {}
+
+
+function oci_lob_is_equal (OCI_Lob $lob1, OCI_Lob $lob2) {}
+
+
+function oci_lob_copy (OCI_Lob $lob_to, OCI_Lob $lob_from, $length = 0) {}
+
+
+function oci_commit ($connection) {}
+
+
+function oci_rollback ($connection) {}
+
+
+function oci_new_descriptor ($connection, $type = OCI_DTYPE_LOB) {}
+
+
+function oci_set_prefetch ($statement, $rows) {}
+
+
+function oci_set_client_identifier ($connection, $client_identifier) {}
+
+
+function oci_set_edition ($edition) {}
+
+
+function oci_set_module_name ($connection, $module_name) {}
+
+
+function oci_set_action ($connection, $action_name) {}
+
+
+function oci_set_client_info ($connection, $client_info) {}
+
+
+function oci_password_change ($connection, $username, $old_password, $new_password) {}
+
+
+function oci_new_collection ($connection, $tdo, $schema = null) {}
+
+
+function oci_free_cursor ($statement_resource) {}
+
+
+function ocifreecursor ($statement_resource) {}
+
+
+function ocibindbyname ($statement, $column_name, &$variable, $maximum_length = -1, $type = SQLT_CHR) {}
+
+
+function ocidefinebyname ($statement, $column_name, &$variable, $type = SQLT_CHR) {}
+
+
+function ocicolumnisnull ($statement, $column_number_or_name) {}
+
+
+function ocicolumnname ($statement, $column_number) {}
+
+
+function ocicolumnsize ($statement, $column_number_or_name) {}
+
+
+function ocicolumnscale ($statement_resource, $column_number) {}
+
+
+function ocicolumnprecision ($statement_resource, $column_number) {}
+
+
+function ocicolumntype ($statement_resource, $column_number) {}
+
+
+function ocicolumntyperaw ($statement_resource, $column_number) {}
+
+
+function ociexecute ($statement_resource, $mode = OCI_COMMIT_ON_SUCCESS) {}
+
+
+function ocicancel ($statement_resource) {}
+
+
+function ocifetch ($statement_resource) {}
+
+
+function ocifetchstatement ($statement_resource, &$output, $skip, $maximum_rows, $flags) {}
+
+
+function ocifreestatement ($statement_resource) {}
+
+
+function ociinternaldebug ($mode) {}
+
+
+function ocinumcols ($statement_resource) {}
+
+
+function ociparse ($connection_resource, $sql_text) {}
+
+
+function ocinewcursor ($connection_resource) {}
+
+
+function ociresult ($statement_resource, $column_number_or_name) {}
+
+
+function ociserverversion ($connection_resource) {}
+
+
+function ocistatementtype ($statement_resource) {}
+
+
+function ocirowcount ($statement_resource) {}
+
+
+function ocilogoff ($connection_resource) {}
+
+
+function ocilogon ($username, $password, $connection_string, $character_set, $session_mode) {}
+
+
+function ocinlogon ($username, $password, $connection_string, $character_set, $session_mode) {}
+
+
+function ociplogon ($username, $password, $connection_string, $character_set, $session_mode) {}
+
+
+function ocierror ($connection_or_statement_resource) {}
+
+
+function ocifreedesc ($lob_descriptor) {}
+
+
+function ocisavelob ($lob_descriptor, $data, $offset) {}
+
+
+function ocisavelobfile ($lob_descriptor, $filename) {}
+
+
+function ociwritelobtofile ($lob_descriptor, $filename, $start, $length) {}
+
+
+function ociloadlob ($lob_descriptor) {}
+
+
+function ocicommit ($connection_resource) {}
+
+
+function ocirollback ($connection_resource) {}
+
+
+function ocinewdescriptor ($connection_resource, $type = OCI_DTYPE_LOB) {}
+
+
+function ocisetprefetch ($statement_resource, $number_of_rows) {}
+
+
+function ocipasswordchange ($connection_resource_or_connection_string_or_dbname, $username, $old_password, $new_password) {}
+
+
+function ocifreecollection ($collection) {}
+
+
+function ocinewcollection ($connection_resource, $tdo, $schema = null) {}
+
+
+function ocicollappend ($collection, $value) {}
+
+
+function ocicollgetelem ($collection, $index) {}
+
+
+function ocicollassignelem ($collection, $index, $value) {}
+
+
+function ocicollsize ($collection) {}
+
+
+function ocicollmax ($collection) {}
+
+
+function ocicolltrim ($collection, $number) {}
+
+
+
+function ociwritetemporarylob($lob_descriptor, $data, $lob_type = OCI_TEMP_CLOB ) {}
+
+
+function ocicloselob($lob_descriptor){}
+
+
+function ocicollassign($to, $from ) {}
+
+define ('OCI_DEFAULT', 0);
+
+
+define ('OCI_SYSOPER', 4);
+
+
+define ('OCI_SYSDBA', 2);
+
+
+define ('OCI_CRED_EXT', -2147483648);
+
+
+define ('OCI_DESCRIBE_ONLY', 16);
+
+
+define ('OCI_COMMIT_ON_SUCCESS', 32);
+
+
+define ('OCI_NO_AUTO_COMMIT', 0);
+
+
+define ('OCI_EXACT_FETCH', 2);
+
+
+define ('OCI_SEEK_SET', 0);
+
+
+define ('OCI_SEEK_CUR', 1);
+
+
+define ('OCI_SEEK_END', 2);
+
+
+define ('OCI_LOB_BUFFER_FREE', 1);
+
+
+define ('SQLT_BFILEE', 114);
+
+
+define ('SQLT_CFILEE', 115);
+
+
+define ('SQLT_CLOB', 112);
+
+
+define ('SQLT_BLOB', 113);
+
+
+define ('SQLT_RDD', 104);
+
+
+define ('SQLT_INT', 3);
+
+
+define ('SQLT_NUM', 2);
+
+
+define ('SQLT_RSET', 116);
+
+
+define ('SQLT_AFC', 96);
+
+
+define ('SQLT_CHR', 1);
+
+
+define ('SQLT_VCS', 9);
+
+
+define ('SQLT_AVC', 97);
+
+
+define ('SQLT_STR', 5);
+
+
+define ('SQLT_LVC', 94);
+
+
+define ('SQLT_FLT', 4);
+
+
+define ('SQLT_UIN', 68);
+
+
+define ('SQLT_LNG', 8);
+
+
+define ('SQLT_LBI', 24);
+
+
+define ('SQLT_BIN', 23);
+
+
+define ('SQLT_ODT', 156);
+
+
+define ('SQLT_BDOUBLE', 22);
+
+
+define ('SQLT_BFLOAT', 21);
+
+
+define ('OCI_B_NTY', 108);
+
+
+define ('SQLT_NTY', 108);
+
+
+define ('OCI_SYSDATE', "SYSDATE");
+
+
+define ('OCI_B_BFILE', 114);
+
+
+define ('OCI_B_CFILEE', 115);
+
+
+define ('OCI_B_CLOB', 112);
+
+
+define ('OCI_B_BLOB', 113);
+
+
+define ('OCI_B_ROWID', 104);
+
+
+define ('OCI_B_CURSOR', 116);
+
+
+define ('OCI_B_BIN', 23);
+
+
+define ('OCI_B_INT', 3);
+
+
+define ('OCI_B_NUM', 2);
+
+
+define ('OCI_FETCHSTATEMENT_BY_COLUMN', 16);
+
+
+define ('OCI_FETCHSTATEMENT_BY_ROW', 32);
+
+
+define ('OCI_ASSOC', 1);
+
+
+define ('OCI_NUM', 2);
+
+
+define ('OCI_BOTH', 3);
+
+
+define ('OCI_RETURN_NULLS', 4);
+
+
+define ('OCI_RETURN_LOBS', 8);
+
+
+define ('OCI_DTYPE_FILE', 56);
+
+
+define ('OCI_DTYPE_LOB', 50);
+
+
+define ('OCI_DTYPE_ROWID', 54);
+
+
+define ('OCI_D_FILE', 56);
+
+
+define ('OCI_D_LOB', 50);
+
+
+define ('OCI_D_ROWID', 54);
+
+
+define ('OCI_TEMP_CLOB', 2);
+
+
+define ('OCI_TEMP_BLOB', 1);
+
+
+define ('SQLT_BOL', 252);
+
+
+define ('OCI_B_BOL', 252);
diff --git a/.phan/internal_stubs/sqlsrv.phan_php b/.phan/internal_stubs/sqlsrv.phan_php
new file mode 100644 (file)
index 0000000..3fea0af
--- /dev/null
@@ -0,0 +1,276 @@
+<?php
+// @phan-stub-for-extension sqlsrv@3.0.1
+
+define('SQLSRV_ERR_ERRORS', 0);
+
+
+define('SQLSRV_ERR_WARNINGS', 1);
+
+
+define('SQLSRV_ERR_ALL', 2);
+
+
+define('SQLSRV_LOG_SYSTEM_ALL',-1);
+
+
+define('SQLSRV_LOG_SYSTEM_OFF', 0);
+
+
+define('SQLSRV_LOG_SYSTEM_INIT', 1);
+
+
+define('SQLSRV_LOG_SYSTEM_CONN', 2);
+
+
+define('SQLSRV_LOG_SYSTEM_STMT', 4);
+
+
+define('SQLSRV_LOG_SYSTEM_UTIL', 8);
+
+
+define('SQLSRV_LOG_SEVERITY_ALL', -1);
+
+
+define('SQLSRV_LOG_SEVERITY_ERROR', 1);
+
+
+define('SQLSRV_LOG_SEVERITY_NOTICE', 4);
+
+
+define('SQLSRV_LOG_SEVERITY_WARNING', 2);
+
+
+define('SQLSRV_FETCH_NUMERIC', 1);
+
+
+define('SQLSRV_FETCH_ASSOC', 2);
+
+
+define('SQLSRV_FETCH_BOTH', 3);
+
+
+define('SQLSRV_PHPTYPE_NULL', 1);
+
+
+define('SQLSRV_PHPTYPE_INT', 2);
+
+
+define('SQLSRV_PHPTYPE_FLOAT', 3);
+
+
+define('SQLSRV_PHPTYPE_DATETIME', 4);
+
+
+define('SQLSRV_ENC_BINARY', 'binary');
+
+
+define('SQLSRV_ENC_CHAR','char');
+
+
+define('SQLSRV_NULLABLE_NO', 0);
+
+
+define('SQLSRV_NULLABLE_YES', 1);
+
+
+define('SQLSRV_NULLABLE_UNKNOWN', 2);
+
+
+define('SQLSRV_SQLTYPE_BIGINT', -5);
+
+define('SQLSRV_SQLTYPE_BIT', -7);
+
+define('SQLSRV_SQLTYPE_DATETIME', 25177693);
+
+define('SQLSRV_SQLTYPE_FLOAT', 6);
+
+define('SQLSRV_SQLTYPE_IMAGE', -4);
+
+define('SQLSRV_SQLTYPE_INT', 4);
+
+define('SQLSRV_SQLTYPE_MONEY', 33564163);
+
+define('SQLSRV_SQLTYPE_NTEXT', -10);
+
+define('SQLSRV_SQLTYPE_TEXT', -1);
+
+define('SQLSRV_SQLTYPE_REAL', 7);
+
+define('SQLSRV_SQLTYPE_SMALLDATETIME', 8285);
+
+define('SQLSRV_SQLTYPE_SMALLINT', 5);
+
+define('SQLSRV_SQLTYPE_SMALLMONEY', 33559555);
+
+define('SQLSRV_SQLTYPE_TIMESTAMP', 4606);
+
+define('SQLSRV_SQLTYPE_TINYINT', -6);
+
+define('SQLSRV_SQLTYPE_UDT', -151);
+
+define('SQLSRV_SQLTYPE_UNIQUEIDENTIFIER', -11);
+
+define('SQLSRV_SQLTYPE_XML', -152);
+
+define('SQLSRV_SQLTYPE_DATE', 5211);
+
+define('SQLSRV_SQLTYPE_TIME', 58728806);
+
+define('SQLSRV_SQLTYPE_DATETIMEOFFSET', 58738021);
+
+define('SQLSRV_SQLTYPE_DATETIME2', 58734173);
+
+
+define('SQLSRV_PARAM_IN', 1);
+
+
+define('SQLSRV_PARAM_INOUT', 2);
+
+
+define('SQLSRV_PARAM_OUT', 4);
+
+
+define('SQLSRV_TXN_READ_UNCOMMITTED', 1);
+
+define('SQLSRV_TXN_READ_COMMITTED', 2);
+
+define('SQLSRV_TXN_REPEATABLE_READ', 4);
+
+define('SQLSRV_TXN_SERIALIZABLE', 8);
+
+define('SQLSRV_TXN_SNAPSHOT', 32);
+
+
+define('SQLSRV_SCROLL_NEXT', 1);
+
+define('SQLSRV_SCROLL_PRIOR', 4);
+
+define('SQLSRV_SCROLL_FIRST', 2);
+
+define('SQLSRV_SCROLL_LAST', 3);
+
+define('SQLSRV_SCROLL_ABSOLUTE', 5);
+
+define('SQLSRV_SCROLL_RELATIVE', 6);
+
+
+define('SQLSRV_CURSOR_FORWARD', 'forward');
+
+define('SQLSRV_CURSOR_STATIC', 'static');
+
+define('SQLSRV_CURSOR_DYNAMIC', 'dynamic');
+
+define('SQLSRV_CURSOR_KEYSET', 'keyset');
+
+define('SQLSRV_CURSOR_CLIENT_BUFFERED', 'buffered');
+
+
+
+function sqlsrv_connect($server_name, $connection_info = array()){}
+
+
+function sqlsrv_close($conn){}
+
+
+function sqlsrv_commit($conn){}
+
+
+function sqlsrv_begin_transaction($conn){}
+
+
+function sqlsrv_rollback($conn){}
+
+
+function sqlsrv_errors($errorsAndOrWarnings = SQLSRV_ERR_ALL){}
+
+
+function sqlsrv_configure($setting, $value){}
+
+
+function sqlsrv_get_config($setting){}
+
+
+function sqlsrv_prepare($conn, $tsql, $params=array(), $options=array()){}
+
+
+function sqlsrv_execute($stmt){}
+
+
+function sqlsrv_query($conn, $tsql, $params=array(), $options=array()){}
+
+
+function sqlsrv_fetch($stmt, $row=null, $offset=null){}
+
+
+function sqlsrv_get_field($stmt, $field_index, $get_as_type){}
+
+
+function sqlsrv_fetch_array($stmt, $fetch_type = null, $row=null, $offset=null){}
+
+
+function sqlsrv_fetch_object($stmt, $class_name=null, $ctor_params=null, $row=null, $offset=null){}
+
+
+function sqlsrv_has_rows($stmt){}
+
+
+function sqlsrv_num_fields($stmt){}
+
+
+function sqlsrv_next_result($stmt){}
+
+
+function sqlsrv_num_rows($stmt){}
+
+
+function sqlsrv_rows_affected($stmt){}
+
+
+function sqlsrv_client_info($conn){}
+
+
+function sqlsrv_server_info($conn){}
+
+
+function sqlsrv_cancel($stmt){}
+
+
+function sqlsrv_free_stmt($stmt){}
+
+
+function sqlsrv_field_metadata($stmt){}
+
+
+function sqlsrv_send_stream_data($stmt){}
+
+
+function SQLSRV_PHPTYPE_STREAM($encoding){}
+
+
+function SQLSRV_PHPTYPE_STRING($encoding){}
+
+
+function SQLSRV_SQLTYPE_BINARY($byteCount){}
+
+
+function SQLSRV_SQLTYPE_VARBINARY($byteCount){}
+
+
+
+function SQLSRV_SQLTYPE_VARCHAR($charCount) {}
+
+
+function SQLSRV_SQLTYPE_CHAR($charCount){}
+
+
+function SQLSRV_SQLTYPE_NCHAR($charCount){}
+
+
+function SQLSRV_SQLTYPE_NVARCHAR($charCount){}
+
+
+function SQLSRV_SQLTYPE_DECIMAL($precision, $scale){}
+
+
+function SQLSRV_SQLTYPE_NUMERIC($precision, $scale){}
+
diff --git a/.phan/internal_stubs/tideways.phan_php b/.phan/internal_stubs/tideways.phan_php
new file mode 100644 (file)
index 0000000..d87a6e4
--- /dev/null
@@ -0,0 +1,28 @@
+<?php
+// These stubs were generated by the phan stub generator.
+// @phan-stub-for-extension tideways@4.0.7
+
+namespace {
+function tideways_disable() {}
+function tideways_enable($flags = null, $options = null) {}
+function tideways_fatal_backtrace() {}
+function tideways_get_spans() {}
+function tideways_last_detected_exception() {}
+function tideways_last_fatal_error() {}
+function tideways_prepend_overwritten() {}
+function tideways_span_annotate($span = null, $annotations = null) {}
+function tideways_span_callback($name = null, $callback = null) {}
+function tideways_span_create($category = null) {}
+function tideways_span_timer_start($span = null) {}
+function tideways_span_timer_stop($span = null) {}
+function tideways_span_watch($name = null, $category = null) {}
+function tideways_sql_minify($sql = null) {}
+function tideways_transaction_name() {}
+const TIDEWAYS_FLAGS_CPU = 2;
+const TIDEWAYS_FLAGS_MEMORY = 4;
+const TIDEWAYS_FLAGS_NO_BUILTINS = 1;
+const TIDEWAYS_FLAGS_NO_COMPILE = 16;
+const TIDEWAYS_FLAGS_NO_HIERACHICAL = 64;
+const TIDEWAYS_FLAGS_NO_SPANS = 32;
+const TIDEWAYS_FLAGS_NO_USERLAND = 8;
+}
diff --git a/.phan/stubs/README b/.phan/stubs/README
new file mode 100644 (file)
index 0000000..c458ab5
--- /dev/null
@@ -0,0 +1,3 @@
+These stubs describe how code that is not available at analysis time should be
+used. No implementations are necessary, just define the classes and their
+methods and use phpdoc to describe what arguments are allowed.
diff --git a/.phan/stubs/excimer.php b/.phan/stubs/excimer.php
new file mode 100644 (file)
index 0000000..e87d4cd
--- /dev/null
@@ -0,0 +1,89 @@
+<?php
+
+// phpcs:ignoreFile
+
+define( 'EXCIMER_REAL', 0 );
+define( 'EXCIMER_CPU', 1 );
+
+class ExcimerProfiler {
+       public function __construct() {
+       }
+       public function setPeriod( $period ) {
+       }
+       public function setEventType( $event_type ) {
+       }
+       public function setMaxDepth( $maxDepth ) {
+       }
+       public function setFlushCallback( $callback, $max_samples ) {
+       }
+       public function clearFlushCallback() {
+       }
+       public function start() {
+       }
+       public function stop() {
+       }
+       public function getLog() {
+       }
+       public function flush() {
+       }
+}
+
+class ExcimerLog {
+       private final function __construct() {
+       }
+       function formatCollapsed() {
+       }
+       function aggregateByFunction() {
+       }
+       function getEventCount() {
+       }
+       function current() {
+       }
+       function key() {
+       }
+       function next() {
+       }
+       function rewind() {
+       }
+       function valid() {
+       }
+       function count() {
+       }
+       function offsetExists( $offset ) {
+       }
+       function offsetGet( $offset ) {
+       }
+       function offsetSet( $offset, $value ) {
+       }
+       function offsetUnset( $offset ) {
+       }
+
+}
+
+class ExcimerLogEntry {
+       private final function __construct() {
+       }
+       function getTimestamp() {
+       }
+       function getEventCount() {
+       }
+       function getTrace() {
+       }
+}
+
+class ExcimerTimer {
+       function setEventType( $event_type ) {
+       }
+       function setInterval( $interval ) {
+       }
+       function setPeriod( $period ) {
+       }
+       function setCallback( $callback ) {
+       }
+       function start() {
+       }
+       function stop() {
+       }
+       function getTime() {
+       }
+}
diff --git a/.phan/stubs/hhvm.php b/.phan/stubs/hhvm.php
new file mode 100644 (file)
index 0000000..090bdfe
--- /dev/null
@@ -0,0 +1,28 @@
+<?php
+/**
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+// phpcs:ignoreFile
+
+define( 'HHVM_VERSION', '3.18.6-dev' );
+
+/**
+ * @param callable $callback
+ * @param mixed ...$parameters
+ */
+function register_postsend_function( $callback ) {
+}
diff --git a/.phan/stubs/mail.php b/.phan/stubs/mail.php
new file mode 100644 (file)
index 0000000..ba1efb9
--- /dev/null
@@ -0,0 +1,89 @@
+<?php
+
+/**
+ * Minimal set of classes necessary for UserMailer to be happy. Types
+ * taken from documentation at pear.php.net.
+ * phpcs:ignoreFile
+ */
+
+class PEAR {
+       /**
+        * @param mixed $data
+        * @return bool
+        */
+       public static function isError( $data ) {
+       }
+}
+
+class PEAR_Error {
+       /**
+        * @return string
+        */
+       public function getMessage() {
+       }
+}
+
+class Mail {
+       /**
+        * @param string $driver
+        * @param array $params
+        * @return self
+        */
+       static public function factory( $driver, array $params = [] ) {
+       }
+
+       /**
+        * @param mixed $recipients
+        * @param array $headers
+        * @param string $body
+        * @return bool|PEAR_Error
+        */
+       public function send( $recipients, array $headers, $body ) {
+       }
+}
+
+class Mail_smtp extends Mail {
+}
+
+class Mail_mime {
+       /**
+        * @param mixed $params
+        */
+       public function __construct( $params = [] ) {
+       }
+
+       /**
+        * @param string $data
+        * @param bool $isfile
+        * @param bool $append
+        * @return bool|PEAR_Error
+        */
+       public function setTXTBody( $data, $isfile = false, $append = false ) {
+       }
+
+       /**
+        * @param string $data
+        * @param bool $isfile
+        * @return bool|PEAR_Error
+        */
+       public function setHTMLBody( $data, $isfile = false ) {
+       }
+
+       /**
+        * @param array|null $parms
+        * @param mixed $filename
+        * @param bool $skip_head
+        * @return string|bool|PEAR_Error
+        */
+       public function get( $params = null, $filename = null, $skip_head = false ) {
+       }
+
+       /**
+        * @param array|null $xtra_headers
+        * @param bool $overwrite
+        * @param bool $skip_content
+        * @return array
+        */
+       public function headers( array $xtra_headers = null, $overwrite = false, $skip_content = false ) {
+       }
+}
diff --git a/.phan/stubs/password.php b/.phan/stubs/password.php
new file mode 100644 (file)
index 0000000..dd9cba4
--- /dev/null
@@ -0,0 +1,11 @@
+<?php
+// phpcs:ignoreFile
+
+// Password constants added in PHP 7.2 & 7.3
+
+const PASSWORD_ARGON2I = 2;
+const PASSWORD_ARGON2ID = 3;
+const PASSWORD_ARGON2_DEFAULT_MEMORY_COST = 1024;
+const PASSWORD_ARGON2_DEFAULT_THREADS = 2;
+const PASSWORD_ARGON2_DEFAULT_TIME_COST = 2;
+
diff --git a/.phan/stubs/phpunit4.php b/.phan/stubs/phpunit4.php
new file mode 100644 (file)
index 0000000..e5e88e6
--- /dev/null
@@ -0,0 +1,11 @@
+<?php
+
+/**
+ * Some old classes from PHPUnit 4 that MediaWiki (conditionally) references.
+ *
+ * phpcs:ignoreFile
+ */
+
+class PHPUnit_TextUI_Command {
+
+}
diff --git a/.phan/stubs/wikidiff.php b/.phan/stubs/wikidiff.php
new file mode 100644 (file)
index 0000000..02bcd1f
--- /dev/null
@@ -0,0 +1,39 @@
+<?php
+/**
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+// phpcs:ignoreFile
+
+/**
+ * @param string $text1
+ * @param string $text2
+ * @param int $numContextLines
+ * @param int $movedParagraphDetectionCutoff
+ * @return string
+ */
+function wikidiff2_do_diff( $text1, $text2, $numContextLines, $movedParagraphDetectionCutoff = 0 ) {
+}
+
+/**
+ * @param string $text1
+ * @param string $text2
+ * @param int $numContextLines
+ * @param int $maxMovedLines
+ * @return string
+ */
+function wikidiff2_inline_diff( $text1, $text2, $numContextLines, $maxMovedLines = 25 ) {
+}
index 1fe79cd..e80eb34 100644 (file)
@@ -64,7 +64,6 @@
                "hamcrest/hamcrest-php": "^2.0",
                "jakub-onderka/php-console-highlighter": "0.3.2",
                "jakub-onderka/php-parallel-lint": "0.9.2",
-               "jetbrains/phpstorm-stubs": "dev-master#38ff1a581b297f7901e961b8c923862ea80c3b96",
                "justinrainbow/json-schema": "~5.2",
                "mediawiki/mediawiki-codesniffer": "24.0.0",
                "monolog/monolog": "~1.22.1",
@@ -76,7 +75,7 @@
                "wikimedia/avro": "1.8.0",
                "wikimedia/testing-access-wrapper": "~1.0",
                "wmde/hamcrest-html-matchers": "^0.1.0",
-               "mediawiki/mediawiki-phan-config": "0.3.0"
+               "mediawiki/mediawiki-phan-config": "0.5.0"
        },
        "replace": {
                "symfony/polyfill-ctype": "1.99",
index 1d00d19..8df8013 100644 (file)
@@ -536,7 +536,6 @@ class LocalisationCache {
                        }
                } elseif ( $_fileType == 'aliases' ) {
                        if ( isset( $aliases ) ) {
-                               /** @suppress PhanUndeclaredVariable */
                                $data['aliases'] = $aliases;
                        }
                } else {
index 0bc0a83..a954008 100644 (file)
@@ -1501,7 +1501,7 @@ abstract class Installer {
                $data = $registry->readFromQueue( $queue );
                $wgAutoloadClasses += $data['autoload'];
 
-               /** @suppress PhanUndeclaredVariable $wgHooks is set by DefaultSettings */
+               // @phan-suppress-next-line PhanUndeclaredVariable $wgHooks is set by DefaultSettings
                $hooksWeWant = $wgHooks['LoadExtensionSchemaUpdates'] ?? [];
 
                if ( isset( $data['globals']['wgHooks']['LoadExtensionSchemaUpdates'] ) ) {
index 655a710..9524155 100644 (file)
@@ -87,9 +87,6 @@ class FileBackendMultiWrite extends FileBackend {
         *                      This will apply such updates post-send for web requests. Note that
         *                      any checks from "syncChecks" are still synchronous.
         *
-        * Bogus warning
-        * @suppress PhanAccessMethodProtected
-        *
         * @param array $config
         * @throws FileBackendError
         */
diff --git a/tests/phan/config.php b/tests/phan/config.php
deleted file mode 100644 (file)
index a4654c3..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-<?php
-/**
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- */
-
-$cfg = require __DIR__ . '/../../vendor/mediawiki/mediawiki-phan-config/src/config.php';
-
-$cfg['file_list'] = array_merge(
-       $cfg['file_list'],
-       function_exists( 'register_postsend_function' ) ? [] : [ 'tests/phan/stubs/hhvm.php' ],
-       function_exists( 'wikidiff2_do_diff' ) ? [] : [ 'tests/phan/stubs/wikidiff.php' ],
-       function_exists( 'tideways_enable' ) ? [] : [ 'tests/phan/stubs/tideways.php' ],
-       class_exists( PEAR::class ) ? [] : [ 'tests/phan/stubs/mail.php' ],
-       class_exists( Memcached::class ) ? [] : [ 'tests/phan/stubs/memcached.php' ],
-       // Per composer.json, PHPUnit 6 is used for PHP 7.0+, PHPUnit 4 otherwise.
-       // Load the interface for the version of PHPUnit that isn't installed.
-       // Phan only supports PHP 7.0+ (and not HHVM), so we only need to stub PHPUnit 4.
-       class_exists( PHPUnit_TextUI_Command::class ) ? [] : [ 'tests/phan/stubs/phpunit4.php' ],
-       class_exists( ProfilerExcimer::class ) ? [] : [ 'tests/phan/stubs/excimer.php' ],
-       [
-               'maintenance/7zip.inc',
-               'maintenance/cleanupTable.inc',
-               'maintenance/CodeCleanerGlobalsPass.inc',
-               'maintenance/commandLine.inc',
-               'maintenance/sqlite.inc',
-               'maintenance/userDupes.inc',
-               'maintenance/language/checkLanguage.inc',
-               'maintenance/language/languages.inc',
-       ]
-);
-
-$cfg['directory_list'] = [
-       'includes/',
-       'languages/',
-       'maintenance/',
-       'mw-config/',
-       'resources/',
-       'vendor/',
-];
-
-$cfg['exclude_analysis_directory_list'] = [
-       'vendor/',
-       'tests/phan/stubs/',
-       // The referenced classes are not available in vendor, only when
-       // included from composer.
-       'includes/composer/',
-       // Directly references classes that only exist in Translate extension
-       'maintenance/language/',
-       // External class
-       'includes/libs/jsminplus.php',
-];
-
-$cfg['suppress_issue_types'] = array_merge( $cfg['suppress_issue_types'], [
-       // approximate error count: 29
-       "PhanCommentParamOnEmptyParamList",
-       // approximate error count: 33
-       "PhanCommentParamWithoutRealParam",
-       // approximate error count: 17
-       "PhanNonClassMethodCall",
-       // approximate error count: 888
-       "PhanParamSignatureMismatch",
-       // approximate error count: 7
-       "PhanParamSignatureMismatchInternal",
-       // approximate error count: 1
-       "PhanParamSignatureRealMismatchTooFewParameters",
-       // approximate error count: 125
-       "PhanParamTooMany",
-       // approximate error count: 3
-       "PhanParamTooManyInternal",
-       // approximate error count: 2
-       "PhanTraitParentReference",
-       // approximate error count: 3
-       "PhanTypeComparisonFromArray",
-       // approximate error count: 2
-       "PhanTypeComparisonToArray",
-       // approximate error count: 218
-       "PhanTypeMismatchArgument",
-       // approximate error count: 13
-       "PhanTypeMismatchArgumentInternal",
-       // approximate error count: 5
-       "PhanTypeMismatchDimAssignment",
-       // approximate error count: 2
-       "PhanTypeMismatchDimEmpty",
-       // approximate error count: 1
-       "PhanTypeMismatchDimFetch",
-       // approximate error count: 14
-       "PhanTypeMismatchForeach",
-       // approximate error count: 56
-       "PhanTypeMismatchProperty",
-       // approximate error count: 74
-       "PhanTypeMismatchReturn",
-       // approximate error count: 5
-       "PhanTypeNonVarPassByRef",
-       // approximate error count: 32
-       "PhanUndeclaredConstant",
-       // approximate error count: 233
-       "PhanUndeclaredMethod",
-       // approximate error count: 1224
-       "PhanUndeclaredProperty",
-       // approximate error count: 58
-       "PhanUndeclaredVariableDim",
-] );
-
-$cfg['ignore_undeclared_variables_in_global_scope'] = true;
-$cfg['globals_type_map']['IP'] = 'string';
-
-return $cfg;
diff --git a/tests/phan/stubs/README b/tests/phan/stubs/README
deleted file mode 100644 (file)
index c458ab5..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-These stubs describe how code that is not available at analysis time should be
-used. No implementations are necessary, just define the classes and their
-methods and use phpdoc to describe what arguments are allowed.
diff --git a/tests/phan/stubs/excimer.php b/tests/phan/stubs/excimer.php
deleted file mode 100644 (file)
index af3a673..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-<?php
-
-// phpcs:ignoreFile
-
-class ExcimerProfiler {
-       public function __construct() {
-       }
-       public function setPeriod( $period ) {
-       }
-       public function setEventType( $event_type ) {
-       }
-       public function setMaxDepth( $maxDepth ) {
-       }
-       public function setFlushCallback( $callback, $max_samples ) {
-       }
-       public function clearFlushCallback() {
-       }
-       public function start() {
-       }
-       public function stop() {
-       }
-       public function getLog() {
-       }
-       public function flush() {
-       }
-}
-
-class ExcimerLog {
-       private final function __construct() {
-       }
-       function formatCollapsed() {
-       }
-       function aggregateByFunction() {
-       }
-       function getEventCount() {
-       }
-       function current() {
-       }
-       function key() {
-       }
-       function next() {
-       }
-       function rewind() {
-       }
-       function valid() {
-       }
-       function count() {
-       }
-       function offsetExists( $offset ) {
-       }
-       function offsetGet( $offset ) {
-       }
-       function offsetSet( $offset, $value ) {
-       }
-       function offsetUnset( $offset ) {
-       }
-
-}
-
-class ExcimerLogEntry {
-       private final function __construct() {
-       }
-       function getTimestamp() {
-       }
-       function getEventCount() {
-       }
-       function getTrace() {
-       }
-}
-
-class ExcimerTimer {
-       function setEventType( $event_type ) {
-       }
-       function setInterval( $interval ) {
-       }
-       function setPeriod( $period ) {
-       }
-       function setCallback( $callback ) {
-       }
-       function start() {
-       }
-       function stop() {
-       }
-       function getTime() {
-       }
-}
diff --git a/tests/phan/stubs/hhvm.php b/tests/phan/stubs/hhvm.php
deleted file mode 100644 (file)
index 364ebda..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-<?php
-/**
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- */
-
-// phpcs:ignoreFile
-
-/**
- * @param callable $callback
- * @param mixed ...$parameters
- */
-function register_postsend_function( $callback ) {
-}
diff --git a/tests/phan/stubs/mail.php b/tests/phan/stubs/mail.php
deleted file mode 100644 (file)
index ba1efb9..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-<?php
-
-/**
- * Minimal set of classes necessary for UserMailer to be happy. Types
- * taken from documentation at pear.php.net.
- * phpcs:ignoreFile
- */
-
-class PEAR {
-       /**
-        * @param mixed $data
-        * @return bool
-        */
-       public static function isError( $data ) {
-       }
-}
-
-class PEAR_Error {
-       /**
-        * @return string
-        */
-       public function getMessage() {
-       }
-}
-
-class Mail {
-       /**
-        * @param string $driver
-        * @param array $params
-        * @return self
-        */
-       static public function factory( $driver, array $params = [] ) {
-       }
-
-       /**
-        * @param mixed $recipients
-        * @param array $headers
-        * @param string $body
-        * @return bool|PEAR_Error
-        */
-       public function send( $recipients, array $headers, $body ) {
-       }
-}
-
-class Mail_smtp extends Mail {
-}
-
-class Mail_mime {
-       /**
-        * @param mixed $params
-        */
-       public function __construct( $params = [] ) {
-       }
-
-       /**
-        * @param string $data
-        * @param bool $isfile
-        * @param bool $append
-        * @return bool|PEAR_Error
-        */
-       public function setTXTBody( $data, $isfile = false, $append = false ) {
-       }
-
-       /**
-        * @param string $data
-        * @param bool $isfile
-        * @return bool|PEAR_Error
-        */
-       public function setHTMLBody( $data, $isfile = false ) {
-       }
-
-       /**
-        * @param array|null $parms
-        * @param mixed $filename
-        * @param bool $skip_head
-        * @return string|bool|PEAR_Error
-        */
-       public function get( $params = null, $filename = null, $skip_head = false ) {
-       }
-
-       /**
-        * @param array|null $xtra_headers
-        * @param bool $overwrite
-        * @param bool $skip_content
-        * @return array
-        */
-       public function headers( array $xtra_headers = null, $overwrite = false, $skip_content = false ) {
-       }
-}
diff --git a/tests/phan/stubs/memcached.php b/tests/phan/stubs/memcached.php
deleted file mode 100644 (file)
index 0f8859d..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
-
-/**
- * The phpstorm stubs package includes the Memcached class with two parameters and docs saying
- * that they are optional. Phan can not detect this and thus throws an error for a usage with
- * no params. So we have this small stub just for the constructor to allow no params.
- * @see https://secure.php.net/manual/en/memcached.construct.php
- * phpcs:ignoreFile
- */
-
-class Memcached {
-
-       public function __construct() {
-       }
-
-}
diff --git a/tests/phan/stubs/phpunit4.php b/tests/phan/stubs/phpunit4.php
deleted file mode 100644 (file)
index e5e88e6..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<?php
-
-/**
- * Some old classes from PHPUnit 4 that MediaWiki (conditionally) references.
- *
- * phpcs:ignoreFile
- */
-
-class PHPUnit_TextUI_Command {
-
-}
diff --git a/tests/phan/stubs/tideways.php b/tests/phan/stubs/tideways.php
deleted file mode 100644 (file)
index 34ac735..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-<?php
-
-/**
- * Minimal set of classes necessary for Xhprof using tideways
- * phpcs:ignoreFile
- */
-
-function tideways_enable(){
-}
-
-function tideways_disable(){
-}
diff --git a/tests/phan/stubs/wikidiff.php b/tests/phan/stubs/wikidiff.php
deleted file mode 100644 (file)
index 02bcd1f..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php
-/**
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- */
-
-// phpcs:ignoreFile
-
-/**
- * @param string $text1
- * @param string $text2
- * @param int $numContextLines
- * @param int $movedParagraphDetectionCutoff
- * @return string
- */
-function wikidiff2_do_diff( $text1, $text2, $numContextLines, $movedParagraphDetectionCutoff = 0 ) {
-}
-
-/**
- * @param string $text1
- * @param string $text2
- * @param int $numContextLines
- * @param int $maxMovedLines
- * @return string
- */
-function wikidiff2_inline_diff( $text1, $text2, $numContextLines, $maxMovedLines = 25 ) {
-}