From 4ab2f9955bfe40ae5e737b1ed0e7b37c1172bb1d Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 9 Jul 2019 10:08:52 +0200 Subject: [PATCH] [Bundles] Rename getPublicPath() as getPublicDir() --- .../FrameworkBundle/Command/AssetsInstallCommand.php | 10 +++++----- src/Symfony/Component/HttpKernel/Bundle/Bundle.php | 2 +- .../Component/HttpKernel/Bundle/BundleInterface.php | 2 +- src/Symfony/Component/HttpKernel/Tests/KernelTest.php | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php index 18efeb3d9751f..987ecbf57edbb 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php @@ -137,13 +137,13 @@ protected function execute(InputInterface $input, OutputInterface $output) $validAssetDirs = []; /** @var BundleInterface $bundle */ foreach ($kernel->getBundles() as $bundle) { - if (!method_exists($bundle, 'getPublicPath')) { - @trigger_error('Not defining "getPublicPath()" method is deprecated since Symfony 4.4 and will not be supported in 5.0.', E_USER_DEPRECATED); - $publicPath = 'Resources/public'; + if (!method_exists($bundle, 'getPublicDir')) { + @trigger_error(sprintf('Not defining "getPublicDir()" method in the "%s" class is deprecated since Symfony 4.4 and will not be supported in 5.0.', get_class($bundle)), E_USER_DEPRECATED); + $publicDir = 'Resources/public'; } else { - $publicPath = $bundle->getPublicPath(); + $publicDir = ltrim($bundle->getPublicDir(), '\\/'); } - if (!is_dir($originDir = $bundle->getPath().\DIRECTORY_SEPARATOR.$publicPath)) { + if (!is_dir($originDir = $bundle->getPath().\DIRECTORY_SEPARATOR.$publicDir)) { continue; } diff --git a/src/Symfony/Component/HttpKernel/Bundle/Bundle.php b/src/Symfony/Component/HttpKernel/Bundle/Bundle.php index c3c1babe4d192..ca190ee69543e 100644 --- a/src/Symfony/Component/HttpKernel/Bundle/Bundle.php +++ b/src/Symfony/Component/HttpKernel/Bundle/Bundle.php @@ -135,7 +135,7 @@ public function registerCommands(Application $application) { } - public function getPublicPath(): string + public function getPublicDir(): string { return 'Resources/public'; } diff --git a/src/Symfony/Component/HttpKernel/Bundle/BundleInterface.php b/src/Symfony/Component/HttpKernel/Bundle/BundleInterface.php index 8dfba0a24457a..c45754b3ee1e0 100644 --- a/src/Symfony/Component/HttpKernel/Bundle/BundleInterface.php +++ b/src/Symfony/Component/HttpKernel/Bundle/BundleInterface.php @@ -20,7 +20,7 @@ * * @author Fabien Potencier * - * @method string getPublicPath() Returns relative path for public assets + * @method string getPublicDir() Returns relative path for the public assets directory */ interface BundleInterface extends ContainerAwareInterface { diff --git a/src/Symfony/Component/HttpKernel/Tests/KernelTest.php b/src/Symfony/Component/HttpKernel/Tests/KernelTest.php index 845e8ceb0a075..0c500bdfd18e2 100644 --- a/src/Symfony/Component/HttpKernel/Tests/KernelTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/KernelTest.php @@ -627,7 +627,7 @@ protected function getBundle($dir = null, $parent = null, $className = null, $bu { $bundle = $this ->getMockBuilder('Symfony\Component\HttpKernel\Bundle\BundleInterface') - ->setMethods(['getPath', 'getPublicPath', 'getParent', 'getName']) + ->setMethods(['getPath', 'getPublicDir', 'getParent', 'getName']) ->disableOriginalConstructor() ; @@ -651,7 +651,7 @@ protected function getBundle($dir = null, $parent = null, $className = null, $bu $bundle ->expects($this->any()) - ->method('getPublicPath') + ->method('getPublicDir') ->willReturn('Resources/public') ; pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy