wiki.techinc.nl/tests/phpunit/includes/parser
C. Scott Ananian 4497f99796 Parser: initialize preprocessor in constructor
Initializing the preprocessor in the constructor allows better
dependency injection, and removes code complexity caused by
lazy initialization.  Any use of the parser is going to end
up creating the preprocessor in any case, so deferring the
initialization doesn't save any performance.  (Best performance
is given by not creating the Parser in the first place if it
is not needed, which is what DI allows.)

Old code tried to unbreak cyclic dependencies by setting the
preprocessor to null.  This is somewhat of a lost cause,
since there are a number of other cyclic dependencies
involving the parser, including StripState, LinkHolders,
etc.  The code complexity is not worth it, given how
ineffective it is in any case.

This is part of T275160 in so far as it allows
Parser::getPreprocessor() to be a simple getter, and thus
(once this patch is merged) we can safely replace any
direct access to Parser::$mPreprocessor with a call to
Parser::getPreprocessor().

Bug: T275160
Change-Id: I38c6fe7d5a97badffdbf34d8b9d725756ed86514
2021-03-16 22:37:40 +00:00
..
CacheTimeTest.php tests: Fix method signature mismatches 2020-11-26 19:02:57 +01:00
CoreParserFunctionsTest.php build: Update mediawiki/mediawiki-codesniffer to 35.0.0 2021-01-31 13:34:38 +00:00
LinkHolderArrayIntegrationTest.php Strict return types for PageIdentity 2021-01-18 17:33:14 +01:00
MagicVariableTest.php Add missing @param and @return to documentation in tests 2021-01-22 19:57:25 +01:00
ParserCacheSerializationTestCases.php Use static closures where safe to use 2021-02-11 00:13:52 +00:00
ParserCacheTest.php Respect used options for ParserOptions::isSafeToCache 2021-01-04 10:32:34 -06:00
ParserMethodsTest.php Tests: Mark more more closures as static 2021-02-09 02:55:57 +00:00
ParserOptionsTest.php Make ParserOptionsTest work on PHP<7.4.9 with opcache enabled 2021-03-02 13:03:58 +11:00
ParserOutputTest.php Tests: Mark more more closures as static 2021-02-09 02:55:57 +00:00
ParserPreloadTest.php ParserPreloadTest: Remove unneeded unset calls 2020-12-28 22:10:53 +00:00
ParserTest.php Parser: initialize preprocessor in constructor 2021-03-16 22:37:40 +00:00
PreprocessorTest.php parser: convert Preprocessor to WANCache and inject dependencies 2021-01-11 20:21:10 -08:00
RevisionOutputCacheTest.php Implement caching for old revision HTML endpoint 2020-12-15 23:40:08 +01:00
SanitizerTest.php Remove documentation that literally repeats the code 2020-10-27 19:20:26 +00:00
StripStateTest.php MediaWikiTestCase to MediaWikiIntegrationTestCase 2020-06-30 17:02:22 +01:00
TagHooksTest.php Parser: initialize preprocessor in constructor 2021-03-16 22:37:40 +00:00
validateParserCacheSerializationTestData.php Tests: Mark more closures as static 2021-02-07 13:26:56 +01:00