Skip to content

Commit 6f1f87d

Browse files
Merge branch '3.3' into 3.4
* 3.3: (23 commits) Tests and fix for issue in array model data in EntityType field with multiple=true [Form] Fixed PercentToLocalizedStringTransformer to accept both comma and dot as decimal separator, if possible removed useless PHPDoc [Form] Fix FormInterface::submit() annotation [PHPUnitBridge] don't remove when set to empty string PdoSessionHandler: fix advisory lock for pgsql when session.sid_bits_per_character > 4 HttpCache does not consider ESI resources in HEAD requests Fix translation for "This field was not expected" [Routing] Enhance Route(Collection) docblocks Added improvement for accuracy in MoneyToLocalizedStringTransformer. Removed unused private property Use correct verb form in the pull request template Use PHP_MAXPATHLEN in Filesystem. Added null as explicit return type (?TokenInterface) [FrameworkBundle] Fix Routing\DelegatingLoader Render all line breaks according to the exception message [Form] Fix phpdoc [DI] remove confusing code [Form] Fixed GroupSequence with "constraints" option [Validator] Clarify UUID validator behavior ...
2 parents f146d57 + d277fc2 commit 6f1f87d

11 files changed

+82
-29
lines changed

Collator/Collator.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,6 @@ class Collator
7070
const SORT_STRING = 1;
7171

7272
/**
73-
* Constructor.
74-
*
7573
* @param string $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en")
7674
*
7775
* @throws MethodArgumentValueNotImplementedException When $locale different than "en" or null is passed

DateFormatter/DateFormat/FullTransformer.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ class FullTransformer
3737
private $timezone;
3838

3939
/**
40-
* Constructor.
41-
*
4240
* @param string $pattern The pattern to be used to format and/or parse values
4341
* @param string $timezone The timezone to perform the date/time calculations
4442
*/

DateFormatter/DateFormat/MonthTransformer.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,6 @@ class MonthTransformer extends Transformer
5959
*/
6060
protected static $flippedShortMonths = array();
6161

62-
/**
63-
* Constructor.
64-
*/
6562
public function __construct()
6663
{
6764
if (0 === count(self::$shortMonths)) {

DateFormatter/IntlDateFormatter.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,6 @@ class IntlDateFormatter
129129
private $timeZoneId;
130130

131131
/**
132-
* Constructor.
133-
*
134132
* @param string $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en")
135133
* @param int $datetype Type of date formatting, one of the format type constants
136134
* @param int $timetype Type of time formatting, one of the format type constants

Exception/MethodArgumentNotImplementedException.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
class MethodArgumentNotImplementedException extends NotImplementedException
1818
{
1919
/**
20-
* Constructor.
21-
*
2220
* @param string $methodName The method name that raised the exception
2321
* @param string $argName The argument name that is not implemented
2422
*/

Exception/MethodArgumentValueNotImplementedException.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
class MethodArgumentValueNotImplementedException extends NotImplementedException
1818
{
1919
/**
20-
* Constructor.
21-
*
2220
* @param string $methodName The method name that raised the exception
2321
* @param string $argName The argument name
2422
* @param string $argValue The argument value that is not implemented

Exception/MethodNotImplementedException.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
class MethodNotImplementedException extends NotImplementedException
1818
{
1919
/**
20-
* Constructor.
21-
*
2220
* @param string $methodName The name of the method
2321
*/
2422
public function __construct($methodName)

Exception/NotImplementedException.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ class NotImplementedException extends RuntimeException
2121
const INTL_INSTALL_MESSAGE = 'Please install the "intl" extension for full localization capabilities.';
2222

2323
/**
24-
* Constructor.
25-
*
2624
* @param string $message The exception message. A note to install the intl extension is appended to this string
2725
*/
2826
public function __construct($message)

Locale.php

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,21 +67,44 @@ public static function getDefaultFallback()
6767
*/
6868
public static function getFallback($locale)
6969
{
70-
if (false === $pos = strrpos($locale, '_')) {
71-
if (self::$defaultFallback === $locale) {
72-
return 'root';
73-
}
70+
if (function_exists('locale_parse')) {
71+
$localeSubTags = locale_parse($locale);
72+
if (1 === count($localeSubTags)) {
73+
if (self::$defaultFallback === $localeSubTags['language']) {
74+
return 'root';
75+
}
76+
77+
// Don't return default fallback for "root", "meta" or others
78+
// Normal locales have two or three letters
79+
if (strlen($locale) < 4) {
80+
return self::$defaultFallback;
81+
}
7482

75-
// Don't return default fallback for "root", "meta" or others
76-
// Normal locales have two or three letters
77-
if (strlen($locale) < 4) {
78-
return self::$defaultFallback;
83+
return null;
7984
}
8085

81-
return;
86+
array_pop($localeSubTags);
87+
88+
return locale_compose($localeSubTags);
89+
}
90+
91+
if (false !== $pos = strrpos($locale, '_')) {
92+
return substr($locale, 0, $pos);
8293
}
8394

84-
return substr($locale, 0, $pos);
95+
if (false !== $pos = strrpos($locale, '-')) {
96+
return substr($locale, 0, $pos);
97+
}
98+
99+
if (self::$defaultFallback === $locale) {
100+
return 'root';
101+
}
102+
103+
// Don't return default fallback for "root", "meta" or others
104+
// Normal locales have two or three letters
105+
if (strlen($locale) < 4) {
106+
return self::$defaultFallback;
107+
}
85108
}
86109

87110
/**

NumberFormatter/NumberFormatter.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,6 @@ class NumberFormatter
257257
);
258258

259259
/**
260-
* Constructor.
261-
*
262260
* @param string $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en")
263261
* @param int $style Style of the formatting, one of the format style constants.
264262
* The only supported styles are NumberFormatter::DECIMAL

0 commit comments

Comments
 (0)