feature #30651 Allow user to set the project dir (tdutrion)
feature #30651 Allow user to set the project dir (tdutrion)

This PR was merged into the 4.3-dev branch.

Discussion
----------

Allow user to set the project dir

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |  <!-- symfony/symfony-docs#... required for new features -->

Currently, the project directory is defined by the location of the composer.json file.

That file is not required in production, which therefore [breaks the method getProjectDir](https://github.com/symfony/symfony/issues/23950) (who sends back null).
The offered solution, while working, requires the developer to implement it, and uses inheritance override, while a more aesthetic solution could be used.

This does not fix the behaviour, but allows the developer to pass the project dir as a parameter.

While this solution does not include BC break or anything, it is important to notice that it includes
**an optional parameter**.

[Object instantiation in the framework bundle recipe](https://github.com/symfony/recipes/blob/master/symfony/framework-bundle/4.2/public/index.php#L23) could be updated as follow (in another PR):

```php
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
```

```php
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG'], dirname(__DIR__));
```

Commits
-------

c40017d63c Allow user to set the project dir

zcodes/symfony,pyrech/symfony,HeahDude/symfony,localheinz/symfony,xabbuh/symfony,alekitto/symfony,vincentaubert/symfony,curry684/symfony,Slamdunk/symfony,shieldo/symfony,fabpot/symfony,alekitto/symfony,fabpot/symfony,phramz/symfony,nicolas-grekas/symfony,smatyas/symfony,fabpot/symfony,nicolas-grekas/symfony,bendavies/symfony,Koc/symfony,teohhanhui/symfony,maidmaid/symfony,arjenm/symfony,dmaicher/symfony,romaricdrigon/symfony,docteurklein/symfony,tgalopin/symfony,Nyholm/symfony,romaricdrigon/symfony,Deamon/symfony,shieldo/symfony,Slamdunk/symfony,yceruto/symfony,xabbuh/symfony,joelwurtz/symfony,zorn-v/symfony,paradajozsef/symfony,ajgarlag/symfony,Tobion/symfony,vincentaubert/symfony,chalasr/symfony,mweimerskirch/symfony,phramz/symfony,oleg-andreyev/symfony,maidmaid/symfony,yceruto/symfony,gnat42/symfony,ogizanagi/symfony,localheinz/symfony,smatyas/symfony,lyrixx/symfony,jvasseur/symfony,ro0NL/symfony,MatTheCat/symfony,nicolas-grekas/symfony,zorn-v/symfony,curry684/symfony,zorn-v/symfony,stof/symfony,localheinz/symfony,Koc/symfony,Tobion/symfony,sgehrig/symfony,kbond/symfony,joelwurtz/symfony,docteurklein/symfony,tucksaun/symfony,sroze/symfony,Tobion/symfony,OskarStark/symfony,derrabus/symfony,ragboyjr/symfony,docteurklein/symfony,Simperfit/symfony,docteurklein/symfony,garak/symfony,ajgarlag/symfony,maidmaid/symfony,OskarStark/symfony,andreia/symfony,Simperfit/symfony,Koc/symfony,tucksaun/symfony,lstrojny/symfony,garak/symfony,pyrech/symfony,damienalexandre/symfony,Nyholm/symfony,lyrixx/symfony,mweimerskirch/symfony,HeahDude/symfony,zorn-v/symfony,Simperfit/symfony,Simperfit/symfony,andreia/symfony,tucksaun/symfony,mnapoli/symfony,Deamon/symfony,Tobion/symfony,andreia/symfony,Taluu/symfony,gonzalovilaseca/symfony,ajgarlag/symfony,arjenm/symfony,voronkovich/symfony,ro0NL/symfony,arjenm/symfony,mweimerskirch/symfony,oleg-andreyev/symfony,andreia/symfony,symfony/symfony,pierredup/symfony,voronkovich/symfony,pyrech/symfony,jakzal/symfony,Slamdunk/symfony,jakzal/symfony,ajgarlag/symfony,Deamon/symfony,joelwurtz/symfony,Nyholm/symfony,stof/symfony,ro0NL/symfony,jakzal/symfony,chalasr/symfony,derrabus/symfony,hhamon/symfony,hhamon/symfony,oleg-andreyev/symfony,mpdude/symfony,gnat42/symfony,Deamon/symfony,xabbuh/symfony,MatTheCat/symfony,paradajozsef/symfony,chalasr/symfony,jderusse/symfony,dmaicher/symfony,jvasseur/symfony,gonzalovilaseca/symfony,zcodes/symfony,ragboyjr/symfony,hhamon/symfony,alekitto/symfony,pierredup/symfony,symfony/symfony,teohhanhui/symfony,jderusse/symfony,voronkovich/symfony,ogizanagi/symfony,jderusse/symfony,joelwurtz/symfony,MatTheCat/symfony,chalasr/symfony,sgehrig/symfony,zerkms/symfony,symfony/symfony,bendavies/symfony,Taluu/symfony,ro0NL/symfony,HeahDude/symfony,phramz/symfony,xabbuh/symfony,gonzalovilaseca/symfony,Deamon/symfony,ragboyjr/symfony,lstrojny/symfony,teohhanhui/symfony,HeahDude/symfony,arjenm/symfony,mpdude/symfony,sroze/symfony,mweimerskirch/symfony,d-ph/symfony,bendavies/symfony,localheinz/symfony,tgalopin/symfony,damienalexandre/symfony,nicolas-grekas/symfony,yceruto/symfony,damienalexandre/symfony,shieldo/symfony,d-ph/symfony,derrabus/symfony,pierredup/symfony,1ed/symfony,garak/symfony,tucksaun/symfony,yceruto/symfony,zerkms/symfony,pyrech/symfony,curry684/symfony,Slamdunk/symfony,ogizanagi/symfony,damienalexandre/symfony,derrabus/symfony,1ed/symfony,jvasseur/symfony,dmaicher/symfony,romaricdrigon/symfony,garak/symfony,sroze/symfony,symfony/symfony,zcodes/symfony,paradajozsef/symfony,vincentaubert/symfony,stof/symfony,hhamon/symfony,romaricdrigon/symfony,fabpot/symfony,Taluu/symfony,gonzalovilaseca/symfony,mpdude/symfony,shieldo/symfony,Taluu/symfony,pierredup/symfony,kbond/symfony,d-ph/symfony,lyrixx/symfony,mnapoli/symfony,alekitto/symfony,zerkms/symfony,ragboyjr/symfony,ogizanagi/symfony,teohhanhui/symfony,mnapoli/symfony,Nyholm/symfony,bendavies/symfony,MatTheCat/symfony,mnapoli/symfony,gnat42/symfony,lyrixx/symfony,dmaicher/symfony,curry684/symfony,mpdude/symfony,smatyas/symfony,kbond/symfony,jakzal/symfony,tgalopin/symfony,voronkovich/symfony,smatyas/symfony,jderusse/symfony,maidmaid/symfony,1ed/symfony,OskarStark/symfony,mweimerskirch/symfony,phramz/symfony,oleg-andreyev/symfony,Simperfit/symfony,sgehrig/symfony,tgalopin/symfony,kbond/symfony,1ed/symfony,smatyas/symfony,gnat42/symfony,d-ph/symfony,zcodes/symfony,OskarStark/symfony,vincentaubert/symfony,paradajozsef/symfony,zerkms/symfony,jvasseur/symfony,mnapoli/symfony,sgehrig/symfony,sroze/symfony,stof/symfony,Koc/symfony,docteurklein/symfony,lstrojny/symfony