Skip to content

Commit 98ec56a

Browse files
authored
Merge pull request #131 from Jakub-Fajkus/fix-phpgenerator-bc-break
Fix NetteGenerator BC break
2 parents 7190f4e + 7d3e386 commit 98ec56a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Events/DI/EventsExtension.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,12 +182,12 @@ public function afterCompile(ClassTypeGenerator $class)
182182
/** @hack This tries to add the event invokation right after the code, generated by NetteExtension. */
183183
$foundNetteInitStart = $foundNetteInitEnd = FALSE;
184184
$lines = explode(";\n", trim($init->getBody() ?: ''));
185-
$init->setBody(NULL);
185+
$init->setBody('');
186186
while (($line = array_shift($lines)) !== NULL) {
187187
if ($foundNetteInitStart && !$foundNetteInitEnd &&
188188
stripos($line, 'Nette\\') === FALSE && stripos($line, 'set_include_path') === FALSE && stripos($line, 'date_default_timezone_set') === FALSE
189189
) {
190-
$init->addBody(GeneratorHelpers::format(
190+
$init->addBody( (new \Nette\PhpGenerator\Dumper)->format(
191191
'$this->getService(?)->createEvent(?)->dispatch($this);',
192192
$this->prefix('manager'),
193193
[DIContainer::class, 'onInitialize']
@@ -206,7 +206,7 @@ public function afterCompile(ClassTypeGenerator $class)
206206
}
207207

208208
if (!$foundNetteInitEnd) {
209-
$init->addBody(GeneratorHelpers::format(
209+
$init->addBody( (new \Nette\PhpGenerator\Dumper)->format(
210210
'$this->getService(?)->createEvent(?)->dispatch($this);',
211211
$this->prefix('manager'),
212212
[DIContainer::class, 'onInitialize']

0 commit comments

Comments
 (0)