2929
3030class TransTest extends NodeTestCase
3131{
32- private function echoOrYield (): string
32+ private static function echoOrYield (): string
3333 {
3434 return class_exists (YieldReady::class) ? 'yield ' : 'echo ' ;
3535 }
@@ -97,7 +97,7 @@ public function testEnableDebugNotEnabled(): void
9797 $ sourceCode = $ compiler ->compile ($ node )->getSource ();
9898 $ this ->assertSame (
9999 '// custom: Notes for translators ' . "\n"
100- . $ this -> echoOrYield () . ' strtr(ngettext("There is 1 pending task", '
100+ . self :: echoOrYield () . ' strtr(ngettext("There is 1 pending task", '
101101 . ' "There are %count% pending tasks", abs(5)), array("%count%" => abs(5), )); ' . "\n" ,
102102 $ sourceCode
103103 );
@@ -126,7 +126,7 @@ public function testEnableDebugEnabled(): void
126126 $ sourceCode = $ compiler ->compile ($ node )->getSource ();
127127 $ this ->assertSame (
128128 '// line 80 ' . "\n" . '// custom: Notes for translators ' . "\n"
129- . $ this -> echoOrYield () . ' strtr(ngettext("There '
129+ . self :: echoOrYield () . ' strtr(ngettext("There '
130130 . ' is 1 pending task", "There are %count% pending tasks", abs(5)), array("%count%" => abs(5), )); ' . "\n" ,
131131 $ sourceCode
132132 );
@@ -149,22 +149,22 @@ public function getTests(): array
149149 $ node = new TransNode ($ body , null , null , null , null , $ domain , 0 );
150150 $ tests [] = [
151151 $ node ,
152- sprintf ($ this -> echoOrYield () . ' dgettext("coredomain", %s); ' , $ this ->getVariableGetter ('foo ' )),
152+ sprintf (self :: echoOrYield () . ' dgettext("coredomain", %s); ' , $ this ->getVariableGetter ('foo ' )),
153153 ];
154154
155155 $ body = new NameExpression ('foo ' , 0 );
156156 $ node = new TransNode ($ body , null , null , null , null , null , 0 );
157- $ tests [] = [$ node , sprintf ($ this -> echoOrYield () . ' gettext(%s); ' , $ this ->getVariableGetter ('foo ' ))];
157+ $ tests [] = [$ node , sprintf (self :: echoOrYield () . ' gettext(%s); ' , $ this ->getVariableGetter ('foo ' ))];
158158
159159 $ body = new ConstantExpression ('Hello ' , 0 );
160160 $ node = new TransNode ($ body , null , null , null , null , null , 0 );
161- $ tests [] = [$ node , $ this -> echoOrYield () . ' gettext("Hello"); ' ];
161+ $ tests [] = [$ node , self :: echoOrYield () . ' gettext("Hello"); ' ];
162162
163163 $ body = new Node ([
164164 new TextNode ('Hello ' , 0 ),
165165 ], [], 0 );
166166 $ node = new TransNode ($ body , null , null , null , null , null , 0 );
167- $ tests [] = [$ node , $ this -> echoOrYield () . ' gettext("Hello"); ' ];
167+ $ tests [] = [$ node , self :: echoOrYield () . ' gettext("Hello"); ' ];
168168
169169 $ body = new Node ([
170170 new TextNode ('J \'ai ' , 0 ),
@@ -175,7 +175,7 @@ public function getTests(): array
175175 $ tests [] = [
176176 $ node ,
177177 sprintf (
178- $ this -> echoOrYield () . ' strtr(gettext("J \'ai %%foo%% pommes"), array("%%foo%%" => %s, )); ' ,
178+ self :: echoOrYield () . ' strtr(gettext("J \'ai %%foo%% pommes"), array("%%foo%%" => %s, )); ' ,
179179 $ this ->getVariableGetter ('foo ' )
180180 ),
181181 ];
@@ -197,7 +197,7 @@ public function getTests(): array
197197 $ tests [] = [
198198 $ node ,
199199 sprintf (
200- $ this -> echoOrYield () . ' strtr(ngettext("Hey %%name%%, I have one apple", "Hey %%name%%, I have '
200+ self :: echoOrYield () . ' strtr(ngettext("Hey %%name%%, I have one apple", "Hey %%name%%, I have '
201201 . ' %%count%% apples", abs(12)), array("%%name%%" => %s, '
202202 . ' "%%name%%" => %s, "%%count%%" => abs(12), )); ' ,
203203 $ this ->getVariableGetter ('name ' ),
@@ -219,7 +219,7 @@ public function getTests(): array
219219 $ tests [] = [
220220 $ node ,
221221 sprintf (
222- $ this -> echoOrYield () . ' strtr(gettext("J \'ai %%foo%% pommes"), array("%%foo%%" => %s, )); ' ,
222+ self :: echoOrYield () . ' strtr(gettext("J \'ai %%foo%% pommes"), array("%%foo%%" => %s, )); ' ,
223223 $ this ->getVariableGetter ('foo ' )
224224 ),
225225 ];
@@ -228,15 +228,15 @@ public function getTests(): array
228228 $ body = new ConstantExpression ('Hello ' , 0 );
229229 $ notes = new TextNode ('Notes for translators ' , 0 );
230230 $ node = new TransNode ($ body , null , null , null , $ notes , null , 0 );
231- $ tests [] = [$ node , "// notes: Notes for translators \n" . $ this -> echoOrYield () . ' gettext("Hello"); ' ];
231+ $ tests [] = [$ node , "// notes: Notes for translators \n" . self :: echoOrYield () . ' gettext("Hello"); ' ];
232232
233233 $ body = new ConstantExpression ('Hello ' , 0 );
234234 $ notes = new TextNode ("Notes for translators \nand line breaks " , 0 );
235235 $ node = new TransNode ($ body , null , null , null , $ notes , null , 0 );
236236 $ tests [] = [
237237 $ node ,
238238 "// notes: Notes for translators and line breaks \n"
239- . $ this -> echoOrYield () . ' gettext("Hello"); ' ,
239+ . self :: echoOrYield () . ' gettext("Hello"); ' ,
240240 ];
241241
242242 $ count = new ConstantExpression (5 , 0 );
@@ -251,7 +251,7 @@ public function getTests(): array
251251 $ tests [] = [
252252 $ node ,
253253 '// notes: Notes for translators ' . "\n"
254- . $ this -> echoOrYield () . ' strtr(ngettext("There is 1 pending task", '
254+ . self :: echoOrYield () . ' strtr(ngettext("There is 1 pending task", '
255255 . ' "There are %count% pending tasks", abs(5)), array("%count%" => abs(5), )); ' ,
256256 ];
257257
0 commit comments