Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6aa18bf

Browse files
Merge branch '3.3' into 3.4
* 3.3: fix merge [Translation] Fix InvalidArgumentException when using untranslated plural forms from .po files Fixed exit code with non-integer throwable code Add suggestions Added instructions to upgrade Symfony applications to 4.x
2 parents 9ddf500 + 5b51491 commit 6aa18bf

File tree

8 files changed

+61
-6
lines changed

8 files changed

+61
-6
lines changed

UPGRADE-4.0.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,40 @@
11
UPGRADE FROM 3.x to 4.0
22
=======================
33

4+
Symfony Framework
5+
-----------------
6+
7+
The first step to upgrade a Symfony 3.x application to 4.x is to update the
8+
file and directory structure of your application:
9+
10+
| Symfony 3.x | Symfony 4.x
11+
| ----------------------------------- | --------------------------------
12+
| `app/config/` | `config/`
13+
| `app/config/*.yml` | `config/*.yaml` and `config/packages/*.yaml`
14+
| `app/config/parameters.yml.dist` | `config/services.yaml` and `.env.dist`
15+
| `app/config/parameters.yml` | `config/services.yaml` and `.env`
16+
| `app/Resources/<BundleName>/views/` | `templates/bundles/<BundleName>/`
17+
| `app/Resources/` | `src/Resources/`
18+
| `app/Resources/assets/` | `assets/`
19+
| `app/Resources/translations/` | `translations/`
20+
| `app/Resources/views/` | `templates/`
21+
| `src/AppBundle/` | `src/`
22+
| `var/logs/` | `var/log/`
23+
| `web/` | `public/`
24+
| `web/app.php` | `public/index.php`
25+
| `web/app_dev.php` | `public/index.php`
26+
27+
Then, upgrade the contents of your console script and your front controller:
28+
29+
* `bin/console`: https://github.com/symfony/recipes/blob/master/symfony/console/3.3/bin/console
30+
* `public/index.php`: https://github.com/symfony/recipes/blob/master/symfony/framework-bundle/3.3/public/index.php
31+
32+
Lastly, read the following article to add Symfony Flex to your application and
33+
upgrade the configuration files: https://symfony.com/doc/current/setup/flex.html
34+
35+
If you use Symfony components instead of the whole framework, you can find below
36+
the upgrading instructions for each individual bundle and component.
37+
438
ClassLoader
539
-----------
640

src/Symfony/Bridge/Monolog/composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
"suggest": {
3333
"symfony/http-kernel": "For using the debugging handlers together with the response life cycle of the HTTP kernel.",
3434
"symfony/console": "For the possibility to show log messages in console commands depending on verbosity settings. You need version ~2.3 of the console for it.",
35-
"symfony/event-dispatcher": "Needed when using log messages in console commands."
35+
"symfony/event-dispatcher": "Needed when using log messages in console commands.",
36+
"symfony/var-dumper": "For using the debugging handlers like the console handler or the log server handler."
3637
},
3738
"autoload": {
3839
"psr-4": { "Symfony\\Bridge\\Monolog\\": "" },

src/Symfony/Bundle/WebServerBundle/Command/ServerLogCommand.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bundle\WebServerBundle\Command;
1313

14+
use Monolog\Formatter\FormatterInterface;
1415
use Symfony\Bridge\Monolog\Formatter\ConsoleFormatter;
1516
use Symfony\Bridge\Monolog\Handler\ConsoleHandler;
1617
use Symfony\Component\Console\Command\Command;
@@ -37,6 +38,11 @@ public function isEnabled()
3738
return false;
3839
}
3940

41+
// based on a symfony/symfony package, it crashes due a missing FormatterInterface from monolog/monolog
42+
if (!class_exists(FormatterInterface::class)) {
43+
return false;
44+
}
45+
4046
return parent::isEnabled();
4147
}
4248

src/Symfony/Bundle/WebServerBundle/composer.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@
2929
"/Tests/"
3030
]
3131
},
32+
"suggest": {
33+
"symfony/monolog-bridge": "For using the log server.",
34+
"symfony/expression-language": "For using the filter option of the log server."
35+
},
3236
"minimum-stability": "dev",
3337
"extra": {
3438
"branch-alias": {

src/Symfony/Component/Console/Event/ConsoleErrorEvent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,6 @@ public function setExitCode($exitCode)
7878
*/
7979
public function getExitCode()
8080
{
81-
return null !== $this->exitCode ? $this->exitCode : ($this->error->getCode() ?: 1);
81+
return null !== $this->exitCode ? $this->exitCode : (is_int($this->error->getCode()) ? $this->error->getCode() : 1);
8282
}
8383
}

src/Symfony/Component/Debug/Tests/phpt/fatal_with_nested_handlers.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ array(1) {
3333
[0]=>
3434
string(37) "Error and exception handlers do match"
3535
}
36-
object(Symfony\Component\Debug\Exception\FatalErrorException)#4 (8) {
36+
object(Symfony\Component\Debug\Exception\FatalErrorException)#%d (%d) {
3737
["message":protected]=>
3838
string(199) "Error: Class Symfony\Component\Debug\Broken contains 2 abstract methods and must therefore be declared abstract or implement the remaining methods (Serializable::serialize, Serializable::unserialize)"
3939
%a

src/Symfony/Component/Translation/MessageSelector.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,16 @@ class MessageSelector
4949
*/
5050
public function choose($message, $number, $locale)
5151
{
52-
preg_match_all('/(?:\|\||[^\|])++/', $message, $parts);
52+
$parts = array();
53+
if (preg_match('/^\|++$/', $message)) {
54+
$parts = explode('|', $message);
55+
} elseif (preg_match_all('/(?:\|\||[^\|])++/', $message, $matches)) {
56+
$parts = $matches[0];
57+
}
58+
5359
$explicitRules = array();
5460
$standardRules = array();
55-
foreach ($parts[0] as $part) {
61+
foreach ($parts as $part) {
5662
$part = trim(str_replace('||', '|', $part));
5763

5864
if (preg_match('/^(?P<interval>'.Interval::getIntervalRegexp().')\s*(?P<message>.*?)$/xs', $part, $matches)) {
@@ -76,7 +82,7 @@ public function choose($message, $number, $locale)
7682
if (!isset($standardRules[$position])) {
7783
// when there's exactly one rule given, and that rule is a standard
7884
// rule, use this rule
79-
if (1 === count($parts[0]) && isset($standardRules[0])) {
85+
if (1 === count($parts) && isset($standardRules[0])) {
8086
return $standardRules[0];
8187
}
8288

src/Symfony/Component/Translation/Tests/MessageSelectorTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@ public function getChooseTests()
128128
array("This is a text with a\nnew-line in it. Selector = 1.", "{0}This is a text with a\nnew-line in it. Selector = 0.|{1}This is a text with a\nnew-line in it. Selector = 1.|[1,Inf]This is a text with a\nnew-line in it. Selector > 1.", 1),
129129
// esacape pipe
130130
array('This is a text with | in it. Selector = 0.', '{0}This is a text with || in it. Selector = 0.|{1}This is a text with || in it. Selector = 1.', 0),
131+
// Empty plural set (2 plural forms) from a .PO file
132+
array('', '|', 1),
133+
// Empty plural set (3 plural forms) from a .PO file
134+
array('', '||', 1),
131135
);
132136
}
133137
}

0 commit comments

Comments
 (0)