8000 Merge branch '5.0' · symfony/symfony@3f23a45 · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit 3f23a45

Browse files
Merge branch '5.0'
* 5.0: fix merge Fix more quotes in exception messages Fix more quotes in exception messages Fix more quotes in exception messages [3.4] Minor fixes [PropertyAccess] Improved errors when reading uninitialized properties
2 parents c0ee02b + 000ffb2 commit 3f23a45

File tree

21 files changed

+60
-21
lines changed

21 files changed

+60
-21
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1122,7 +1122,7 @@ private function registerTranslatorConfiguration(array $config, ContainerBuilder
11221122
if ($container->fileExists($dir)) {
11231123
$dirs[] = $transPaths[] = $dir;
11241124
} else {
1125-
throw new \UnexpectedValueException(sprintf('%s defined in translator.paths does not exist or is not a directory.', $dir));
1125+
throw new \UnexpectedValueException(sprintf('"%s" defined in translator.paths does not exist or is not a directory.', $dir));
11261126
}
11271127
}
11281128

src/Symfony/Component/Cache/Traits/RedisTrait.php

Lines changed: 1 addition & 1 deletion
A3E2
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ private function init($redisClient, string $namespace, int $defaultLifetime, ?Ma
5656
}
5757

5858
if (!$redisClient instanceof \Redis && !$redisClient instanceof \RedisArray && !$redisClient instanceof \RedisCluster && !$redisClient instanceof \Predis\ClientInterface && !$redisClient instanceof RedisProxy && !$redisClient instanceof RedisClusterProxy) {
59-
throw new InvalidArgumentException(sprintf('%s() expects parameter 1 to be Redis, RedisArray, RedisCluster or Predis\ClientInterface, "%s" given.', __METHOD__, get_debug_type($redisClient)));
59+
throw new InvalidArgumentException(sprintf('"%s()" expects parameter 1 to be Redis, RedisArray, RedisCluster or Predis\ClientInterface, "%s" given.', __METHOD__, get_debug_type($redisClient)));
6060
}
6161

6262
if ($redisClient instanceof \Predis\ClientInterface && $redisClient->getOptions()->exceptions) {

src/Symfony/Component/HttpClient/CurlHttpClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ public function stream($responses, float $timeout = null): ResponseStreamInterfa
319319
if ($responses instanceof CurlResponse) {
320320
$responses = [$responses];
321321
} elseif (!is_iterable($responses)) {
322-
throw new \TypeError(sprintf('%s() expects parameter 1 to be an iterable of CurlResponse objects, "%s" given.', __METHOD__, get_debug_type($responses)));
322+
throw new \TypeError(sprintf('"%s()" expects parameter 1 to be an iterable of CurlResponse objects, "%s" given.', __METHOD__, get_debug_type($responses)));
323323
}
324324

325325
$active = 0;

src/Symfony/Component/HttpClient/MockHttpClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function stream($responses, float $timeout = null): ResponseStreamInterfa
8282
if ($responses instanceof ResponseInterface) {
8383
$responses = [$responses];
8484
} elseif (!is_iterable($responses)) {
85-
throw new \TypeError(sprintf('%s() expects parameter 1 to be an iterable of MockResponse objects, "%s" given.', __METHOD__, get_debug_type($responses)));
85+
throw new \TypeError(sprintf('"%s()" expects parameter 1 to be an iterable of MockResponse objects, "%s" given.', __METHOD__, get_debug_type($responses)));
8686
}
8787

8888
return new ResponseStream(MockResponse::stream($responses, $timeout));

src/Symfony/Component/HttpClient/NativeHttpClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ public function stream($responses, float $timeout = null): ResponseStreamInterfa
235235
if ($responses instanceof NativeResponse) {
236236
$responses = [$responses];
237237
} elseif (!is_iterable($responses)) {
238-
throw new \TypeError(sprintf('%s() expects parameter 1 to be an iterable of NativeResponse objects, "%s" given.', __METHOD__, get_debug_type($responses)));
238+
throw new \TypeError(sprintf('"%s()" expects parameter 1 to be an iterable of NativeResponse objects, "%s" given.', __METHOD__, get_debug_type($responses)));
239239
}
240240

241241
return new ResponseStream(NativeResponse::stream($responses, $timeout));

src/Symfony/Component/HttpFoundation/Session/Storage/Handler/RedisSessionHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function __construct($redis, array $options = [])
5454
!$redis instanceof RedisProxy &&
5555
!$redis instanceof RedisClusterProxy
5656
) {
57-
throw new \InvalidArgumentException(sprintf('%s() expects parameter 1 to be Redis, RedisArray, RedisCluster or Predis\ClientInterface, "%s" given.', __METHOD__, get_debug_type($redis)));
57+
throw new \InvalidArgumentException(sprintf('"%s()" expects parameter 1 to be Redis, RedisArray, RedisCluster or Predis\ClientInterface, "%s" given.', __METHOD__, get_debug_type($redis)));
5858
}
5959

6060
if ($diff = array_diff(array_keys($options), ['prefix', 'ttl'])) {

src/Symfony/Component/HttpKernel/Controller/ArgumentResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function getArguments(Request $request, callable $controller): array
6262
}
6363

6464
if (!$atLeastOne) {
65-
throw new \InvalidArgumentException(sprintf('%s::resolve() must yield at least one value.', get_debug_type($resolver)));
65+
throw new \InvalidArgumentException(sprintf('"%s::resolve()" must yield at least one value.', get_debug_type($resolver)));
6666
}
6767

6868
// continue to the next controller argument

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ public function format($value, int $type = self::TYPE_DEFAULT)
360360
}
361361

362362
if (self::CURRENCY === $this->style) {
363-
throw new NotImplementedException(sprintf('%s() method does not support the formatting of currencies (instance with CURRENCY style). "%s".', __METHOD__, NotImplementedException::INTL_INSTALL_MESSAGE));
363+
throw new NotImplementedException(sprintf('"%s()" method does not support the formatting of currencies (instance with CURRENCY style). "%s".', __METHOD__, NotImplementedException::INTL_INSTALL_MESSAGE));
364364
}
365365

366366
// Only the default type is supported.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function __construct(\Memcached $memcached, int $initialTtl = 300)
4646
}
4747

4848
if ($initialTtl < 1) {
49-
throw new InvalidArgumentException(sprintf('%s() expects a strictly positive TTL. Got %d.', __METHOD__, $initialTtl));
49+
throw new InvalidArgumentException(sprintf('"%s()" expects a strictly positive TTL. Got %d.', __METHOD__, $initialTtl));
5050
}
5151

5252
$this->memcached = $memcached;
@@ -74,7 +74,7 @@ public function save(Key $key)
7474
public function putOffExpiration(Key $key, float $ttl)
7575
{
7676
if ($ttl < 1) {
77-
throw new InvalidTtlException(sprintf('%s() expects a TTL greater or equals to 1 second. Got %s.', __METHOD__, $ttl));
77+
throw new InvalidTtlException(sprintf('"%s()" expects a TTL greater or equals to 1 second. Got %s.', __METHOD__, $ttl));
F42D
7878
}
7979

8080
// Interface defines a float value but Store required an integer.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function __construct($connOrDsn, array $options = [], float $gcProbabilit
8181
throw new InvalidArgumentException(sprintf('"%s" requires gcProbability between 0 and 1, "%f" given.', __METHOD__, $gcProbability));
8282
}
8383
if ($initialTtl < 1) {
84-
throw new InvalidTtlException(sprintf('%s() expects a strictly positive TTL, "%d" given.', __METHOD__, $initialTtl));
84+
throw new InvalidTtlException(sprintf('"%s()" expects a strictly positive TTL, "%d" given.', __METHOD__, $initialTtl));
8585
}
8686

8787
if ($connOrDsn instanceof \PDO) {
@@ -146,7 +146,7 @@ public function save(Key $key)
146146
public function putOffExpiration(Key $key, float $ttl)
147147
{
148148
if ($ttl < 1) {
149-
throw new InvalidTtlException(sprintf('%s() expects a TTL greater or equals to 1 second. Got %s.', __METHOD__, $ttl));
149+
throw new InvalidTtlException(sprintf('"%s()" expects a TTL greater or equals to 1 second. Got %s.', __METHOD__, $ttl));
150150
}
151151

152152
$key->reduceLifetime($ttl);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ private function evaluate(string $script, string $resource, array $args)
141141
return $this->redis->eval(...array_merge([$script, 1, $resource], $args));
142142
}
143143

144-
throw new InvalidArgumentException(sprintf('%s() expects being initialized with a Redis, RedisArray, RedisCluster or Predis\ClientInterface, "%s" given.', __METHOD__, get_debug_type($this->redis)));
144+
throw new InvalidArgumentException(sprintf('"%s()" expects being initialized with a Redis, RedisArray, RedisCluster or Predis\ClientInterface, "%s" given.', __METHOD__, get_debug_type($this->redis)));
145145
}
146146

147147
private function getUniqueToken(Key $key): string
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function write($input)
4545
return;
4646
}
4747
if ($this->isClosed()) {
48-
throw new RuntimeException(sprintf('%s is closed.', static::class));
48+
throw new RuntimeException(sprintf('"%s" is closed.', static::class));
4949
}
5050
$this->input[] = ProcessUtils::validateInput(__METHOD__, $input);
5151
}

src/Symfony/Component/Process/Pipes/AbstractPipes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ protected function write(): ?array
103103
} elseif (!isset($this->inputBuffer[0])) {
104104
if (!\is_string($input)) {
105105
if (!is_scalar($input)) {
106-
throw new InvalidArgumentException(sprintf('%s yielded a value of type "%s", but only scalars and stream resources are supported.', get_debug_type($this->input), get_debug_type($input)));
106+
throw new InvalidArgumentException(sprintf('"%s" yielded a value of type "%s", but only scalars and stream resources are supported.', get_debug_type($this->input), get_debug_type($input)));
107107
}
108108
$input = (string) $input;
109109
}

src/Symfony/Component/Process/ProcessUtils.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public static function validateInput(string $caller, $input)
6161
return new \IteratorIterator($input);
6262
}
6363

64-
throw new InvalidArgumentException(sprintf('%s only accepts strings, Traversable objects or stream resources.', $caller));
64+
throw new InvalidArgumentException(sprintf('"%s" only accepts strings, Traversable objects or stream resources.', $caller));
6565
}
6666

6767
return $input;

src/Symfony/Component/Process/Tests/ProcessTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ public function testSetInputWhileRunningThrowsAnException()
293293
public function testInvalidInput($value)
294294
{
295295
$this->expectException('Symfony\Component\Process\Exception\InvalidArgumentException');
296-
$this->expectExceptionMessage('Symfony\Component\Process\Process::setInput only accepts strings, Traversable objects or stream resources.');
296+
$this->expectExceptionMessage('"Symfony\Component\Process\Process::setInput" only accepts strings, Traversable objects or stream resources.');
297297
$process = $this->getProcess('foo');
298298
$process->setInput($value);
299299
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\PropertyAccess\Tests\Fixtures;
13+
14+
class UninitializedPrivateProperty
15+
{
16+
private $uninitialized;
17+
18+
public function getUninitialized(): array
19+
{
20+
return $this->uninitialized;
21+
}
22+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\PropertyAccess\Tests\Fixtures;
13+
14+
class UninitializedProperty
15+
{
16+
public string $uninitialized;
17+
}

src/Symfony/Component/Security/Core/User/UserInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*
2222
* Regardless of how your users are loaded or where they come from (a database,
2323
* configuration, web service, etc.), you will have a class that implements
24-
* this interface. Objects that implement this interface are created and
24+
* this interface. Objects that implement this interface are created and
2525
* loaded by different objects that implement UserProviderInterface.
2626
*
2727
* @see UserProviderInterface

src/Symfony/Component/Security/Guard/Firewall/GuardAuthenticationListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ private function triggerRememberMe(AuthenticatorInterface $guardAuthenticator, R
218218
}
219219

220220
if (!$response instanceof Response) {
221-
throw new \LogicException(sprintf('%s::onAuthenticationSuccess *must* return a Response if you want to use the remember me functionality. Return a Response, or set remember_me to false under the guard configuration.', get_debug_type($guardAuthenticator)));
221+
throw new \LogicException(sprintf('"%s::onAuthenticationSuccess()" *must* return a Response if you want to use the remember me functionality. Return a Response, or set remember_me to false under the guard configuration.', get_debug_type($guardAuthenticator)));
222222
}
223223

224224
$this->rememberMeServices->loginSuccess($request, $response, $token);

src/Symfony/Component/Security/Guard/Provider/GuardAuthenticationProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ private function authenticateViaGuard(AuthenticatorInterface $guardAuthenticator
115115
$this->userChecker->checkPreAuth($user);
116116
if (true !== $checkCredentialsResult = $guardAuthenticator->checkCredentials($token->getCredentials(), $user)) {
117117
if (false !== $checkCredentialsResult) {
118-
throw new \TypeError(sprintf('%s::checkCredentials() must return a boolean value.', get_debug_type($guardAuthenticator)));
118+
throw new \TypeError(sprintf('"%s::checkCredentials()" must return a boolean value.', get_debug_type($guardAuthenticator)));
119119
}
120120

121121
throw new BadCredentialsException(sprintf('Authentication failed because "%s::checkCredentials()" did not return true.', get_debug_type($guardAuthenticator)));

src/Symfony/Component/VarDumper/Cloner/Data.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public function count()
122122
public function getIterator()
123123
{
124124
if (!\is_array($value = $this->getValue())) {
125-
throw new \LogicException(sprintf('%s object holds non-iterable type "%s".', self::class, get_debug_type($value)));
125+
throw new \LogicException(sprintf('"%s" object holds non-iterable type "%s".', self::class, get_debug_type($value)));
126126
}
127127

128128
yield from $value;

0 commit comments

Comments
 (0)
0