Skip to content

Commit c0f416e

Browse files
Merge branch '3.4' into 4.3
* 3.4: consistently throw NotSupportException [HttpKernel] Clarify error handler restoring process again [Intl] fix nullable phpdocs and useless method visibility of internal class Resilience against file_get_contents() race conditions.
2 parents fda49e6 + d936a70 commit c0f416e

File tree

9 files changed

+22
-22
lines changed

9 files changed

+22
-22
lines changed

src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -462,9 +462,8 @@ protected function fetch(Request $request, $catch = false)
462462
* All backend requests (cache passes, fetches, cache validations)
463463
* run through this method.
464464
*
465-
* @param Request $request A Request instance
466-
* @param bool $catch Whether to catch exceptions or not
467-
* @param Response $entry A Response instance (the stale entry if present, null otherwise)
465+
* @param bool $catch Whether to catch exceptions or not
466+
* @param Response|null $entry A Response instance (the stale entry if present, null otherwise)
468467
*
469468
* @return Response A Response instance
470469
*/

src/Symfony/Component/HttpKernel/HttpCache/Store.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ private function load($key)
354354
{
355355
$path = $this->getPath($key);
356356

357-
return file_exists($path) ? file_get_contents($path) : null;
357+
return file_exists($path) && false !== ($contents = file_get_contents($path)) ? $contents : null;
358358
}
359359

360360
/**

src/Symfony/Component/HttpKernel/Kernel.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -503,10 +503,9 @@ protected function initializeContainer()
503503
return;
504504
}
505505

506-
if ($this->debug) {
506+
if ($collectDeprecations = $this->debug && !\defined('PHPUNIT_COMPOSER_INSTALL')) {
507507
$collectedLogs = [];
508-
$previousHandler = \defined('PHPUNIT_COMPOSER_INSTALL');
509-
$previousHandler = $previousHandler ?: set_error_handler(function ($type, $message, $file, $line) use (&$collectedLogs, &$previousHandler) {
508+
$previousHandler = set_error_handler(function ($type, $message, $file, $line) use (&$collectedLogs, &$previousHandler) {
510509
if (E_USER_DEPRECATED !== $type && E_DEPRECATED !== $type) {
511510
return $previousHandler ? $previousHandler($type, $message, $file, $line) : false;
512511
}
@@ -549,7 +548,7 @@ protected function initializeContainer()
549548
$container = $this->buildContainer();
550549
$container->compile();
551550
} finally {
552-
if ($this->debug && true !== $previousHandler) {
551+
if ($collectDeprecations) {
553552
restore_error_handler();
554553

555554
file_put_contents($cacheDir.'/'.$class.'Deprecations.log', serialize(array_values($collectedLogs)));

src/Symfony/Component/Intl/Collator/Collator.php

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

7272
/**
73-
* @param string $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en")
73+
* @param string|null $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en")
7474
*
7575
* @throws MethodArgumentValueNotImplementedException When $locale different than "en" or null is passed
7676
*/
@@ -84,7 +84,7 @@ public function __construct(?string $locale)
8484
/**
8585
* Static constructor.
8686
*
87-
* @param string $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en")
87+
* @param string|null $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en")
8888
*
8989
* @return self
9090
*

src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ class IntlDateFormatter
118118
private $timeZoneId;
119119

120120
/**
121-
* @param string $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en")
121+
* @param string|null $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en")
122122
* @param int|null $datetype Type of date formatting, one of the format type constants
123123
* @param int|null $timetype Type of time formatting, one of the format type constants
124124
* @param \IntlTimeZone|\DateTimeZone|string|null $timezone Timezone identifier
@@ -152,7 +152,7 @@ public function __construct(?string $locale, ?int $datetype, ?int $timetype, $ti
152152
/**
153153
* Static constructor.
154154
*
155-
* @param string $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en")
155+
* @param string|null $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en")
156156
* @param int|null $datetype Type of date formatting, one of the format type constants
157157
* @param int|null $timetype Type of time formatting, one of the format type constants
158158
* @param \IntlTimeZone|\DateTimeZone|string|null $timezone Timezone identifier

src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -241,13 +241,13 @@ class NumberFormatter
241241
];
242242

243243
/**
244-
* @param string $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en")
245-
* @param int $style Style of the formatting, one of the format style constants.
246-
* The only supported styles are NumberFormatter::DECIMAL
247-
* and NumberFormatter::CURRENCY.
248-
* @param string $pattern Not supported. A pattern string in case $style is NumberFormat::PATTERN_DECIMAL or
249-
* NumberFormat::PATTERN_RULEBASED. It must conform to the syntax
250-
* described in the ICU DecimalFormat or ICU RuleBasedNumberFormat documentation
244+
* @param string|null $locale The locale code. The only currently supported locale is "en" (or null using the default locale, i.e. "en")
245+
* @param int $style Style of the formatting, one of the format style constants.
246+
* The only supported styles are NumberFormatter::DECIMAL
247+
* and NumberFormatter::CURRENCY.
248+
* @param string $pattern Not supported. A pattern string in case $style is NumberFormat::PATTERN_DECIMAL or
249+
* NumberFormat::PATTERN_RULEBASED. It must conform to the syntax
250+
* described in the ICU DecimalFormat or ICU RuleBasedNumberFormat documentation
251251
*
252252
* @see http://www.php.net/manual/en/numberformatter.create.php
253253
* @see http://www.icu-project.org/apiref/icu4c/classDecimalFormat.html#_details

src/Symfony/Component/Lock/Store/CombinedStore.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public function save(Key $key)
9494

9595
public function waitAndSave(Key $key)
9696
{
97-
throw new NotSupportedException(sprintf('The store "%s" does not supports blocking locks.', \get_class($this)));
97+
throw new NotSupportedException(sprintf('The store "%s" does not support blocking locks.', \get_class($this)));
9898
}
9999

100100
/**

src/Symfony/Component/Lock/Store/MemcachedStore.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Symfony\Component\Lock\Exception\InvalidArgumentException;
1515
use Symfony\Component\Lock\Exception\LockConflictedException;
16+
use Symfony\Component\Lock\Exception\NotSupportedException;
1617
use Symfony\Component\Lock\Key;
1718
use Symfony\Component\Lock\StoreInterface;
1819

@@ -70,7 +71,7 @@ public function save(Key $key)
7071

7172
public function waitAndSave(Key $key)
7273
{
73-
throw new InvalidArgumentException(sprintf('The store "%s" does not supports blocking locks.', \get_class($this)));
74+
throw new NotSupportedException(sprintf('The store "%s" does not support blocking locks.', \get_class($this)));
7475
}
7576

7677
/**

src/Symfony/Component/Lock/Store/RedisStore.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Symfony\Component\Cache\Traits\RedisProxy;
1616
use Symfony\Component\Lock\Exception\InvalidArgumentException;
1717
use Symfony\Component\Lock\Exception\LockConflictedException;
18+
use Symfony\Component\Lock\Exception\NotSupportedException;
1819
use Symfony\Component\Lock\Key;
1920
use Symfony\Component\Lock\StoreInterface;
2021

@@ -76,7 +77,7 @@ public function save(Key $key)
7677
*/
7778
public function waitAndSave(Key $key)
7879
{
79-
throw new InvalidArgumentException(sprintf('The store "%s" does not supports blocking locks.', \get_class($this)));
80+
throw new NotSupportedException(sprintf('The store "%s" does not support blocking locks.', \get_class($this)));
8081
}
8182

8283
/**

0 commit comments

Comments
 (0)