PHAN: load stubs from phpstorm-stubs library
authoraddshore <addshorewiki@gmail.com>
Thu, 26 Jan 2017 15:49:04 +0000 (16:49 +0100)
committerHashar <hashar@free.fr>
Mon, 30 Jan 2017 16:25:47 +0000 (16:25 +0000)
Also add a single small stub for the Memcached class
constructor that is slightly wrong in the phpstorm
stubs library.

jetbrains/phpstorm-stubs has been added to packagist via:
https://github.com/JetBrains/phpstorm-stubs/pull/149

Change-Id: I1bca7390d1dc24c38d65c1c8968f356326ff4636

composer.json
tests/phan/config.php
tests/phan/stubs/memcached.php [new file with mode: 0644]

index e825152..d762bae 100644 (file)
@@ -50,6 +50,7 @@
                "jakub-onderka/php-parallel-lint": "0.9.2",
                "justinrainbow/json-schema": "~3.0",
                "mediawiki/mediawiki-codesniffer": "0.7.2",
+               "jetbrains/phpstorm-stubs": "dev-master",
                "monolog/monolog": "~1.18.2",
                "nikic/php-parser": "2.1.0",
                "nmred/kafka-php": "0.1.5",
index 19469d9..39b2fa1 100644 (file)
@@ -38,6 +38,7 @@ return [
                function_exists( 'register_postsend_function' ) ? [] : [ 'tests/phan/stubs/hhvm.php' ],
                function_exists( 'wikidiff2_do_diff' ) ? [] : [ 'tests/phan/stubs/wikidiff.php' ],
                class_exists( PEAR::class ) ? [] : [ 'tests/phan/stubs/mail.php' ],
+               class_exists( Memcached::class ) ? [] : [ 'tests/phan/stubs/memcached.php' ],
                [
                        'maintenance/7zip.inc',
                        'maintenance/backupPrefetch.inc',
@@ -79,10 +80,7 @@ return [
         * This is useful for excluding hopelessly unanalyzable
         * files that can't be removed for whatever reason.
         */
-       'exclude_file_list' => function_exists( 'xcache_get' ) ? [] : [
-               // References xcache which probably isn't installed
-               'includes/libs/objectcache/XCacheBagOStuff.php'
-       ],
+       'exclude_file_list' => [],
 
        /**
         * A list of directories holding code that we want
diff --git a/tests/phan/stubs/memcached.php b/tests/phan/stubs/memcached.php
new file mode 100644 (file)
index 0000000..ee47937
--- /dev/null
@@ -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
+ * @codingStandardsIgnoreFile
+ */
+
+class Memcached {
+
+       public function __construct() {
+       }
+
+}