Skip to content

Commit c709d43

Browse files
committed
Merge branch '4.3' into 4.4
* 4.3: Remove Google references when not needed Simplify usage of dirname() Remove Google references when not needed
2 parents 1c3d409 + 1517d16 commit c709d43

File tree

20 files changed

+58
-57
lines changed

20 files changed

+58
-57
lines changed

.php_cs.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ return PhpCsFixer\Config::create()
2121
'native_function_invocation' => ['include' => ['@compiler_optimized'], 'scope' => 'namespaced', 'strict' => true],
2222
// Part of future @Symfony ruleset in PHP-CS-Fixer To be removed from the config file once upgrading
2323
'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'],
24+
'combine_nested_dirname' => true,
2425
])
2526
->setRiskyAllowed(true)
2627
->setFinder(

src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Deprecation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ private static function getVendors()
267267
foreach (get_declared_classes() as $class) {
268268
if ('C' === $class[0] && 0 === strpos($class, 'ComposerAutoloaderInit')) {
269269
$r = new \ReflectionClass($class);
270-
$v = \dirname(\dirname($r->getFileName()));
270+
$v = \dirname($r->getFileName(), 2);
271271
if (file_exists($v.'/composer/installed.json')) {
272272
self::$vendors[] = $v;
273273
$loader = require $v.'/autoload.php';

src/Symfony/Bridge/Twig/Tests/Extension/AbstractBootstrap3LayoutTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2578,31 +2578,31 @@ public function testTimezoneWithPlaceholder()
25782578

25792579
public function testUrlWithDefaultProtocol()
25802580
{
2581-
$url = 'http://www.google.com?foo1=bar1&foo2=bar2';
2581+
$url = 'http://www.example.com?foo1=bar1&foo2=bar2';
25822582
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\UrlType', $url, ['default_protocol' => 'http']);
25832583

25842584
$this->assertWidgetMatchesXpath($form->createView(), ['attr' => ['class' => 'my&class']],
25852585
'/input
25862586
[@type="text"]
25872587
[@name="name"]
25882588
[@class="my&class form-control"]
2589-
[@value="http://www.google.com?foo1=bar1&foo2=bar2"]
2589+
[@value="http://www.example.com?foo1=bar1&foo2=bar2"]
25902590
[@inputmode="url"]
25912591
'
25922592
);
25932593
}
25942594

25952595
public function testUrlWithoutDefaultProtocol()
25962596
{
2597-
$url = 'http://www.google.com?foo1=bar1&foo2=bar2';
2597+
$url = 'http://www.example.com?foo1=bar1&foo2=bar2';
25982598
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\UrlType', $url, ['default_protocol' => null]);
25992599

26002600
$this->assertWidgetMatchesXpath($form->createView(), ['attr' => ['class' => 'my&class']],
26012601
'/input
26022602
[@type="url"]
26032603
[@name="name"]
26042604
[@class="my&class form-control"]
2605-
[@value="http://www.google.com?foo1=bar1&foo2=bar2"]
2605+
[@value="http://www.example.com?foo1=bar1&foo2=bar2"]
26062606
'
26072607
);
26082608
}

src/Symfony/Bundle/FrameworkBundle/Client.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ protected function getScript($request)
169169
foreach (get_declared_classes() as $class) {
170170
if (0 === strpos($class, 'ComposerAutoloaderInit')) {
171171
$r = new \ReflectionClass($class);
172-
$file = \dirname(\dirname($r->getFileName())).'/autoload.php';
172+
$file = \dirname($r->getFileName(), 2).'/autoload.php';
173173
if (file_exists($file)) {
174174
$requires .= 'require_once '.var_export($file, true).";\n";
175175
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1148,7 +1148,7 @@ private function registerTranslatorConfiguration(array $config, ContainerBuilder
11481148
if (class_exists('Symfony\Component\Security\Core\Exception\AuthenticationException')) {
11491149
$r = new \ReflectionClass('Symfony\Component\Security\Core\Exception\AuthenticationException');
11501150

1151-
$dirs[] = $transPaths[] = \dirname(\dirname($r->getFileName())).'/Resources/translations';
1151+
$dirs[] = $transPaths[] = \dirname($r->getFileName(), 2).'/Resources/translations';
11521152
}
11531153
$defaultDir = $container->getParameterBag()->resolveValue($config['default_path']);
11541154
$rootDir = $container->getParameter('kernel.root_dir');

src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/CacheClearCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function testCacheIsFreshAfterCacheClearedWithWarmup()
6464
// check that app kernel file present in meta file of container's cache
6565
$containerClass = $this->kernel->getContainer()->getParameter('kernel.container_class');
6666
$containerRef = new \ReflectionClass($containerClass);
67-
$containerFile = \dirname(\dirname($containerRef->getFileName())).'/'.$containerClass.'.php';
67+
$containerFile = \dirname($containerRef->getFileName(), 2).'/'.$containerClass.'.php';
6868
$containerMetaFile = $containerFile.'.meta';
6969
$kernelRef = new \ReflectionObject($this->kernel);
7070
$kernelFile = $kernelRef->getFileName();

src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExtensionPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function process(ContainerBuilder $container)
4444
$container->getDefinition('twig.extension.form')->addTag('twig.extension');
4545
$reflClass = new \ReflectionClass('Symfony\Bridge\Twig\Extension\FormExtension');
4646

47-
$coreThemePath = \dirname(\dirname($reflClass->getFileName())).'/Resources/views/Form';
47+
$coreThemePath = \dirname($reflClass->getFileName(), 2).'/Resources/views/Form';
4848
$container->getDefinition('twig.loader.native_filesystem')->addMethodCall('addPath', [$coreThemePath]);
4949

5050
$paths = $container->getDefinition('twig.template_iterator')->getArgument(2);

src/Symfony/Component/BrowserKit/Tests/CookieTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ public function getTestsForToFromString()
4747
return [
4848
['foo=bar; path=/'],
4949
['foo=bar; path=/foo'],
50-
['foo=bar; domain=google.com; path=/'],
50+
['foo=bar; domain=example.com; path=/'],
5151
['foo=bar; domain=example.com; path=/; secure', 'https://example.com/'],
5252
['foo=bar; path=/; httponly'],
53-
['foo=bar; domain=google.com; path=/foo; secure; httponly', 'https://google.com/'],
53+
['foo=bar; domain=example.com; path=/foo; secure; httponly', 'https://example.com/'],
5454
['foo=bar=baz; path=/'],
5555
['foo=bar%3Dbaz; path=/'],
5656
];

src/Symfony/Component/Config/Resource/ComposerResource.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ private static function refresh()
6060
foreach (get_declared_classes() as $class) {
6161
if ('C' === $class[0] && 0 === strpos($class, 'ComposerAutoloaderInit')) {
6262
$r = new \ReflectionClass($class);
63-
$v = \dirname(\dirname($r->getFileName()));
63+
$v = \dirname($r->getFileName(), 2);
6464
if (file_exists($v.'/composer/installed.json')) {
6565
self::$runtimeVendors[$v] = @filemtime($v.'/composer/installed.json');
6666
}

src/Symfony/Component/Debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public static function setUpBeforeClass(): void
3535
}
3636

3737
if ($function[0] instanceof ComposerClassLoader) {
38-
$function[0]->add('Symfony_Component_Debug_Tests_Fixtures', \dirname(\dirname(\dirname(\dirname(\dirname(__DIR__))))));
38+
$function[0]->add('Symfony_Component_Debug_Tests_Fixtures', \dirname(__DIR__, 5));
3939
break;
4040
}
4141
}

src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public function testDumpRelativeDir()
107107
$container->setParameter('foo', 'wiz'.\dirname(__DIR__));
108108
$container->setParameter('bar', __DIR__);
109109
$container->setParameter('baz', '%bar%/PhpDumperTest.php');
110-
$container->setParameter('buz', \dirname(\dirname(__DIR__)));
110+
$container->setParameter('buz', \dirname(__DIR__, 2));
111111
$container->compile();
112112

113113
$dumper = new PhpDumper($container);

src/Symfony/Component/Form/Tests/AbstractLayoutTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2312,29 +2312,29 @@ public function testTimezoneWithPlaceholder()
23122312

23132313
public function testUrlWithDefaultProtocol()
23142314
{
2315-
$url = 'http://www.google.com?foo1=bar1&foo2=bar2';
2315+
$url = 'http://www.example.com?foo1=bar1&foo2=bar2';
23162316
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\UrlType', $url, ['default_protocol' => 'http']);
23172317

23182318
$this->assertWidgetMatchesXpath($form->createView(), [],
23192319
'/input
23202320
[@type="text"]
23212321
[@name="name"]
2322-
[@value="http://www.google.com?foo1=bar1&foo2=bar2"]
2322+
[@value="http://www.example.com?foo1=bar1&foo2=bar2"]
23232323
[@inputmode="url"]
23242324
'
23252325
);
23262326
}
23272327

23282328
public function testUrlWithoutDefaultProtocol()
23292329
{
2330-
$url = 'http://www.google.com?foo1=bar1&foo2=bar2';
2330+
$url = 'http://www.example.com?foo1=bar1&foo2=bar2';
23312331
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\UrlType', $url, ['default_protocol' => null]);
23322332

23332333
$this->assertWidgetMatchesXpath($form->createView(), [],
23342334
'/input
23352335
[@type="url"]
23362336
[@name="name"]
2337-
[@value="http://www.google.com?foo1=bar1&foo2=bar2"]
2337+
[@value="http://www.example.com?foo1=bar1&foo2=bar2"]
23382338
'
23392339
);
23402340
}

src/Symfony/Component/Form/Tests/Resources/TranslationFilesTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ public function provideTranslationFiles()
2929
{
3030
return array_map(
3131
function ($filePath) { return (array) $filePath; },
32-
glob(\dirname(\dirname(__DIR__)).'/Resources/translations/*.xlf')
32+
glob(\dirname(__DIR__, 2).'/Resources/translations/*.xlf')
3333
);
3434
}
3535

3636
public function testNorwegianAlias()
3737
{
3838
$this->assertFileEquals(
39-
\dirname(\dirname(__DIR__)).'/Resources/translations/validators.nb.xlf',
40-
\dirname(\dirname(__DIR__)).'/Resources/translations/validators.no.xlf',
39+
\dirname(__DIR__, 2).'/Resources/translations/validators.nb.xlf',
40+
\dirname(__DIR__, 2).'/Resources/translations/validators.no.xlf',
4141
'The NO locale should be an alias for the NB variant of the Norwegian language.'
4242
);
4343
}

src/Symfony/Component/HttpKernel/Client.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ protected function getScript($request)
8787
foreach (get_declared_classes() as $class) {
8888
if (0 === strpos($class, 'ComposerAutoloaderInit')) {
8989
$r = new \ReflectionClass($class);
90-
$file = \dirname(\dirname($r->getFileName())).'/autoload.php';
90+
$file = \dirname($r->getFileName(), 2).'/autoload.php';
9191
if (file_exists($file)) {
9292
$requires .= 'require_once '.var_export($file, true).";\n";
9393
}

src/Symfony/Component/HttpKernel/Tests/HttpKernelBrowserTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ public function testDoRequest()
3939
$this->assertEquals('Request: /', $client->getResponse()->getContent(), '->doRequest() uses the request handler to make the request');
4040
$this->assertEquals('www.example.com', $client->getRequest()->getHost(), '->doRequest() uses the request handler to make the request');
4141

42-
$client->request('GET', 'http://www.example.com/?parameter=http://google.com');
43-
$this->assertEquals('http://www.example.com/?parameter='.urlencode('http://google.com'), $client->getRequest()->getUri(), '->doRequest() uses the request handler to make the request');
42+
$client->request('GET', 'http://www.example.com/?parameter=http://example.com');
43+
$this->assertEquals('http://www.example.com/?parameter='.urlencode('http://example.com'), $client->getRequest()->getUri(), '->doRequest() uses the request handler to make the request');
4444
}
4545

4646
public function testGetScript()

src/Symfony/Component/Security/Core/Tests/Resources/TranslationFilesTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ public function provideTranslationFiles()
2929
{
3030
return array_map(
3131
function ($filePath) { return (array) $filePath; },
32-
glob(\dirname(\dirname(__DIR__)).'/Resources/translations/*.xlf')
32+
glob(\dirname(__DIR__, 2).'/Resources/translations/*.xlf')
3333
);
3434
}
3535

3636
public function testNorwegianAlias()
3737
{
3838
$this->assertFileEquals(
39-
\dirname(\dirname(__DIR__)).'/Resources/translations/security.nb.xlf',
40-
\dirname(\dirname(__DIR__)).'/Resources/translations/security.no.xlf',
39+
\dirname(__DIR__, 2).'/Resources/translations/security.nb.xlf',
40+
\dirname(__DIR__, 2).'/Resources/translations/security.no.xlf',
4141
'The NO locale should be an alias for the NB variant of the Norwegian language.'
4242
);
4343
}

src/Symfony/Component/Validator/Tests/Constraints/UrlValidatorTest.php

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public function testValidRelativeUrl($url)
9191
public function getValidRelativeUrls()
9292
{
9393
return [
94-
['//google.com'],
94+
['//example.com'],
9595
['//symfony.fake/blog/'],
9696
['//symfony.com/search?type=&q=url+validator'],
9797
];
@@ -101,11 +101,11 @@ public function getValidUrls()
101101
{
102102
return [
103103
['http://a.pl'],
104-
['http://www.google.com'],
105-
['http://www.google.com.'],
106-
['http://www.google.museum'],
107-
['https://google.com/'],
108-
['https://google.com:80/'],
104+
['http://www.example.com'],
105+
['http://www.example.com.'],
106+
['http://www.example.museum'],
107+
['https://example.com/'],
108+
['https://example.com:80/'],
109109
['http://www.example.coop/'],
110110
['http://www.test-example.com/'],
111111
['http://www.symfony.com/'],
@@ -166,11 +166,11 @@ public function getValidUrls()
166166
public function getValidUrlsWithWhitespaces()
167167
{
168168
return [
169-
["\x20http://www.google.com"],
170-
["\x09\x09http://www.google.com."],
169+
["\x20http://www.example.com"],
170+
["\x09\x09http://www.example.com."],
171171
["http://symfony.fake/blog/\x0A"],
172172
["http://symfony.com/search?type=&q=url+validator\x0D\x0D"],
173-
["\x00https://google.com:80\x00"],
173+
["\x00https://example.com:80\x00"],
174174
["\x0B\x0Bhttp://username:[email protected]\x0B\x0B"],
175175
];
176176
}
@@ -214,10 +214,10 @@ public function testInvalidRelativeUrl($url)
214214
public function getInvalidRelativeUrls()
215215
{
216216
return [
217-
['/google.com'],
218-
['//goog_le.com'],
219-
['//google.com::aa'],
220-
['//google.com:aa'],
217+
['/example.com'],
218+
['//examp_le.com'],
219+
['//example.com::aa'],
220+
['//example.com:aa'],
221221
['//127.0.0.1:aa/'],
222222
['//[::1'],
223223
['//hello.☎/'],
@@ -235,15 +235,15 @@ public function getInvalidRelativeUrls()
235235
public function getInvalidUrls()
236236
{
237237
return [
238-
['google.com'],
239-
['://google.com'],
240-
['http ://google.com'],
241-
['http:/google.com'],
242-
['http://goog_le.com'],
243-
['http://google.com::aa'],
244-
['http://google.com:aa'],
245-
['ftp://google.fr'],
246-
['faked://google.fr'],
238+
['example.com'],
239+
['://example.com'],
240+
['http ://example.com'],
241+
['http:/example.com'],
242+
['http://examp_le.com'],
243+
['http://example.com::aa'],
244+
['http://example.com:aa'],
245+
['ftp://example.fr'],
246+
['faked://example.fr'],
247247
['http://127.0.0.1:aa/'],
248248
['ftp://[::1]/'],
249249
['http://[::1'],
@@ -276,7 +276,7 @@ public function testCustomProtocolIsValid($url)
276276
public function getValidCustomUrls()
277277
{
278278
return [
279-
['ftp://google.com'],
279+
['ftp://example.com'],
280280
['file://127.0.0.1'],
281281
['git://[::1]/'],
282282
];

src/Symfony/Component/Validator/Tests/Resources/TranslationFilesTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ public function provideTranslationFiles()
2929
{
3030
return array_map(
3131
function ($filePath) { return (array) $filePath; },
32-
glob(\dirname(\dirname(__DIR__)).'/Resources/translations/*.xlf')
32+
glob(\dirname(__DIR__, 2).'/Resources/translations/*.xlf')
3333
);
3434
}
3535

3636
public function testNorwegianAlias()
3737
{
3838
$this->assertFileEquals(
39-
\dirname(\dirname(__DIR__)).'/Resources/translations/validators.nb.xlf',
40-
\dirname(\dirname(__DIR__)).'/Resources/translations/validators.no.xlf',
39+
\dirname(__DIR__, 2).'/Resources/translations/validators.nb.xlf',
40+
\dirname(__DIR__, 2).'/Resources/translations/validators.no.xlf',
4141
'The NO locale should be an alias for the NB variant of the Norwegian language.'
4242
);
4343
}

src/Symfony/Component/VarDumper/Caster/LinkStub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ private function getComposerRoot(string $file, bool &$inVendor)
7171
foreach (get_declared_classes() as $class) {
7272
if ('C' === $class[0] && 0 === strpos($class, 'ComposerAutoloaderInit')) {
7373
$r = new \ReflectionClass($class);
74-
$v = \dirname(\dirname($r->getFileName()));
74+
$v = \dirname($r->getFileName(), 2);
7575
if (file_exists($v.'/composer/installed.json')) {
7676
self::$vendorRoots[] = $v.\DIRECTORY_SEPARATOR;
7777
}

src/Symfony/Component/VarDumper/Tests/Caster/SplCasterTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,12 @@ public function getCastFileInfoTests()
5050
%A}
5151
EOTXT
5252
],
53-
['https://google.com/about', <<<'EOTXT'
53+
['https://example.com/about', <<<'EOTXT'
5454
SplFileInfo {
55-
%Apath: "https://google.com"
55+
%Apath: "https://example.com"
5656
filename: "about"
5757
basename: "about"
58-
pathname: "https://google.com/about"
58+
pathname: "https://example.com/about"
5959
extension: ""
6060
realPath: false
6161
%A}

0 commit comments

Comments
 (0)