Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3cd7726

Browse filesBrowse files
Merge branch '3.4' into 4.3
* 3.4: [ProxyManagerBridge] Polyfill for unmaintained version SCA: dropped unused mocks, duplicate import and a function alias usage [Config] fix test Improve fa (persian) translation
2 parents 465da03 + 4123465 commit 3cd7726
Copy full SHA for 3cd7726

File tree

Expand file treeCollapse file tree

12 files changed

+116
-32
lines changed
Filter options
Expand file treeCollapse file tree

12 files changed

+116
-32
lines changed

‎composer.json

Copy file name to clipboardExpand all lines: composer.json
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@
136136
"Symfony\\Component\\": "src/Symfony/Component/"
137137
},
138138
"classmap": [
139-
"src/Symfony/Component/Intl/Resources/stubs"
139+
"src/Symfony/Component/Intl/Resources/stubs",
140+
"src/Symfony/Bridge/ProxyManager/Legacy/ProxiedMethodReturnExpression.php"
140141
],
141142
"exclude-from-classmap": [
142143
"**/Tests/"

‎src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ public function getProxyCode(Definition $definition)
9494
);
9595
}
9696

97+
if (version_compare(self::getProxyManagerVersion(), '2.5', '<')) {
98+
$code = str_replace(' \Closure::bind(function ', ' \Closure::bind(static function ', $code);
99+
}
100+
97101
return $code;
98102
}
99103

+73Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<?php
2+
/*
3+
* This file is part of the Symfony package.
4+
*
5+
* (c) Fabien Potencier <fabien@symfony.com>
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
11+
namespace ProxyManager\Generator\Util;
12+
13+
use Composer\Autoload\ClassLoader;
14+
use ProxyManager\Version;
15+
16+
if (class_exists(Version::class) && version_compare(\defined(Version::class.'::VERSION') ? Version::VERSION : Version::getVersion(), '2.5', '<')) {
17+
/**
18+
* Utility class to generate return expressions in method, given a method signature.
19+
*
20+
* This is required since return expressions may be forbidden by the method signature (void).
21+
*
22+
* @author Marco Pivetta <ocramius@gmail.com>
23+
* @license MIT
24+
*
25+
* @see https://github.com/Ocramius/ProxyManager
26+
*/
27+
final class ProxiedMethodReturnExpression
28+
{
29+
public static function generate(string $returnedValueExpression, ?\ReflectionMethod $originalMethod): string
30+
{
31+
$originalReturnType = null === $originalMethod ? null : $originalMethod->getReturnType();
32+
33+
$originalReturnTypeName = null === $originalReturnType ? null : $originalReturnType->getName();
34+
35+
if ('void' === $originalReturnTypeName) {
36+
return $returnedValueExpression.";\nreturn;";
37+
}
38+
39+
return 'return '.$returnedValueExpression.';';
40+
}
41+
}
42+
} else {
43+
// Fallback to the original class by unregistering this file from composer class loader
44+
$getComposerClassLoader = static function ($functionLoader) use (&$getComposerClassLoader) {
45+
if (\is_array($functionLoader)) {
46+
$functionLoader = $functionLoader[0];
47+
}
48+
if (!\is_object($functionLoader)) {
49+
return;
50+
}
51+
if ($functionLoader instanceof ClassLoader) {
52+
return $functionLoader;
53+
}
54+
if ($functionLoader instanceof \Symfony\Component\Debug\DebugClassLoader) {
55+
return $getComposerClassLoader($functionLoader->getClassLoader());
56+
}
57+
if ($functionLoader instanceof \Symfony\Component\ErrorHandler\DebugClassLoader) {
58+
return $getComposerClassLoader($functionLoader->getClassLoader());
59+
}
60+
};
61+
62+
$classLoader = null;
63+
$functions = spl_autoload_functions();
64+
while (null === $classLoader && $functions) {
65+
$classLoader = $getComposerClassLoader(array_shift($functions));
66+
}
67+
$getComposerClassLoader = null;
68+
69+
if (null !== $classLoader) {
70+
$classLoader->addClassMap([ProxiedMethodReturnExpression::class => null]);
71+
$classLoader->loadClass(ProxiedMethodReturnExpression::class);
72+
}
73+
}

‎src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/ProxyDumperTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/ProxyDumperTest.php
+15Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Bridge\ProxyManager\Tests\LazyProxy\PhpDumper;
1313

1414
use PHPUnit\Framework\TestCase;
15+
use ProxyManager\Version;
1516
use Symfony\Bridge\ProxyManager\LazyProxy\PhpDumper\ProxyDumper;
1617
use Symfony\Component\DependencyInjection\Definition;
1718
use Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\DumperInterface;
@@ -59,6 +60,20 @@ public function testGetProxyCode()
5960
);
6061
}
6162

63+
public function testStaticBinding()
64+
{
65+
if (!class_exists(Version::class) || version_compare(\defined(Version::class.'::VERSION') ? Version::VERSION : Version::getVersion(), '2.1', '<')) {
66+
$this->markTestSkipped('ProxyManager prior to version 2.1 does not support static binding');
67+
}
68+
69+
$definition = new Definition(__CLASS__);
70+
$definition->setLazy(true);
71+
72+
$code = $this->dumper->getProxyCode($definition);
73+
74+
$this->assertStringContainsString('\Closure::bind(static function (\PHPUnit\Framework\TestCase $instance) {', $code);
75+
}
76+
6277
public function testDeterministicProxyCode()
6378
{
6479
$definition = new Definition(__CLASS__);

‎src/Symfony/Bridge/ProxyManager/composer.json

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/ProxyManager/composer.json
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
},
2929
"autoload": {
3030
"psr-4": { "Symfony\\Bridge\\ProxyManager\\": "" },
31+
"classmap": [ "Legacy/ProxiedMethodReturnExpression.php" ],
3132
"exclude-from-classmap": [
3233
"/Tests/"
3334
]

‎src/Symfony/Component/Config/Tests/Definition/Builder/NumericNodeDefinitionTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Config/Tests/Definition/Builder/NumericNodeDefinitionTest.php
+3-4Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,22 @@
1414
use PHPUnit\Framework\TestCase;
1515
use Symfony\Component\Config\Definition\Builder\FloatNodeDefinition;
1616
use Symfony\Component\Config\Definition\Builder\IntegerNodeDefinition;
17-
use Symfony\Component\Config\Definition\Builder\IntegerNodeDefinition as NumericNodeDefinition;
1817

1918
class NumericNodeDefinitionTest extends TestCase
2019
{
2120
public function testIncoherentMinAssertion()
2221
{
2322
$this->expectException('InvalidArgumentException');
2423
$this->expectExceptionMessage('You cannot define a min(4) as you already have a max(3)');
25-
$def = new NumericNodeDefinition('foo');
24+
$def = new IntegerNodeDefinition('foo');
2625
$def->max(3)->min(4);
2726
}
2827

2928
public function testIncoherentMaxAssertion()
3029
{
3130
$this->expectException('InvalidArgumentException');
3231
$this->expectExceptionMessage('You cannot define a max(2) as you already have a min(3)');
33-
$node = new NumericNodeDefinition('foo');
32+
$node = new IntegerNodeDefinition('foo');
3433
$node->min(3)->max(2);
3534
}
3635

@@ -84,7 +83,7 @@ public function testCannotBeEmptyThrowsAnException()
8483
{
8584
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidDefinitionException');
8685
$this->expectExceptionMessage('->cannotBeEmpty() is not applicable to NumericNodeDefinition.');
87-
$def = new NumericNodeDefinition('foo');
86+
$def = new IntegerNodeDefinition('foo');
8887
$def->cannotBeEmpty();
8988
}
9089
}

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Ldap/Tests/LdapTestCase.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ protected function getLdapConfig()
1414
$this->markTestSkipped('No server is listening on LDAP_HOST:LDAP_PORT');
1515
}
1616

17-
ldap_close($h);
17+
ldap_unbind($h);
1818

1919
return [
2020
'host' => getenv('LDAP_HOST'),

‎src/Symfony/Component/Security/Core/Resources/translations/security.fa.xlf

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Core/Resources/translations/security.fa.xlf
+17-13Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,39 +4,43 @@
44
<body>
55
<trans-unit id="1">
66
<source>An authentication exception occurred.</source>
7-
<target>خطایی هنگام تعیین اعتبار اتفاق افتاد.</target>
7+
<target>خطایی هنگام احراز هویت رخ داده است.</target>
88
</trans-unit>
99
<trans-unit id="2">
1010
<source>Authentication credentials could not be found.</source>
11-
<target>شرایط تعیین اعتبار پیدا نشد.</target>
11+
<target>شرایط احراز هویت یافت نشد.</target>
1212
</trans-unit>
1313
<trans-unit id="3">
1414
<source>Authentication request could not be processed due to a system problem.</source>
15-
<target>درخواست تعیین اعتبار به دلیل مشکل سیستم قابل بررسی نیست.</target>
15+
<target>درخواست احراز هویت به دلیل وجود مشکل در سیستم قابل پردازش نمی باشد.</target>
1616
</trans-unit>
1717
<trans-unit id="4">
1818
<source>Invalid credentials.</source>
19-
<target>شرایط نامعتبر.</target>
19+
<target>احراز هویت نامعتبر می باشد.</target>
2020
</trans-unit>
2121
<trans-unit id="5">
2222
<source>Cookie has already been used by someone else.</source>
23-
<target>کوکی قبلا برای شخص دیگری استفاده شده است.</target>
23+
<target>Cookie قبلا توسط شخص دیگری استفاده گردیده است.</target>
2424
</trans-unit>
2525
<trans-unit id="6">
2626
<source>Not privileged to request the resource.</source>
27-
<target>دسترسی لازم برای درخواست این منبع را ندارید.</target>
27+
<target>دسترسی لازم برای درخواست از این منبع را دارا نمی باشید.</target>
2828
</trans-unit>
2929
<trans-unit id="7">
3030
<source>Invalid CSRF token.</source>
31-
<target>توکن CSRF معتبر نیست.</target>
31+
<target>توکن CSRF معتبر نمی باشد.</target>
32+
</trans-unit>
33+
<trans-unit id="8">
34+
<source>Digest nonce has expired.</source>
35+
<target>Digest nonce منقضی گردیده است.</target>
3236
</trans-unit>
3337
<trans-unit id="9">
3438
<source>No authentication provider found to support the authentication token.</source>
35-
<target>هیچ ارایه کننده تعیین اعتباری برای ساپورت توکن تعیین اعتبار پیدا نشد.</target>
39+
<target>هیچ ارایه دهنده احراز هویتی برای پشتیبانی از توکن احراز هویت پیدا نشد.</target>
3640
</trans-unit>
3741
<trans-unit id="10">
3842
<source>No session available, it either timed out or cookies are not enabled.</source>
39-
<target>جلسه‌ای در دسترس نیست. این میتواند یا به دلیل پایان یافتن زمان باشد یا اینکه کوکی ها فعال نیستند.</target>
43+
<target>هیچ جلسه‌ای در دسترس نمی باشد. این میتواند به دلیل پایان یافتن زمان و یا فعال نبودن کوکی ها باشد.</target>
4044
</trans-unit>
4145
<trans-unit id="11">
4246
<source>No token could be found.</source>
@@ -48,19 +52,19 @@
4852
</trans-unit>
4953
<trans-unit id="13">
5054
<source>Account has expired.</source>
51-
<target>حساب کاربری منقضی شده است.</target>
55+
<target>حساب کاربری منقضی گردیده است.</target>
5256
</trans-unit>
5357
<trans-unit id="14">
5458
<source>Credentials have expired.</source>
55-
<target>پارامترهای تعیین اعتبار منقضی شده‌اند.</target>
59+
<target>مجوزهای احراز هویت منقضی گردیده‌اند.</target>
5660
</trans-unit>
5761
<trans-unit id="15">
5862
<source>Account is disabled.</source>
59-
<target>حساب کاربری غیرفعال است.</target>
63+
<target>حساب کاربری غیرفعال می باشد.</target>
6064
</trans-unit>
6165
<trans-unit id="16">
6266
<source>Account is locked.</source>
63-
<target>حساب کاربری قفل شده است.</target>
67+
<target>حساب کاربری قفل گردیده است.</target>
6468
</trans-unit>
6569
</body>
6670
</file>

‎src/Symfony/Component/Security/Guard/Tests/GuardAuthenticatorHandlerTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Guard/Tests/GuardAuthenticatorHandlerTest.php
-7Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,6 @@ public function testHandleAuthenticationFailure()
8989
*/
9090
public function testHandleAuthenticationClearsToken($tokenClass, $tokenProviderKey, $actualProviderKey)
9191
{
92-
$token = $this->getMockBuilder($tokenClass)
93-
->disableOriginalConstructor()
94-
->getMock();
95-
$token->expects($this->any())
96-
->method('getProviderKey')
97-
->willReturn($tokenProviderKey);
98-
9992
$this->tokenStorage->expects($this->never())
10093
->method('setToken')
10194
->with(null);

‎src/Symfony/Component/Security/Http/Tests/Firewall/BasicAuthenticationListenerTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Http/Tests/Firewall/BasicAuthenticationListenerTest.php
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@ public function testHandleWhenAuthenticationFails()
7575
'PHP_AUTH_PW' => 'ThePassword',
7676
]);
7777

78-
$token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock();
79-
8078
$tokenStorage = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')->getMock();
8179
$tokenStorage
8280
->expects($this->any())

‎src/Symfony/Component/Security/Http/Tests/RememberMe/AbstractRememberMeServicesTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Http/Tests/RememberMe/AbstractRememberMeServicesTest.php
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ public function testLoginSuccessIsNotProcessedWhenTokenDoesNotContainUserInterfa
124124
$service = $this->getService(null, ['name' => 'foo', 'always_remember_me' => true, 'path' => null, 'domain' => null]);
125125
$request = new Request();
126126
$response = new Response();
127-
$account = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock();
128127
$token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock();
129128
$token
130129
->expects($this->once())

‎src/Symfony/Component/Translation/Tests/DependencyInjection/TranslationExtractorPassTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Translation/Tests/DependencyInjection/TranslationExtractorPassTest.php
-3Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,11 @@ public function testProcessMissingAlias()
5050
{
5151
$this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
5252
$this->expectExceptionMessage('The alias for the tag "translation.extractor" of service "foo.id" must be set.');
53-
$definition = $this->getMockBuilder('Symfony\Component\DependencyInjection\Definition')->disableOriginalConstructor()->getMock();
5453
$container = new ContainerBuilder();
5554
$container->register('translation.extractor');
5655
$container->register('foo.id')
5756
->addTag('translation.extractor', []);
5857

59-
$definition->expects($this->never())->method('addMethodCall');
60-
6158
$translationDumperPass = new TranslationExtractorPass();
6259
$translationDumperPass->process($container);
6360
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.