aboutsummaryrefslogtreecommitdiffstats
path: root/includes/StubObject.php
Commit message (Collapse)AuthorAgeFilesLines
* Use updated ObjectFactory namespaceAlexander Vorwerk2022-03-091-1/+1
| | | | | | | Depends-On: I99c5e5664d2401c36a9890f148eba7c25e6e8324 Depends-On: I48ab818b2965da14af15ef370aa83ad9455badd9 Depends-On: I018371e4b77911e56152ca7b2df734afc73f58a5 Change-Id: I04ebdb52102f6191d49a9cc70b1f98308299e72f
* StubObject: add magic __get() and __set()DannyS7122021-09-041-0/+44
| | | | | | | | | | | | | | We will soon be converting $wgUser to be a stub object wrapping a User, and we want to be able to access the public properties of that object (doing so will still trigger deprecation warnings, but it won't break). This will also work for non-existent properties that are handled via the __get() and __set() methods of whatever inner object the StubObject is wrapping. Bug: T267861 Change-Id: I4c29c615bcb107d4ef8bf4b8e48db2ecf863e5f7
* Improve documentation about object to be stdClass or specific typeUmherirrender2020-11-201-0/+4
| | | | | | Some classes still needs exclude for the sniff Change-Id: I9536c2ee84f6fb4c83cf862a152cf6b00344cb97
* Upgrade wikimedia/object-factory from 2.1.0 to 3.0.0James D. Forrester2020-11-171-0/+3
| | | | | | Bug: T267074 Change-Id: Ic9cf63249744cd61bbe238c005630fc82db41d41 Depends-On: I2eac3e96eafdb540824bbc3ddc0b6cc1aed76bf2
* Replace "@stable for calling" by "@stable to call"daniel2020-07-131-1/+1
| | | | | | | | | | | For compliance with the new version of the table interface policy (T255803). This patch was created by an automated search & replace operation on the includes/ directory. Bug: T257789 Change-Id: If560596f5e1e0a3da91afc36e656e7c27f040968
* Annotate newable classesdaniel2020-07-071-0/+4
| | | | | | | | This annotates classes that can safely be instantiated by extensions, per the Stable Interface Policy. Bug: T247862 Change-Id: Ia280f559874fc0750265ddeb7f831e65fd7d7d6a
* Remove terminating line breaks from debug messagesTim Starling2020-06-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | A terminating line break has not been required in wfDebug() since 2014, however no migration was done. Some of these line breaks found their way into LoggerInterface::debug() calls, where they mess up the formatting of the debug log. So, remove terminating line breaks from wfDebug() and LoggerInterface::debug() calls. Also: * Fix the stripping of leading line breaks from the log header emitted by Setup.php. This feature, accidentally broken in 2014, allows requests to be distinguished in the log file. * Avoid using the global variable $self. * Move the logging of the client IP back to Setup.php. It was moved to WebRequest in the hopes that it would not always be needed, however $wgRequest->getIP() is now called unconditionally a few lines up in Setup.php. This means that it is put in its proper place after the "start request" message. * Wrap the log header code in a closure so that variables like $name do not leak into global scope. * In Linker.php, remove a few instances of an unnecessary second parameter to wfDebug(). Change-Id: I96651d3044a95b9d210b51cb8368edc76bebbb9e
* StubObject: Use 'self' instead of 'StubObject' (or <ClassName>)Derick Alangi2019-04-171-3/+3
| | | | | | | | 'self' is only 4 chars (shorter to type) and reduces risk (if class name is changed) which is very unlikely to break things. PHP replaces self with the actual class name. Plus we're already using this in our code base. Change-Id: Ia565ab2e4258d0ac201b14b712d1bc3bfe4e4d94
* Split StubObject.php to have one class in one fileZoranzoki212019-04-141-35/+0
| | | | Change-Id: If00625b700962a1c6d6412c6de30c28fa3df9f81
* Fix PhanTypeMismatchDeclaredParamUmherirrender2018-07-071-2/+2
| | | | | | Auto fix MediaWiki.Commenting.FunctionComment.DefaultNullTypeParam sniff Change-Id: I865323fd0295aabd06f3e3c75e0e5043fb31069e
* Use wikimedia/object-factory 1.0.0Kunal Mehta2018-02-041-0/+1
| | | | | | | | Deprecate the unnamespaced version and move it to includes/compat. Bug: T147167 Depends-On: I39c805bfb98b32f32f3d0dc1eee9e823afe1c21a Change-Id: I3780c7adf51683f3f7adb35a88f9a25a0a2e2530
* Add missing & to @param documentation to match functon callUmherirrender2017-08-111-1/+1
| | | | Change-Id: I81e68310abcbc59964b22e0e74842d509f6b1fb9
* Remove auto-generated "Constructor" documentation on constructorsThiemo Mättig2017-07-101-2/+0
| | | | | | | | Having such comments is worse than not having them. They add zero information. But you must read the text to understand there is nothing you don't already know from the class and the method name. Change-Id: I994d11e05f202b880390723e148d79c72cca29f0
* StubObject: Allow using a factory function to construct the objectKunal Mehta2016-08-171-4/+14
| | | | | | | If $class is a callable, then assume it is a factory function, and pass that onto ObjectFactory. Change-Id: I20c3650843c2803e0f9521d67bb037abfc28e1d9
* Remove unused $fname in StubObject::_unstubaddshore2016-04-031-1/+0
| | | | Change-Id: I1a90d888b1b17e21b54b90f3665c63edd1f21195
* StubObject: Remove redundant _call() method in StubUserLangTimo Tijhof2016-03-091-7/+1
| | | | | | Already exists the same way in the base class. Change-Id: If6c89cf42f11655ea45a1d6e1660f6e5e2593169
* Convert all array() syntax to []Kunal Mehta2016-02-171-4/+4
| | | | | | | | | | Per wikitech-l consensus: https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html Notes: * Disabled CallTimePassByReference due to false positives (T127163) Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
* Remove return of void method resultsjeroendedauw2015-09-101-1/+1
| | | | Change-Id: I095ba37ceb150fcb7bee9df80201437c78426938
* Removed remaining profile callsAaron Schulz2015-01-081-3/+0
| | | | Change-Id: I31c81c78715048004fc8fca0f27d09c1fa71c118
* Add findVariantLink to StubUserLangBryan Davis2014-12-141-0/+18
| | | | | | | | | Add the full signature of Language::findVariantLink to StubUserLang so that pass-by-reference variables are properly passed to the un-stubbed Language object. Bug: T78427 Change-Id: I51f57a17c814c43742f514df0e42a1760c406c48
* Deprecate MWFunction::newObj() in favor of ObjectFactoryKunal Mehta2014-11-061-1/+5
| | | | Change-Id: Iaa803311409cf7b649f64f69bafe2935a418d31c
* Fix visibility in SkinFallback and StubObjectaddshore2014-08-121-10/+10
| | | | Change-Id: Ie4c1aabd966fcdf87a9129ceb59c058740292f2e
* Cleanup some docs (includes/*.php)umherirrender2014-07-241-1/+1
| | | | | | | | | | - Swap "$variable type" to "type $variable" - Added missing types - Fixed spacing inside docs - Makes beginning of @param/@return/@var/@throws in capital - Changed some types to match the more common spelling Change-Id: I783e4dbfe5f6f98b32b9a03ccf6439e13e132bcc
* Remove deprecated class StubContLangwithoutaname2014-07-221-29/+0
| | | | Change-Id: I4569f5d59018f0d5082888fdc737cf30370bcbdd
* Unstub the passed object when calling unstub()Jackmcbarn2014-07-071-2/+4
| | | | | | | | Previously, only the global was unstubbed when StubObject::unstub() was called. Now, the object given as a parameter will also be unstubbed. (What about other references to the object, though?) Change-Id: I431ddd61e24686fc2f014c30064808ce57fe1706
* Remove silly 'm' prefix from StubObject/DeprecatedGlobal membersChad Horohoe2014-05-151-16/+16
| | | | | | Nothing uses them outside of these two classes Change-Id: I83a8eaff0d2d2d60592106d0e37572f898e482e9
* Make phpcs-strict pass on includes/ (3/~10)Siebrand Mazeland2014-05-111-3/+12
| | | | Change-Id: Ibf86d03b5479c47ee72c0dafea6777ef8178fe68
* Fixed some @params documentation (includes/*)umherirrender2014-04-201-14/+13
| | | | | | | | | Swapped some "$var type" to "type $var" or added missing types before the $var. Changed some other types to match the more common spelling. Makes beginning of some text in captial. Also added some missing @param. Change-Id: I7f605aa9e117b5fd80d9b1440864fe526d2b14a5
* Add StubObject::unstub, and use it for $wgAuth->getUserInstance()Brad Jorsch2013-09-111-0/+20
| | | | | | | | | | | | | | | | PHP's __call magic method can't handle functions with reference parameters correctly,[1] which means that we need to manually unstub StubObjects before calling such a method. Or you could use call-time pass by reference with call_user_func_array, which is rather backwards and verbose. This change adds a convenience function to do this, and applies it to the two calls which brought it to my attention. [1]: https://bugs.php.net/bug.php?id=40694, https://bugs.php.net/bug.php?id=62455 Change-Id: I74a0c04bf358e164f753b82fbefbd6205d9b2451
* Fixed spacing and removed unneeded parenthesisumherirrender2013-05-171-2/+2
| | | | | | | | Added spaces after/before parenthesis Removed unneeded parenthesis around some statements Broke a long line Change-Id: I7fbe129f7bbf524dd0598ece2a9708643f08453b
* Add missing wfProfileOut before throwing an exceptionumherirrender2013-04-081-0/+1
| | | | Change-Id: I1d830da0597f19efd0b2ae48642389975e736e23
* Spellchecked /includes directoryYuri Astrakhan2013-03-131-3/+3
| | | | | | | | | * Ran spell-checker over code comments in /includes/ * A few spellchecking fixes for wfDebug() calls Found one very strange (NOOP?) line in Linker.php - see "TODO: BUG?" Change-Id: Ibb86b51073b980eda9ecce2cf0b8dd33f058adbf
* Fixed @param tags to conform with Doxygen format.Tyler Anthony Romeo2013-03-111-8/+8
| | | | | | | | | | | Doxygen expects parameter types to come before the parameter name in @param tags. Used a quick regex to switch everything around where possible. This only fixes cases where a primitve variable (or a primitive followed by other types) is the variable type. Other cases will need to be fixed manually. Change-Id: Ic59fd20856eb0489d70f3469a56ebce0efb3db13
* fix some spacingumherirrender2013-02-041-1/+1
| | | | Change-Id: I8f976013f33c5818e4402604fe8610aa3f43b0c6
* Update docs for return and exception infoSiebrand Mazeland2012-10-091-0/+1
| | | | | | | * Removed some inline tabs in the process. * IDE fixed some incorrect leading spaces, too. Change-Id: Ic9303eff6db4424ac3f1fa2816839692b43e6190
* Added missing GPLv2 headers in some places.Alexandre Emsenhuber2012-05-101-0/+20
| | | | | | Also made file/class documentation more consistent and removed a duplicate comment from SpecialPageFactory.php in SpecialPage.php. Change-Id: I99dd2de7fe461f2fad4e0bd315ebc2899958a90f
* More return documentationSam Reed2012-02-091-0/+2
| | | | Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/111103
* added missing deprecation noticesJeroen De Dauw2011-12-131-0/+1
| | | | Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/106070
* Bug 29524 - Rename RequestContext::getLang to getLanguageJohn Du Hart2011-11-211-1/+1
| | | | | | | I'll be amazed if this doens't break any tests. Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/103817
* Comments, braces, explicit member variablesSam Reed2011-11-161-1/+8
| | | | | | | Remove a couple of unused variables Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/103323
* Add, update, tweak documentationSam Reed2011-10-261-1/+2
| | | | | | | | | Fix document comment blocks Tweak some returns Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/100778
* Fix for r89474: added missing () to function callAlexandre Emsenhuber2011-06-041-1/+1
| | | | Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/89477
* Follow up r89408. Magic >lang to getLang().Platonides2011-06-041-1/+1
| | | | Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/89474
* Provisional revert of r89406, r89414: reference-related warnings need ↵Brion Vibber2011-06-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | cleanup before applying code like this Per CR http://www.mediawiki.org/wiki/Special:Code/MediaWiki/89406#c17545 : 'Here is a third one: Strict Standards: Only variables should be passed by reference in /www/sandwiki/includes/Wiki.php on line 177 ' Offending bit is this: - SpecialPageFactory::executePath( $this->context->title, $this->context ); + SpecialPageFactory::executePath( $this->getTitle(), $this->getContext() ); That function demands reference paramters for $title and $context, which is being violated here where we now pass function return values: public static function executePath( Title &$title, RequestContext &$context, $including = false ) { The $title does sometimes get replaced within the function body, but $context does not appear to ever be replaced (its *contents* are modified, which does not require passing by reference) If replacing it is something it should be doing, then we need to be able to replace it upstream presumably, so $this->getTitle() probably isn't appropriate. The $context probably should have the reference simply removed. Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/89430
* Follow-up r89406 CR: another use of RequestContext::__get()Happy-melon2011-06-031-1/+1
| | | | Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/89414
* Follow-up r86775: restub $wgLang. Not because it's a good idea, but because ↵Happy-melon2011-04-241-2/+0
| | | | | | | I can't see how to avoid the circular dependencies on it *without* stubbing it. Probably easier to just continue the drive to deprecate the global variable altogether. Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/86809
* Stop stubbing $wgLang and $wgContLang. There are no major code paths which ↵Happy-melon2011-04-231-0/+4
| | | | | | | do not call either $wgLang or $wgContLang at least once. All index.php calls unstub $wgContLang from MediaWiki::parseTitle() except in the edgecase of viewing pages referenced only by "curid=123", and since those will end up calling OutputPage::output() they will eventually be unstubbed at some point as well. All calls through load.php unstub $wgLang in ResourceLoaderContext::getLanguage() from ResouceLoader::respond() --> ResourceLoader::preloadModuleInfo(). All calls through api.php unstub $wgContLang in ApiResult::cleanUpUTF8() from ApiMain::printResult(). Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/86775
* Followup r85278, remove duplication of userlang code.Daniel Friesen2011-04-031-19/+1
| | | | Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/85299
* Follow-up to r85240: Happy-melon2011-04-031-31/+26
| | | | | | | | | | | * Don't stub RequestContext. The chances of us getting away without needing to access *any* of the six major globals is nil, and in the meantime it's screwing up strong function typing and throwing catchable fatals everywhere. * Stop stubbing $wgOut. The only path where we can avoid unstubbing it is if we immediately die due to maxlag overflow, and that's a) a pretty uncommon code path, and b) a DB issue which won't be affected by a tiny bit of extra apache load. That allows us to do strong typing on function parameters with it, which is a Good Thing (TM). Also make OutputPage::getContext() private; I'm not convinced that a context belongs here (it's *part of* the context, not a consumer of it), let's work through it a it more before we advertise its existence. Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/85278
* Implement the RequestContext class. Some credit to IAlex, ;) other credit ↵Daniel Friesen2011-04-031-26/+31
| | | | | | | | | for me and that plethora of bugs and hicoughs I had to deal with in impelenting it. http://www.mediawiki.org/wiki/Requests_for_comment/Context_object (it's little different though) Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/85240