Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit dd432c4

Browse filesBrowse files
committed
minor #28901 [HttpKernel] Introduce KernelInterface::getProjectDir() (ro0NL)
This PR was merged into the 4.2-dev branch. Discussion ---------- [HttpKernel] Introduce KernelInterface::getProjectDir() | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? | not yet | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | #28897 (comment) | License | MIT | Doc PR | symfony/symfony-docs#... <!-- required for new features --> Removes the last call to getParameter('kernel.project_dir') during runtime in core. Yay :) cc @fabpot @nicolas-grekas Commits ------- b046f41 [HttpKernel] Introduce KernelInterface::getProjectDir()
2 parents f0814e1 + b046f41 commit dd432c4
Copy full SHA for dd432c4

File tree

Expand file treeCollapse file tree

3 files changed

+7
-4
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+7
-4
lines changed

‎src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php
+2-3Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
6060

6161
/** @var KernelInterface $kernel */
6262
$kernel = $this->getApplication()->getKernel();
63-
$projectDir = $kernel->getContainer()->getParameter('kernel.project_dir');
6463

6564
$rows = array(
6665
array('<info>Symfony</>'),
@@ -75,8 +74,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
7574
array('Environment', $kernel->getEnvironment()),
7675
array('Debug', $kernel->isDebug() ? 'true' : 'false'),
7776
array('Charset', $kernel->getCharset()),
78-
array('Cache directory', self::formatPath($kernel->getCacheDir(), $projectDir).' (<comment>'.self::formatFileSize($kernel->getCacheDir()).'</>)'),
79-
array('Log directory', self::formatPath($kernel->getLogDir(), $projectDir).' (<comment>'.self::formatFileSize($kernel->getLogDir()).'</>)'),
77+
array('Cache directory', self::formatPath($kernel->getCacheDir(), $kernel->getProjectDir()).' (<comment>'.self::formatFileSize($kernel->getCacheDir()).'</>)'),
78+
array('Log directory', self::formatPath($kernel->getLogDir(), $kernel->getProjectDir()).' (<comment>'.self::formatFileSize($kernel->getLogDir()).'</>)'),
8079
new TableSeparator(),
8180
array('<info>PHP</>'),
8281
new TableSeparator(),

‎src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
use Symfony\Component\Filesystem\Filesystem;
2323
use Symfony\Component\Finder\Finder;
2424
use Symfony\Component\HttpKernel\Bundle\BundleInterface;
25+
use Symfony\Component\HttpKernel\KernelInterface;
2526

2627
/**
2728
* Command that places bundle web assets into a given directory.
@@ -89,11 +90,12 @@ protected function configure()
8990
*/
9091
protected function execute(InputInterface $input, OutputInterface $output)
9192
{
93+
/** @var KernelInterface $kernel */
9294
$kernel = $this->getApplication()->getKernel();
9395
$targetArg = rtrim($input->getArgument('target'), '/');
9496

9597
if (!is_dir($targetArg)) {
96-
$targetArg = $kernel->getContainer()->getParameter('kernel.project_dir').'/'.$targetArg;
98+
$targetArg = $kernel->getProjectDir().'/'.$targetArg;
9799

98100
if (!is_dir($targetArg)) {
99101
throw new InvalidArgumentException(sprintf('The target directory "%s" does not exist.', $input->getArgument('target')));

‎src/Symfony/Component/HttpKernel/KernelInterface.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/KernelInterface.php
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
* It manages an environment made of application kernel and bundles.
2222
*
2323
* @author Fabien Potencier <fabien@symfony.com>
24+
*
25+
* @method string getProjectDir() Gets the project dir (path of the project's composer file) - not defining it is deprecated since Symfony 4.2
2426
*/
2527
interface KernelInterface extends HttpKernelInterface, \Serializable
2628
{

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.