Skip to content

Commit 5937616

Browse files
committed
Merge branch '7.1' into 7.2
* 7.1: Mitigate PHPUnit deprecations [TwigBundle] Add support for resetting globals between HTTP requests [Process] Fix backwards compatibility for invalid commands Mitigate PHPUnit deprecations [Cache] Fix compatibility with Redis 6.1.0 pre-releases [Validator] Add Catalan and Spanish translation for `Week` constraint Don't use is_resource() on non-streams [Ldap] Fix extension deprecation
2 parents 542891f + 716ab58 commit 5937616

File tree

19 files changed

+57
-49
lines changed

19 files changed

+57
-49
lines changed

src/Symfony/Bridge/Doctrine/Tests/ArgumentResolver/EntityValueResolverTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ public function testResolveWithConversionFailedException()
168168
$repository->expects($this->once())
169169
->method('find')
170170
->with('test')
171-
->will($this->throwException(new ConversionException()));
171+
->willThrowException(new ConversionException());
172172

173173
$manager->expects($this->once())
174174
->method('getRepository')
@@ -453,7 +453,7 @@ public function testExpressionSyntaxErrorThrowsException()
453453

454454
$language->expects($this->once())
455455
->method('evaluate')
456-
->will($this->throwException(new SyntaxError('syntax error message', 10)));
456+
->willThrowException(new SyntaxError('syntax error message', 10));
457457

458458
$this->expectException(\LogicException::class);
459459
$this->expectExceptionMessage('syntax error message around position 10');

src/Symfony/Bridge/Doctrine/Tests/Messenger/DoctrineCloseConnectionMiddlewareTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function testInvalidEntityManagerThrowsException()
6363
$managerRegistry
6464
->method('getManager')
6565
->with('unknown_manager')
66-
->will($this->throwException(new \InvalidArgumentException()));
66+
->willThrowException(new \InvalidArgumentException());
6767

6868
$middleware = new DoctrineCloseConnectionMiddleware($managerRegistry, 'unknown_manager');
6969

src/Symfony/Bridge/Doctrine/Tests/Messenger/DoctrinePingConnectionMiddlewareTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public function testInvalidEntityManagerThrowsException()
101101
$managerRegistry
102102
->method('getManager')
103103
->with('unknown_manager')
104-
->will($this->throwException(new \InvalidArgumentException()));
104+
->willThrowException(new \InvalidArgumentException());
105105

106106
$middleware = new DoctrinePingConnectionMiddleware($managerRegistry, 'unknown_manager');
107107

src/Symfony/Bridge/Doctrine/Tests/Messenger/DoctrineTransactionMiddlewareTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function testInvalidEntityManagerThrowsException()
7575
$managerRegistry
7676
->method('getManager')
7777
->with('unknown_manager')
78-
->will($this->throwException(new \InvalidArgumentException()));
78+
->willThrowException(new \InvalidArgumentException());
7979

8080
$middleware = new DoctrineTransactionMiddleware($managerRegistry, 'unknown_manager');
8181

src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
use Symfony\Component\Translation\LocaleSwitcher;
2626
use Symfony\Component\Translation\Translator;
2727
use Symfony\Contracts\Service\ResetInterface;
28+
use Twig\Environment;
2829
use Twig\Extension\ExtensionInterface;
2930
use Twig\Extension\RuntimeExtensionInterface;
3031
use Twig\Loader\LoaderInterface;
@@ -42,6 +43,10 @@ public function load(array $configs, ContainerBuilder $container): void
4243
$loader = new PhpFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
4344
$loader->load('twig.php');
4445

46+
if (method_exists(Environment::class, 'resetGlobals')) {
47+
$container->getDefinition('twig')->addTag('kernel.reset', ['method' => 'resetGlobals']);
48+
}
49+
4550
if ($container::willBeAvailable('symfony/form', Form::class, ['symfony/twig-bundle'])) {
4651
$loader->load('form.php');
4752

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

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

1212
namespace Symfony\Component\Cache\Traits;
1313

14-
if (version_compare(phpversion('redis'), '6.1.0', '>=')) {
14+
if (version_compare(phpversion('redis'), '6.1.0-dev', '>=')) {
1515
/**
1616
* @internal
1717
*/
@@ -27,7 +27,7 @@ public function hRandField($key, $options = null): \Redis|array|string|false
2727
return $this->initializeLazyObject()->hRandField(...\func_get_args());
2828
}
2929

30-
public function hSet($key, $fields_and_vals): \Redis|false|int
30+
public function hSet($key, ...$fields_and_vals): \Redis|false|int
3131
{
3232
return $this->initializeLazyObject()->hSet(...\func_get_args());
3333
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
namespace Symfony\Component\Cache\Traits;
1313

14-
if (version_compare(phpversion('redis'), '6.1.0', '>')) {
14+
if (version_compare(phpversion('redis'), '6.1.0-dev', '>')) {
1515
/**
1616
* @internal
1717
*/

src/Symfony/Component/Console/Terminal.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,7 @@ private static function readFromProcess(string|array $command): ?string
209209

210210
$cp = \function_exists('sapi_windows_cp_set') ? sapi_windows_cp_get() : 0;
211211

212-
$process = proc_open($command, $descriptorspec, $pipes, null, null, ['suppress_errors' => true]);
213-
if (!\is_resource($process)) {
212+
if (!$process = proc_open($command, $descriptorspec, $pipes, null, null, ['suppress_errors' => true])) {
214213
return null;
215214
}
216215

src/Symfony/Component/HttpKernel/Log/Logger.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public function __construct(?string $minLevel = null, $output = null, ?callable
7979

8080
$this->minLevelIndex = self::LEVELS[$minLevel];
8181
$this->formatter = null !== $formatter ? $formatter(...) : $this->format(...);
82-
if ($output && false === $this->handle = \is_resource($output) ? $output : @fopen($output, 'a')) {
82+
if ($output && false === $this->handle = \is_string($output) ? @fopen($output, 'a') : $output) {
8383
throw new InvalidArgumentException(\sprintf('Unable to open "%s".', $output));
8484
}
8585
$this->debug = $debug;

src/Symfony/Component/Ldap/Tests/LdapTestCase.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@ class LdapTestCase extends TestCase
1717
{
1818
protected function getLdapConfig()
1919
{
20-
$h = @ldap_connect(getenv('LDAP_HOST'), getenv('LDAP_PORT'));
20+
if (\PHP_VERSION_ID < 80300) {
21+
$h = @ldap_connect(getenv('LDAP_HOST'), getenv('LDAP_PORT'));
22+
} else {
23+
$h = @ldap_connect('ldap://'.getenv('LDAP_HOST').':'.getenv('LDAP_PORT'));
24+
}
25+
2126
@ldap_set_option($h, \LDAP_OPT_PROTOCOL_VERSION, 3);
2227

2328
if (!$h || !@ldap_bind($h)) {

0 commit comments

Comments
 (0)