Declare properties statically

Before PHP 8.2 properties were created dynamically, this is deprecated now. This change patches the class definition and defines the dynamic properties upfront.

Bug: T314099
Bug: T360709
Change-Id: Ic197369647fbd6649daebe994bae39165e3882cc
(cherry picked from commit 81dedc1909)
This commit is contained in:
Moritz Schubotz (physikerwelt) 2024-04-06 09:56:31 +02:00 committed by Reedy
parent b3e9b63db0
commit eedb2003d0
2 changed files with 7 additions and 2 deletions

View file

@ -100,7 +100,10 @@ if ( options.debug ) {
console.log( `Found ${match}.` );
}
}
const newParse = parser.replace( regexp, '\\x{00$1}' );
parser = parser
.replace( regexp, '\\x{00$1}' )
// declare properties for the parser that were created dynamically before PHP 8.2
.replace( /class Parser \{/, 'class Parser {\n private $tu;\n private $options;' );
fs.writeFileSync( options.output, newParse );
fs.writeFileSync( options.output, parser );
console.log( 'Generated output file at: ' + options.output );

View file

@ -88,6 +88,8 @@ if (!class_exists("MediaWiki\\Extension\\Math\\TexVC\\SyntaxError", false)) {
}
class Parser {
private $tu;
private $options;
private $peg_currPos = 0;
private $peg_reportedPos = 0;
private $peg_cachedPos = 0;