Skip to content
Permalink
Browse files

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
  • Loading branch information...
fabpot committed Sep 10, 2019
2 parents 1c3d409 + 1517d16 commit c709d43878ba1c2a23a0036d07b287c4dcf46708
Showing with 58 additions and 57 deletions.
  1. +1 −0 .php_cs.dist
  2. +1 −1 src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Deprecation.php
  3. +4 −4 src/Symfony/Bridge/Twig/Tests/Extension/AbstractBootstrap3LayoutTest.php
  4. +1 −1 src/Symfony/Bundle/FrameworkBundle/Client.php
  5. +1 −1 src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
  6. +1 −1 src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/CacheClearCommandTest.php
  7. +1 −1 src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExtensionPass.php
  8. +2 −2 src/Symfony/Component/BrowserKit/Tests/CookieTest.php
  9. +1 −1 src/Symfony/Component/Config/Resource/ComposerResource.php
  10. +1 −1 src/Symfony/Component/Debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php
  11. +1 −1 src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php
  12. +4 −4 src/Symfony/Component/Form/Tests/AbstractLayoutTest.php
  13. +3 −3 src/Symfony/Component/Form/Tests/Resources/TranslationFilesTest.php
  14. +1 −1 src/Symfony/Component/HttpKernel/Client.php
  15. +2 −2 src/Symfony/Component/HttpKernel/Tests/HttpKernelBrowserTest.php
  16. +3 −3 src/Symfony/Component/Security/Core/Tests/Resources/TranslationFilesTest.php
  17. +23 −23 src/Symfony/Component/Validator/Tests/Constraints/UrlValidatorTest.php
  18. +3 −3 src/Symfony/Component/Validator/Tests/Resources/TranslationFilesTest.php
  19. +1 −1 src/Symfony/Component/VarDumper/Caster/LinkStub.php
  20. +3 −3 src/Symfony/Component/VarDumper/Tests/Caster/SplCasterTest.php
@@ -21,6 +21,7 @@ return PhpCsFixer\Config::create()
'native_function_invocation' => ['include' => ['@compiler_optimized'], 'scope' => 'namespaced', 'strict' => true],
// Part of future @Symfony ruleset in PHP-CS-Fixer To be removed from the config file once upgrading
'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'],
'combine_nested_dirname' => true,
])
->setRiskyAllowed(true)
->setFinder(
@@ -267,7 +267,7 @@ private static function getVendors()
foreach (get_declared_classes() as $class) {
if ('C' === $class[0] && 0 === strpos($class, 'ComposerAutoloaderInit')) {
$r = new \ReflectionClass($class);
$v = \dirname(\dirname($r->getFileName()));
$v = \dirname($r->getFileName(), 2);
if (file_exists($v.'/composer/installed.json')) {
self::$vendors[] = $v;
$loader = require $v.'/autoload.php';
@@ -2578,31 +2578,31 @@ public function testTimezoneWithPlaceholder()
public function testUrlWithDefaultProtocol()
{
$url = 'http://www.google.com?foo1=bar1&foo2=bar2';
$url = 'http://www.example.com?foo1=bar1&foo2=bar2';
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\UrlType', $url, ['default_protocol' => 'http']);
$this->assertWidgetMatchesXpath($form->createView(), ['attr' => ['class' => 'my&class']],
'/input
[@type="text"]
[@name="name"]
[@class="my&class form-control"]
[@value="http://www.google.com?foo1=bar1&foo2=bar2"]
[@value="http://www.example.com?foo1=bar1&foo2=bar2"]
[@inputmode="url"]
'
);
}
public function testUrlWithoutDefaultProtocol()
{
$url = 'http://www.google.com?foo1=bar1&foo2=bar2';
$url = 'http://www.example.com?foo1=bar1&foo2=bar2';
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\UrlType', $url, ['default_protocol' => null]);
$this->assertWidgetMatchesXpath($form->createView(), ['attr' => ['class' => 'my&class']],
'/input
[@type="url"]
[@name="name"]
[@class="my&class form-control"]
[@value="http://www.google.com?foo1=bar1&foo2=bar2"]
[@value="http://www.example.com?foo1=bar1&foo2=bar2"]
'
);
}
@@ -169,7 +169,7 @@ protected function getScript($request)
foreach (get_declared_classes() as $class) {
if (0 === strpos($class, 'ComposerAutoloaderInit')) {
$r = new \ReflectionClass($class);
$file = \dirname(\dirname($r->getFileName())).'/autoload.php';
$file = \dirname($r->getFileName(), 2).'/autoload.php';
if (file_exists($file)) {
$requires .= 'require_once '.var_export($file, true).";\n";
}
@@ -1148,7 +1148,7 @@ private function registerTranslatorConfiguration(array $config, ContainerBuilder
if (class_exists('Symfony\Component\Security\Core\Exception\AuthenticationException')) {
$r = new \ReflectionClass('Symfony\Component\Security\Core\Exception\AuthenticationException');
$dirs[] = $transPaths[] = \dirname(\dirname($r->getFileName())).'/Resources/translations';
$dirs[] = $transPaths[] = \dirname($r->getFileName(), 2).'/Resources/translations';
}
$defaultDir = $container->getParameterBag()->resolveValue($config['default_path']);
$rootDir = $container->getParameter('kernel.root_dir');
@@ -64,7 +64,7 @@ public function testCacheIsFreshAfterCacheClearedWithWarmup()
// check that app kernel file present in meta file of container's cache
$containerClass = $this->kernel->getContainer()->getParameter('kernel.container_class');
$containerRef = new \ReflectionClass($containerClass);
$containerFile = \dirname(\dirname($containerRef->getFileName())).'/'.$containerClass.'.php';
$containerFile = \dirname($containerRef->getFileName(), 2).'/'.$containerClass.'.php';
$containerMetaFile = $containerFile.'.meta';
$kernelRef = new \ReflectionObject($this->kernel);
$kernelFile = $kernelRef->getFileName();
@@ -44,7 +44,7 @@ public function process(ContainerBuilder $container)
$container->getDefinition('twig.extension.form')->addTag('twig.extension');
$reflClass = new \ReflectionClass('Symfony\Bridge\Twig\Extension\FormExtension');
$coreThemePath = \dirname(\dirname($reflClass->getFileName())).'/Resources/views/Form';
$coreThemePath = \dirname($reflClass->getFileName(), 2).'/Resources/views/Form';
$container->getDefinition('twig.loader.native_filesystem')->addMethodCall('addPath', [$coreThemePath]);
$paths = $container->getDefinition('twig.template_iterator')->getArgument(2);
@@ -47,10 +47,10 @@ public function getTestsForToFromString()
return [
['foo=bar; path=/'],
['foo=bar; path=/foo'],
['foo=bar; domain=google.com; path=/'],
['foo=bar; domain=example.com; path=/'],
['foo=bar; domain=example.com; path=/; secure', 'https://example.com/'],
['foo=bar; path=/; httponly'],
['foo=bar; domain=google.com; path=/foo; secure; httponly', 'https://google.com/'],
['foo=bar; domain=example.com; path=/foo; secure; httponly', 'https://example.com/'],
['foo=bar=baz; path=/'],
['foo=bar%3Dbaz; path=/'],
];
@@ -60,7 +60,7 @@ private static function refresh()
foreach (get_declared_classes() as $class) {
if ('C' === $class[0] && 0 === strpos($class, 'ComposerAutoloaderInit')) {
$r = new \ReflectionClass($class);
$v = \dirname(\dirname($r->getFileName()));
$v = \dirname($r->getFileName(), 2);
if (file_exists($v.'/composer/installed.json')) {
self::$runtimeVendors[$v] = @filemtime($v.'/composer/installed.json');
}
@@ -35,7 +35,7 @@ public static function setUpBeforeClass(): void
}
if ($function[0] instanceof ComposerClassLoader) {
$function[0]->add('Symfony_Component_Debug_Tests_Fixtures', \dirname(\dirname(\dirname(\dirname(\dirname(__DIR__))))));
$function[0]->add('Symfony_Component_Debug_Tests_Fixtures', \dirname(__DIR__, 5));
break;
}
}
@@ -107,7 +107,7 @@ public function testDumpRelativeDir()
$container->setParameter('foo', 'wiz'.\dirname(__DIR__));
$container->setParameter('bar', __DIR__);
$container->setParameter('baz', '%bar%/PhpDumperTest.php');
$container->setParameter('buz', \dirname(\dirname(__DIR__)));
$container->setParameter('buz', \dirname(__DIR__, 2));
$container->compile();
$dumper = new PhpDumper($container);
@@ -2312,29 +2312,29 @@ public function testTimezoneWithPlaceholder()
public function testUrlWithDefaultProtocol()
{
$url = 'http://www.google.com?foo1=bar1&foo2=bar2';
$url = 'http://www.example.com?foo1=bar1&foo2=bar2';
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\UrlType', $url, ['default_protocol' => 'http']);
$this->assertWidgetMatchesXpath($form->createView(), [],
'/input
[@type="text"]
[@name="name"]
[@value="http://www.google.com?foo1=bar1&foo2=bar2"]
[@value="http://www.example.com?foo1=bar1&foo2=bar2"]
[@inputmode="url"]
'
);
}
public function testUrlWithoutDefaultProtocol()
{
$url = 'http://www.google.com?foo1=bar1&foo2=bar2';
$url = 'http://www.example.com?foo1=bar1&foo2=bar2';
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\UrlType', $url, ['default_protocol' => null]);
$this->assertWidgetMatchesXpath($form->createView(), [],
'/input
[@type="url"]
[@name="name"]
[@value="http://www.google.com?foo1=bar1&foo2=bar2"]
[@value="http://www.example.com?foo1=bar1&foo2=bar2"]
'
);
}
@@ -29,15 +29,15 @@ public function provideTranslationFiles()
{
return array_map(
function ($filePath) { return (array) $filePath; },
glob(\dirname(\dirname(__DIR__)).'/Resources/translations/*.xlf')
glob(\dirname(__DIR__, 2).'/Resources/translations/*.xlf')
);
}
public function testNorwegianAlias()
{
$this->assertFileEquals(
\dirname(\dirname(__DIR__)).'/Resources/translations/validators.nb.xlf',
\dirname(\dirname(__DIR__)).'/Resources/translations/validators.no.xlf',
\dirname(__DIR__, 2).'/Resources/translations/validators.nb.xlf',
\dirname(__DIR__, 2).'/Resources/translations/validators.no.xlf',
'The NO locale should be an alias for the NB variant of the Norwegian language.'
);
}
@@ -87,7 +87,7 @@ protected function getScript($request)
foreach (get_declared_classes() as $class) {
if (0 === strpos($class, 'ComposerAutoloaderInit')) {
$r = new \ReflectionClass($class);
$file = \dirname(\dirname($r->getFileName())).'/autoload.php';
$file = \dirname($r->getFileName(), 2).'/autoload.php';
if (file_exists($file)) {
$requires .= 'require_once '.var_export($file, true).";\n";
}
@@ -39,8 +39,8 @@ public function testDoRequest()
$this->assertEquals('Request: /', $client->getResponse()->getContent(), '->doRequest() uses the request handler to make the request');
$this->assertEquals('www.example.com', $client->getRequest()->getHost(), '->doRequest() uses the request handler to make the request');
$client->request('GET', 'http://www.example.com/?parameter=http://google.com');
$this->assertEquals('http://www.example.com/?parameter='.urlencode('http://google.com'), $client->getRequest()->getUri(), '->doRequest() uses the request handler to make the request');
$client->request('GET', 'http://www.example.com/?parameter=http://example.com');
$this->assertEquals('http://www.example.com/?parameter='.urlencode('http://example.com'), $client->getRequest()->getUri(), '->doRequest() uses the request handler to make the request');
}
public function testGetScript()
@@ -29,15 +29,15 @@ public function provideTranslationFiles()
{
return array_map(
function ($filePath) { return (array) $filePath; },
glob(\dirname(\dirname(__DIR__)).'/Resources/translations/*.xlf')
glob(\dirname(__DIR__, 2).'/Resources/translations/*.xlf')
);
}
public function testNorwegianAlias()
{
$this->assertFileEquals(
\dirname(\dirname(__DIR__)).'/Resources/translations/security.nb.xlf',
\dirname(\dirname(__DIR__)).'/Resources/translations/security.no.xlf',
\dirname(__DIR__, 2).'/Resources/translations/security.nb.xlf',
\dirname(__DIR__, 2).'/Resources/translations/security.no.xlf',
'The NO locale should be an alias for the NB variant of the Norwegian language.'
);
}
@@ -91,7 +91,7 @@ public function testValidRelativeUrl($url)
public function getValidRelativeUrls()
{
return [
['//google.com'],
['//example.com'],
['//symfony.fake/blog/'],
['//symfony.com/search?type=&q=url+validator'],
];
@@ -101,11 +101,11 @@ public function getValidUrls()
{
return [
['http://a.pl'],
['http://www.google.com'],
['http://www.google.com.'],
['http://www.google.museum'],
['https://google.com/'],
['https://google.com:80/'],
['http://www.example.com'],
['http://www.example.com.'],
['http://www.example.museum'],
['https://example.com/'],
['https://example.com:80/'],
['http://www.example.coop/'],
['http://www.test-example.com/'],
['http://www.symfony.com/'],
@@ -166,11 +166,11 @@ public function getValidUrls()
public function getValidUrlsWithWhitespaces()
{
return [
["\x20http://www.google.com"],
["\x09\x09http://www.google.com."],
["\x20http://www.example.com"],
["\x09\x09http://www.example.com."],
["http://symfony.fake/blog/\x0A"],
["http://symfony.com/search?type=&q=url+validator\x0D\x0D"],
["\x00https://google.com:80\x00"],
["\x00https://example.com:80\x00"],
["\x0B\x0Bhttp://username:password@symfony.com\x0B\x0B"],
];
}
@@ -214,10 +214,10 @@ public function testInvalidRelativeUrl($url)
public function getInvalidRelativeUrls()
{
return [
['/google.com'],
['//goog_le.com'],
['//google.com::aa'],
['//google.com:aa'],
['/example.com'],
['//examp_le.com'],
['//example.com::aa'],
['//example.com:aa'],
['//127.0.0.1:aa/'],
['//[::1'],
['//hello.☎/'],
@@ -235,15 +235,15 @@ public function getInvalidRelativeUrls()
public function getInvalidUrls()
{
return [
['google.com'],
['://google.com'],
['http ://google.com'],
['http:/google.com'],
['http://goog_le.com'],
['http://google.com::aa'],
['http://google.com:aa'],
['ftp://google.fr'],
['faked://google.fr'],
['example.com'],
['://example.com'],
['http ://example.com'],
['http:/example.com'],
['http://examp_le.com'],
['http://example.com::aa'],
['http://example.com:aa'],
['ftp://example.fr'],
['faked://example.fr'],
['http://127.0.0.1:aa/'],
['ftp://[::1]/'],
['http://[::1'],
@@ -276,7 +276,7 @@ public function testCustomProtocolIsValid($url)
public function getValidCustomUrls()
{
return [
['ftp://google.com'],
['ftp://example.com'],
['file://127.0.0.1'],
['git://[::1]/'],
];
@@ -29,15 +29,15 @@ public function provideTranslationFiles()
{
return array_map(
function ($filePath) { return (array) $filePath; },
glob(\dirname(\dirname(__DIR__)).'/Resources/translations/*.xlf')
glob(\dirname(__DIR__, 2).'/Resources/translations/*.xlf')
);
}
public function testNorwegianAlias()
{
$this->assertFileEquals(
\dirname(\dirname(__DIR__)).'/Resources/translations/validators.nb.xlf',
\dirname(\dirname(__DIR__)).'/Resources/translations/validators.no.xlf',
\dirname(__DIR__, 2).'/Resources/translations/validators.nb.xlf',
\dirname(__DIR__, 2).'/Resources/translations/validators.no.xlf',
'The NO locale should be an alias for the NB variant of the Norwegian language.'
);
}
@@ -71,7 +71,7 @@ private function getComposerRoot(string $file, bool &$inVendor)
foreach (get_declared_classes() as $class) {
if ('C' === $class[0] && 0 === strpos($class, 'ComposerAutoloaderInit')) {
$r = new \ReflectionClass($class);
$v = \dirname(\dirname($r->getFileName()));
$v = \dirname($r->getFileName(), 2);
if (file_exists($v.'/composer/installed.json')) {
self::$vendorRoots[] = $v.\DIRECTORY_SEPARATOR;
}
@@ -50,12 +50,12 @@ public function getCastFileInfoTests()
%A}
EOTXT
],
['https://google.com/about', <<<'EOTXT'
['https://example.com/about', <<<'EOTXT'
SplFileInfo {
%Apath: "https://google.com"
%Apath: "https://example.com"
filename: "about"
basename: "about"
pathname: "https://google.com/about"
pathname: "https://example.com/about"
extension: ""
realPath: false
%A}

0 comments on commit c709d43

Please sign in to comment.
You can’t perform that action at this time.