summaryrefslogtreecommitdiff
path: root/www/wiki/tests/phan/stubs
diff options
context:
space:
mode:
Diffstat (limited to 'www/wiki/tests/phan/stubs')
-rw-r--r--www/wiki/tests/phan/stubs/README3
-rw-r--r--www/wiki/tests/phan/stubs/hhvm.php26
-rw-r--r--www/wiki/tests/phan/stubs/mail.php89
-rw-r--r--www/wiki/tests/phan/stubs/memcached.php16
-rw-r--r--www/wiki/tests/phan/stubs/phpunit4.php11
-rw-r--r--www/wiki/tests/phan/stubs/tideways.php12
-rw-r--r--www/wiki/tests/phan/stubs/wikidiff.php39
7 files changed, 196 insertions, 0 deletions
diff --git a/www/wiki/tests/phan/stubs/README b/www/wiki/tests/phan/stubs/README
new file mode 100644
index 00000000..c458ab58
--- /dev/null
+++ b/www/wiki/tests/phan/stubs/README
@@ -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/www/wiki/tests/phan/stubs/hhvm.php b/www/wiki/tests/phan/stubs/hhvm.php
new file mode 100644
index 00000000..364ebdaa
--- /dev/null
+++ b/www/wiki/tests/phan/stubs/hhvm.php
@@ -0,0 +1,26 @@
+<?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/www/wiki/tests/phan/stubs/mail.php b/www/wiki/tests/phan/stubs/mail.php
new file mode 100644
index 00000000..ba1efb96
--- /dev/null
+++ b/www/wiki/tests/phan/stubs/mail.php
@@ -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/www/wiki/tests/phan/stubs/memcached.php b/www/wiki/tests/phan/stubs/memcached.php
new file mode 100644
index 00000000..0f8859d2
--- /dev/null
+++ b/www/wiki/tests/phan/stubs/memcached.php
@@ -0,0 +1,16 @@
+<?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/www/wiki/tests/phan/stubs/phpunit4.php b/www/wiki/tests/phan/stubs/phpunit4.php
new file mode 100644
index 00000000..e5e88e6b
--- /dev/null
+++ b/www/wiki/tests/phan/stubs/phpunit4.php
@@ -0,0 +1,11 @@
+<?php
+
+/**
+ * Some old classes from PHPUnit 4 that MediaWiki (conditionally) references.
+ *
+ * phpcs:ignoreFile
+ */
+
+class PHPUnit_TextUI_Command {
+
+}
diff --git a/www/wiki/tests/phan/stubs/tideways.php b/www/wiki/tests/phan/stubs/tideways.php
new file mode 100644
index 00000000..34ac735c
--- /dev/null
+++ b/www/wiki/tests/phan/stubs/tideways.php
@@ -0,0 +1,12 @@
+<?php
+
+/**
+ * Minimal set of classes necessary for Xhprof using tideways
+ * phpcs:ignoreFile
+ */
+
+function tideways_enable(){
+}
+
+function tideways_disable(){
+}
diff --git a/www/wiki/tests/phan/stubs/wikidiff.php b/www/wiki/tests/phan/stubs/wikidiff.php
new file mode 100644
index 00000000..02bcd1fb
--- /dev/null
+++ b/www/wiki/tests/phan/stubs/wikidiff.php
@@ -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 ) {
+}