diff --git a/core/lib/Drupal/Component/ProxyBuilder/ProxyBuilder.php b/core/lib/Drupal/Component/ProxyBuilder/ProxyBuilder.php index aff4002..9fe3e29 100644 --- a/core/lib/Drupal/Component/ProxyBuilder/ProxyBuilder.php +++ b/core/lib/Drupal/Component/ProxyBuilder/ProxyBuilder.php @@ -145,8 +145,7 @@ public function build($class_name) { // for missing interfaces when the dumped container is loaded. When the // class is instantiated, module namespaces will have been registered and // the respective interfaces will be available via the class auto loader. - $final_output = "function {{ load_function_name }}() { \n" . $final_output . "\n}"; - + $final_output = "function {{ load_function_name }}() {\n" . $final_output . "\n}"; $final_output = str_replace('{{ load_function_name }}', $this->buildProxyLoadFunctionName($class_name), $final_output); $final_output = str_replace('{{ class_name }}', $class_name, $final_output); $final_output = str_replace('{{ proxy_class_name }}', $this->buildProxyClassName($class_name), $final_output); diff --git a/core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php b/core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php index a0f57fe..cab3fb1 100644 --- a/core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php +++ b/core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php @@ -234,6 +234,7 @@ public static function testMethod($parameter) protected function buildExpectedClass($class, $expected_methods_body, $interface_string = '') { $proxy_class = $this->proxyBuilder->buildProxyClassName($class); $expected_string = <<<'EOS' +function drupal_load_proxy__{{ proxy_class }}() { /** * Provides a proxy class for \{{ class }}. * @@ -277,6 +278,7 @@ protected function lazyLoadItself() {{ expected_methods_body }} } +} EOS; $expected_string = str_replace('{{ proxy_class }}', $proxy_class, $expected_string); $expected_string = str_replace('{{ class }}', $class, $expected_string); diff --git a/core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyDumperTest.php b/core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyDumperTest.php index 8285306..dfb7f26 100644 --- a/core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyDumperTest.php +++ b/core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyDumperTest.php @@ -77,6 +77,7 @@ public function testGetProxyFactoryCode() { $expected = <<<'EOS' if ($lazyLoad) { + drupal_load_proxy__Drupal_Tests_Component_ProxyBuilder_TestService_Proxy(); return $this->services['test_service'] = new Drupal_Tests_Component_ProxyBuilder_TestService_Proxy($this, 'test_service'); } diff --git a/core/tests/Drupal/Tests/Core/ProxyBuilder/ProxyBuilderTest.php b/core/tests/Drupal/Tests/Core/ProxyBuilder/ProxyBuilderTest.php index f04b75a..25e329e 100644 --- a/core/tests/Drupal/Tests/Core/ProxyBuilder/ProxyBuilderTest.php +++ b/core/tests/Drupal/Tests/Core/ProxyBuilder/ProxyBuilderTest.php @@ -67,6 +67,7 @@ public function complexMethod($parameter, callable $function, \Drupal\Tests\Core protected function buildExpectedClass($class, $expected_methods_body, $interface_string = '') { $proxy_class = $this->proxyBuilder->buildProxyClassName($class); $expected_string = <<<'EOS' +function drupal_load_proxy__{{ proxy_class }}() { /** * Provides a proxy class for \{{ class }}. * @@ -112,6 +113,7 @@ protected function lazyLoadItself() {{ expected_methods_body }} } +} EOS; $expected_string = str_replace('{{ proxy_class }}', $proxy_class, $expected_string); $expected_string = str_replace('{{ class }}', $class, $expected_string);