Addshore has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/399635 )

Change subject: Stop MediaWikiTestCase defition appearing for IDEs
......................................................................

Stop MediaWikiTestCase defition appearing for IDEs

This has been annoying me for a while now.
As I have core and all extensions checked out, my IDE
detects this defition of MediaWikiTestCase as the first,
and as a result all of my typhinting for the actual class
is off.

This patch uses a class alias instead of defining a class and
wraps that in a call_user_func to hide it from IDEs

Change-Id: Iadb86b051da707fa6d6ecee8b7ffe38bd87fff63
---
M tests/phpunit/MediaWikiFarmTestCase.php
1 file changed, 8 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MediaWikiFarm 
refs/changes/35/399635/1

diff --git a/tests/phpunit/MediaWikiFarmTestCase.php 
b/tests/phpunit/MediaWikiFarmTestCase.php
index b73f675..2f7f430 100644
--- a/tests/phpunit/MediaWikiFarmTestCase.php
+++ b/tests/phpunit/MediaWikiFarmTestCase.php
@@ -23,9 +23,11 @@
                /**
                 * Placeholder for MediaWikiTestCase when standalone PHPUnit is 
executed.
                 *
-                * @package MediaWiki\Tests
+                * Use a class alias instead of creating a new 
MediaWikiTestCase.
+                * Wrap the alias in a call_user_func call to avoid making IDEs 
think this is the main
+                * MediaWikiTestCase definition.
                 */
-               class MediaWikiTestCase extends PHPUnit\Framework\TestCase {}
+               call_user_func( 'class_alias', 
PHPUnit\Framework\TestCase::class, 'MediaWikiTestCase' );
        }
 
        # PHPUnit < 6.0
@@ -34,9 +36,11 @@
                /**
                 * Placeholder for MediaWikiTestCase when standalone PHPUnit is 
executed.
                 *
-                * @package MediaWiki\Tests
+                * Use a class alias instead of creating a new 
MediaWikiTestCase.
+                * Wrap the alias in a call_user_func call to avoid making IDEs 
think this is the main
+                * MediaWikiTestCase definition.
                 */
-               class MediaWikiTestCase extends PHPUnit_Framework_TestCase {} 
// @codingStandardsIgnoreLine Generic.Classes.DuplicateClassName.Found
+               call_user_func( 'class_alias', 
PHPUnit_Framework_TestCase::class, 'MediaWikiTestCase' );
        }
 }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/399635
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iadb86b051da707fa6d6ecee8b7ffe38bd87fff63
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MediaWikiFarm
Gerrit-Branch: master
Gerrit-Owner: Addshore <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to