Issue #2504967 by hussainweb, joshtaylor, jibran, Berdir: Upgrade to Symfony 2.7.1

8.0.x
Alex Pott 2015-07-13 13:49:14 +01:00
parent 7eb616f14c
commit b65b47289f
157 changed files with 1873 additions and 1363 deletions

3
core/.gitignore vendored
View File

@ -14,3 +14,6 @@ vendor/symfony/translation/Symfony/Component/Translation/*
# PHPUnit provides some binary dependencies that are already available.
vendor/phpunit/phpunit/build/dependencies
# The PHAR file below contains CRLF characters that cause a problem with PIFR.
vendor/symfony/dependency-injection/Tests/Fixtures/includes/ProjectWithXsdExtensionInPhar.phar

144
core/composer.lock generated
View File

@ -2194,16 +2194,16 @@
},
{
"name": "symfony/browser-kit",
"version": "v2.7.0",
"version": "v2.7.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/BrowserKit.git",
"reference": "70cdc18dd601a486a8cc69ee26367cbaedd60400"
"reference": "d0a144a1a96d5dc90bed2814b2096a1322761672"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/BrowserKit/zipball/70cdc18dd601a486a8cc69ee26367cbaedd60400",
"reference": "70cdc18dd601a486a8cc69ee26367cbaedd60400",
"url": "https://api.github.com/repos/symfony/BrowserKit/zipball/d0a144a1a96d5dc90bed2814b2096a1322761672",
"reference": "d0a144a1a96d5dc90bed2814b2096a1322761672",
"shasum": ""
},
"require": {
@ -2245,20 +2245,20 @@
],
"description": "Symfony BrowserKit Component",
"homepage": "https://symfony.com",
"time": "2015-05-02 15:21:08"
"time": "2015-06-04 20:11:48"
},
{
"name": "symfony/class-loader",
"version": "v2.7.0",
"version": "v2.7.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/ClassLoader.git",
"reference": "fa19598cb708b92d983b34aae313f57c217f9386"
"reference": "84843730de48ca0feba91004a03c7c952f8ea1da"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/ClassLoader/zipball/fa19598cb708b92d983b34aae313f57c217f9386",
"reference": "fa19598cb708b92d983b34aae313f57c217f9386",
"url": "https://api.github.com/repos/symfony/ClassLoader/zipball/84843730de48ca0feba91004a03c7c952f8ea1da",
"reference": "84843730de48ca0feba91004a03c7c952f8ea1da",
"shasum": ""
},
"require": {
@ -2295,20 +2295,20 @@
],
"description": "Symfony ClassLoader Component",
"homepage": "https://symfony.com",
"time": "2015-05-15 13:33:16"
"time": "2015-06-08 09:37:21"
},
{
"name": "symfony/console",
"version": "v2.7.0",
"version": "v2.7.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/Console.git",
"reference": "7f0bec04961c61c961df0cb8c2ae88dbfd83f399"
"reference": "564398bc1f33faf92fc2ec86859983d30eb81806"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/Console/zipball/7f0bec04961c61c961df0cb8c2ae88dbfd83f399",
"reference": "7f0bec04961c61c961df0cb8c2ae88dbfd83f399",
"url": "https://api.github.com/repos/symfony/Console/zipball/564398bc1f33faf92fc2ec86859983d30eb81806",
"reference": "564398bc1f33faf92fc2ec86859983d30eb81806",
"shasum": ""
},
"require": {
@ -2352,11 +2352,11 @@
],
"description": "Symfony Console Component",
"homepage": "https://symfony.com",
"time": "2015-05-29 16:22:24"
"time": "2015-06-10 15:30:22"
},
{
"name": "symfony/css-selector",
"version": "v2.7.0",
"version": "v2.7.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/CssSelector.git",
@ -2409,16 +2409,16 @@
},
{
"name": "symfony/debug",
"version": "v2.7.0",
"version": "v2.7.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/Debug.git",
"reference": "1df2971b27a6ff73dae4ea622f42802000ec332d"
"reference": "075070230c5bbc65abde8241191655bbce0716e2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/Debug/zipball/1df2971b27a6ff73dae4ea622f42802000ec332d",
"reference": "1df2971b27a6ff73dae4ea622f42802000ec332d",
"url": "https://api.github.com/repos/symfony/Debug/zipball/075070230c5bbc65abde8241191655bbce0716e2",
"reference": "075070230c5bbc65abde8241191655bbce0716e2",
"shasum": ""
},
"require": {
@ -2465,20 +2465,20 @@
],
"description": "Symfony Debug Component",
"homepage": "https://symfony.com",
"time": "2015-05-22 14:54:25"
"time": "2015-06-08 09:37:21"
},
{
"name": "symfony/dependency-injection",
"version": "v2.7.0",
"version": "v2.7.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/DependencyInjection.git",
"reference": "137bf489c5151c7eb1e4b7dd34a123f9a74b966d"
"reference": "1a409e52a38ec891de0a7a61a191d1c62080b69d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/DependencyInjection/zipball/137bf489c5151c7eb1e4b7dd34a123f9a74b966d",
"reference": "137bf489c5151c7eb1e4b7dd34a123f9a74b966d",
"url": "https://api.github.com/repos/symfony/DependencyInjection/zipball/1a409e52a38ec891de0a7a61a191d1c62080b69d",
"reference": "1a409e52a38ec891de0a7a61a191d1c62080b69d",
"shasum": ""
},
"require": {
@ -2525,11 +2525,11 @@
],
"description": "Symfony DependencyInjection Component",
"homepage": "https://symfony.com",
"time": "2015-05-29 14:44:44"
"time": "2015-06-11 19:13:11"
},
{
"name": "symfony/dom-crawler",
"version": "v2.7.0",
"version": "v2.7.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/DomCrawler.git",
@ -2582,16 +2582,16 @@
},
{
"name": "symfony/event-dispatcher",
"version": "v2.7.0",
"version": "v2.7.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/EventDispatcher.git",
"reference": "687039686d0e923429ba6e958d0baa920cd5d458"
"reference": "be3c5ff8d503c46768aeb78ce6333051aa6f26d9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/687039686d0e923429ba6e958d0baa920cd5d458",
"reference": "687039686d0e923429ba6e958d0baa920cd5d458",
"url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/be3c5ff8d503c46768aeb78ce6333051aa6f26d9",
"reference": "be3c5ff8d503c46768aeb78ce6333051aa6f26d9",
"shasum": ""
},
"require": {
@ -2636,20 +2636,20 @@
],
"description": "Symfony EventDispatcher Component",
"homepage": "https://symfony.com",
"time": "2015-05-02 15:21:08"
"time": "2015-06-08 09:37:21"
},
{
"name": "symfony/http-foundation",
"version": "v2.7.0",
"version": "v2.7.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/HttpFoundation.git",
"reference": "729de183da037c125c5f6366bd4f0631ba1a1abb"
"reference": "4f363c426b0ced57e3d14460022feb63937980ff"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/HttpFoundation/zipball/729de183da037c125c5f6366bd4f0631ba1a1abb",
"reference": "729de183da037c125c5f6366bd4f0631ba1a1abb",
"url": "https://api.github.com/repos/symfony/HttpFoundation/zipball/4f363c426b0ced57e3d14460022feb63937980ff",
"reference": "4f363c426b0ced57e3d14460022feb63937980ff",
"shasum": ""
},
"require": {
@ -2689,20 +2689,20 @@
],
"description": "Symfony HttpFoundation Component",
"homepage": "https://symfony.com",
"time": "2015-05-22 14:54:25"
"time": "2015-06-10 15:30:22"
},
{
"name": "symfony/http-kernel",
"version": "v2.7.0",
"version": "v2.7.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/HttpKernel.git",
"reference": "74acbb7ef9c4aae0620d3250b9b990d2fff28d16"
"reference": "208101c7a11e31933183bd2a380486e528c74302"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/HttpKernel/zipball/74acbb7ef9c4aae0620d3250b9b990d2fff28d16",
"reference": "74acbb7ef9c4aae0620d3250b9b990d2fff28d16",
"url": "https://api.github.com/repos/symfony/HttpKernel/zipball/208101c7a11e31933183bd2a380486e528c74302",
"reference": "208101c7a11e31933183bd2a380486e528c74302",
"shasum": ""
},
"require": {
@ -2769,20 +2769,20 @@
],
"description": "Symfony HttpKernel Component",
"homepage": "https://symfony.com",
"time": "2015-05-30 16:52:28"
"time": "2015-06-11 21:15:28"
},
{
"name": "symfony/process",
"version": "v2.7.0",
"version": "v2.7.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/Process.git",
"reference": "e0a82b58e36afc60f8e79b8bc85a22bb064077c1"
"reference": "552d8efdc80980cbcca50b28d626ac8e36e3cdd1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/Process/zipball/e0a82b58e36afc60f8e79b8bc85a22bb064077c1",
"reference": "e0a82b58e36afc60f8e79b8bc85a22bb064077c1",
"url": "https://api.github.com/repos/symfony/Process/zipball/552d8efdc80980cbcca50b28d626ac8e36e3cdd1",
"reference": "552d8efdc80980cbcca50b28d626ac8e36e3cdd1",
"shasum": ""
},
"require": {
@ -2818,7 +2818,7 @@
],
"description": "Symfony Process Component",
"homepage": "https://symfony.com",
"time": "2015-05-15 13:33:16"
"time": "2015-06-08 09:37:21"
},
{
"name": "symfony/psr-http-message-bridge",
@ -2876,16 +2876,16 @@
},
{
"name": "symfony/routing",
"version": "v2.7.0",
"version": "v2.7.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/Routing.git",
"reference": "6f0333fb8b89cf6f8fd9d6740c5e83b73d9c95b9"
"reference": "5581be29185b8fb802398904555f70da62f6d50d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/Routing/zipball/6f0333fb8b89cf6f8fd9d6740c5e83b73d9c95b9",
"reference": "6f0333fb8b89cf6f8fd9d6740c5e83b73d9c95b9",
"url": "https://api.github.com/repos/symfony/Routing/zipball/5581be29185b8fb802398904555f70da62f6d50d",
"reference": "5581be29185b8fb802398904555f70da62f6d50d",
"shasum": ""
},
"require": {
@ -2943,20 +2943,20 @@
"uri",
"url"
],
"time": "2015-05-19 06:58:17"
"time": "2015-06-11 17:20:40"
},
{
"name": "symfony/serializer",
"version": "v2.7.0",
"version": "v2.7.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/Serializer.git",
"reference": "634d3adf119396320fba4c14caa01390700e7f3b"
"reference": "edf2820c4948389e3f168a0160151806cefd6ac3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/Serializer/zipball/634d3adf119396320fba4c14caa01390700e7f3b",
"reference": "634d3adf119396320fba4c14caa01390700e7f3b",
"url": "https://api.github.com/repos/symfony/Serializer/zipball/edf2820c4948389e3f168a0160151806cefd6ac3",
"reference": "edf2820c4948389e3f168a0160151806cefd6ac3",
"shasum": ""
},
"require": {
@ -3004,20 +3004,20 @@
],
"description": "Symfony Serializer Component",
"homepage": "https://symfony.com",
"time": "2015-05-29 14:44:44"
"time": "2015-06-08 09:37:21"
},
{
"name": "symfony/translation",
"version": "v2.7.0-BETA2",
"version": "v2.7.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/Translation.git",
"reference": "1be5bbed3938247acd7c5f4e4f29dd32db636b1f"
"reference": "8349a2b0d11bd0311df9e8914408080912983a0b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/Translation/zipball/1be5bbed3938247acd7c5f4e4f29dd32db636b1f",
"reference": "1be5bbed3938247acd7c5f4e4f29dd32db636b1f",
"url": "https://api.github.com/repos/symfony/Translation/zipball/8349a2b0d11bd0311df9e8914408080912983a0b",
"reference": "8349a2b0d11bd0311df9e8914408080912983a0b",
"shasum": ""
},
"require": {
@ -3065,20 +3065,20 @@
],
"description": "Symfony Translation Component",
"homepage": "https://symfony.com",
"time": "2015-05-11 02:35:29"
"time": "2015-06-11 17:26:34"
},
{
"name": "symfony/validator",
"version": "v2.7.0",
"version": "v2.7.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/Validator.git",
"reference": "3a5461a388ff8962790fd5a39e6e2da84ba1e824"
"reference": "3c58b1ef26ab2114f8f84d1808937b9b76bad8f5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/Validator/zipball/3a5461a388ff8962790fd5a39e6e2da84ba1e824",
"reference": "3a5461a388ff8962790fd5a39e6e2da84ba1e824",
"url": "https://api.github.com/repos/symfony/Validator/zipball/3c58b1ef26ab2114f8f84d1808937b9b76bad8f5",
"reference": "3c58b1ef26ab2114f8f84d1808937b9b76bad8f5",
"shasum": ""
},
"require": {
@ -3135,20 +3135,20 @@
],
"description": "Symfony Validator Component",
"homepage": "https://symfony.com",
"time": "2015-05-29 14:44:44"
"time": "2015-06-08 09:37:21"
},
{
"name": "symfony/yaml",
"version": "v2.7.0",
"version": "v2.7.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/Yaml.git",
"reference": "4a29a5248aed4fb45f626a7bbbd330291492f5c3"
"reference": "9808e75c609a14f6db02f70fccf4ca4aab53c160"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/Yaml/zipball/4a29a5248aed4fb45f626a7bbbd330291492f5c3",
"reference": "4a29a5248aed4fb45f626a7bbbd330291492f5c3",
"url": "https://api.github.com/repos/symfony/Yaml/zipball/9808e75c609a14f6db02f70fccf4ca4aab53c160",
"reference": "9808e75c609a14f6db02f70fccf4ca4aab53c160",
"shasum": ""
},
"require": {
@ -3184,7 +3184,7 @@
],
"description": "Symfony Yaml Component",
"homepage": "https://symfony.com",
"time": "2015-05-02 15:21:08"
"time": "2015-06-10 15:30:22"
},
{
"name": "twig/twig",

File diff suppressed because it is too large Load Diff

View File

@ -547,7 +547,7 @@ abstract class Client
protected function getAbsoluteUri($uri)
{
// already absolute?
if (0 === strpos($uri, 'http')) {
if (0 === strpos($uri, 'http://') || 0 === strpos($uri, 'https://')) {
return $uri;
}

View File

@ -69,11 +69,20 @@ class Cookie
$this->rawValue = urlencode($value);
}
$this->name = $name;
$this->expires = null === $expires ? null : (int) $expires;
$this->path = empty($path) ? '/' : $path;
$this->domain = $domain;
$this->secure = (bool) $secure;
$this->httponly = (bool) $httponly;
if (null !== $expires) {
$timestampAsDateTime = \DateTime::createFromFormat('U', $expires);
if (false === $timestampAsDateTime) {
throw new \UnexpectedValueException(sprintf('The cookie expiration time "%s" is not valid.'), $expires);
}
$this->expires = $timestampAsDateTime->getTimestamp();
}
}
/**
@ -91,12 +100,6 @@ class Cookie
if (null !== $this->expires) {
$dateTime = \DateTime::createFromFormat('U', $this->expires, new \DateTimeZone('GMT'));
if ($dateTime === false) {
// this throw will provoke PHP fatal
throw new \UnexpectedValueException(sprintf('The cookie expiration time "%s" is not valid.'), $this->expires);
}
$cookie .= '; expires='.str_replace('+0000', '', $dateTime->format(self::$dateFormats[0]));
}

View File

@ -207,6 +207,21 @@ class ClientTest extends \PHPUnit_Framework_TestCase
$client->request('GET', 'http://www.example.com/foo/foobar');
$client->request('GET', 'bar');
$this->assertEquals('http://www.example.com/foo/bar', $client->getRequest()->getUri(), '->request() uses the previous request for relative URLs');
$client = new TestClient();
$client->request('GET', 'http://www.example.com/foo/');
$client->request('GET', 'http');
$this->assertEquals('http://www.example.com/foo/http', $client->getRequest()->getUri(), '->request() uses the previous request for relative URLs');
$client = new TestClient();
$client->request('GET', 'http://www.example.com/foo');
$client->request('GET', 'http/bar');
$this->assertEquals('http://www.example.com/http/bar', $client->getRequest()->getUri(), '->request() uses the previous request for relative URLs');
$client = new TestClient();
$client->request('GET', 'http://www.example.com/');
$client->request('GET', 'http');
$this->assertEquals('http://www.example.com/http', $client->getRequest()->getUri(), '->request() uses the previous request for relative URLs');
}
public function testRequestURIConversionByServerHost()
@ -332,7 +347,7 @@ class ClientTest extends \PHPUnit_Framework_TestCase
$client->followRedirect();
$this->fail('->followRedirect() throws a \LogicException if the request was not redirected');
} catch (\Exception $e) {
$this->assertInstanceof('LogicException', $e, '->followRedirect() throws a \LogicException if the request was not redirected');
$this->assertInstanceOf('LogicException', $e, '->followRedirect() throws a \LogicException if the request was not redirected');
}
$client->setNextResponse(new Response('', 302, array('Location' => 'http://www.example.com/redirected')));
@ -362,7 +377,7 @@ class ClientTest extends \PHPUnit_Framework_TestCase
$client->followRedirect();
$this->fail('->followRedirect() throws a \LogicException if the request did not respond with 30x HTTP Code');
} catch (\Exception $e) {
$this->assertInstanceof('LogicException', $e, '->followRedirect() throws a \LogicException if the request did not respond with 30x HTTP Code');
$this->assertInstanceOf('LogicException', $e, '->followRedirect() throws a \LogicException if the request did not respond with 30x HTTP Code');
}
}
@ -392,7 +407,7 @@ class ClientTest extends \PHPUnit_Framework_TestCase
$client->followRedirect();
$this->fail('->followRedirect() throws a \LogicException if the request was redirected and limit of redirections was reached');
} catch (\Exception $e) {
$this->assertInstanceof('LogicException', $e, '->followRedirect() throws a \LogicException if the request was redirected and limit of redirections was reached');
$this->assertInstanceOf('LogicException', $e, '->followRedirect() throws a \LogicException if the request was redirected and limit of redirections was reached');
}
$client->setNextResponse(new Response('', 302, array('Location' => 'http://www.example.com/redirected')));
@ -562,7 +577,7 @@ class ClientTest extends \PHPUnit_Framework_TestCase
$client->request('GET', 'http://www.example.com/foo/foobar');
$this->fail('->request() throws a \RuntimeException if the script has an error');
} catch (\Exception $e) {
$this->assertInstanceof('RuntimeException', $e, '->request() throws a \RuntimeException if the script has an error');
$this->assertInstanceOf('RuntimeException', $e, '->request() throws a \RuntimeException if the script has an error');
}
}

View File

@ -74,30 +74,30 @@ class CookieTest extends \PHPUnit_Framework_TestCase
public function testFromStringWithUrl()
{
$this->assertEquals('foo=bar; domain=www.example.com; path=/', (string) Cookie::FromString('foo=bar', 'http://www.example.com/'));
$this->assertEquals('foo=bar; domain=www.example.com; path=/', (string) Cookie::FromString('foo=bar', 'http://www.example.com'));
$this->assertEquals('foo=bar; domain=www.example.com; path=/', (string) Cookie::FromString('foo=bar', 'http://www.example.com?foo'));
$this->assertEquals('foo=bar; domain=www.example.com; path=/foo', (string) Cookie::FromString('foo=bar', 'http://www.example.com/foo/bar'));
$this->assertEquals('foo=bar; domain=www.example.com; path=/', (string) Cookie::FromString('foo=bar; path=/', 'http://www.example.com/foo/bar'));
$this->assertEquals('foo=bar; domain=www.myotherexample.com; path=/', (string) Cookie::FromString('foo=bar; domain=www.myotherexample.com', 'http://www.example.com/'));
$this->assertEquals('foo=bar; domain=www.example.com; path=/', (string) Cookie::fromString('foo=bar', 'http://www.example.com/'));
$this->assertEquals('foo=bar; domain=www.example.com; path=/', (string) Cookie::fromString('foo=bar', 'http://www.example.com'));
$this->assertEquals('foo=bar; domain=www.example.com; path=/', (string) Cookie::fromString('foo=bar', 'http://www.example.com?foo'));
$this->assertEquals('foo=bar; domain=www.example.com; path=/foo', (string) Cookie::fromString('foo=bar', 'http://www.example.com/foo/bar'));
$this->assertEquals('foo=bar; domain=www.example.com; path=/', (string) Cookie::fromString('foo=bar; path=/', 'http://www.example.com/foo/bar'));
$this->assertEquals('foo=bar; domain=www.myotherexample.com; path=/', (string) Cookie::fromString('foo=bar; domain=www.myotherexample.com', 'http://www.example.com/'));
}
public function testFromStringThrowsAnExceptionIfCookieIsNotValid()
{
$this->setExpectedException('InvalidArgumentException');
Cookie::FromString('foo');
Cookie::fromString('foo');
}
public function testFromStringThrowsAnExceptionIfCookieDateIsNotValid()
{
$this->setExpectedException('InvalidArgumentException');
Cookie::FromString('foo=bar; expires=Flursday July 31st 2020, 08:49:37 GMT');
Cookie::fromString('foo=bar; expires=Flursday July 31st 2020, 08:49:37 GMT');
}
public function testFromStringThrowsAnExceptionIfUrlIsNotValid()
{
$this->setExpectedException('InvalidArgumentException');
Cookie::FromString('foo=bar', 'foobar');
Cookie::fromString('foo=bar', 'foobar');
}
public function testGetName()

View File

@ -54,7 +54,7 @@ class HistoryTest extends \PHPUnit_Framework_TestCase
$history->current();
$this->fail('->current() throws a \LogicException if the history is empty');
} catch (\Exception $e) {
$this->assertInstanceof('LogicException', $e, '->current() throws a \LogicException if the history is empty');
$this->assertInstanceOf('LogicException', $e, '->current() throws a \LogicException if the history is empty');
}
$history->add(new Request('http://www.example.com/', 'get'));
@ -71,7 +71,7 @@ class HistoryTest extends \PHPUnit_Framework_TestCase
$history->back();
$this->fail('->back() throws a \LogicException if the history is already on the first page');
} catch (\Exception $e) {
$this->assertInstanceof('LogicException', $e, '->current() throws a \LogicException if the history is already on the first page');
$this->assertInstanceOf('LogicException', $e, '->current() throws a \LogicException if the history is already on the first page');
}
$history->add(new Request('http://www.example1.com/', 'get'));
@ -90,7 +90,7 @@ class HistoryTest extends \PHPUnit_Framework_TestCase
$history->forward();
$this->fail('->forward() throws a \LogicException if the history is already on the last page');
} catch (\Exception $e) {
$this->assertInstanceof('LogicException', $e, '->forward() throws a \LogicException if the history is already on the last page');
$this->assertInstanceOf('LogicException', $e, '->forward() throws a \LogicException if the history is already on the last page');
}
$history->back();

View File

@ -0,0 +1,3 @@
vendor/
composer.lock
phpunit.xml

View File

@ -11,7 +11,7 @@
namespace Symfony\Component\ClassLoader;
trigger_error('The '.__NAMESPACE__.'\ApcUniversalClassLoader class is deprecated since version 2.7 and will be removed in 3.0. Use the Symfony\Component\ClassLoader\ApcClassLoader class instead.', E_USER_DEPRECATED);
@trigger_error('The '.__NAMESPACE__.'\ApcUniversalClassLoader class is deprecated since version 2.7 and will be removed in 3.0. Use the Symfony\Component\ClassLoader\ApcClassLoader class instead.', E_USER_DEPRECATED);
/**
* ApcUniversalClassLoader implements a "universal" autoloader cached in APC for PHP 5.3.

View File

@ -11,7 +11,7 @@
namespace Symfony\Component\ClassLoader;
trigger_error('The '.__NAMESPACE__.'\DebugClassLoader class is deprecated since version 2.4 and will be removed in 3.0. Use the Symfony\Component\Debug\DebugClassLoader class instead.', E_USER_DEPRECATED);
@trigger_error('The '.__NAMESPACE__.'\DebugClassLoader class is deprecated since version 2.4 and will be removed in 3.0. Use the Symfony\Component\Debug\DebugClassLoader class instead.', E_USER_DEPRECATED);
/**
* Autoloader checking if the class is really defined in the file found.

View File

@ -11,7 +11,7 @@
namespace Symfony\Component\ClassLoader;
trigger_error('The '.__NAMESPACE__.'\DebugUniversalClassLoader class is deprecated since version 2.4 and will be removed in 3.0. Use the Symfony\Component\Debug\DebugClassLoader class instead.', E_USER_DEPRECATED);
@trigger_error('The '.__NAMESPACE__.'\DebugUniversalClassLoader class is deprecated since version 2.4 and will be removed in 3.0. Use the Symfony\Component\Debug\DebugClassLoader class instead.', E_USER_DEPRECATED);
/**
* Checks that the class is actually declared in the included file.

View File

@ -11,7 +11,7 @@
namespace Symfony\Component\ClassLoader;
trigger_error('The '.__NAMESPACE__.'\UniversalClassLoader class is deprecated since version 2.7 and will be removed in 3.0. Use the Symfony\Component\ClassLoader\ClassLoader class instead.', E_USER_DEPRECATED);
@trigger_error('The '.__NAMESPACE__.'\UniversalClassLoader class is deprecated since version 2.7 and will be removed in 3.0. Use the Symfony\Component\ClassLoader\ClassLoader class instead.', E_USER_DEPRECATED);
/**
* UniversalClassLoader implements a "universal" autoloader for PHP 5.3.

View File

@ -488,7 +488,7 @@ class Application
if (empty($namespaces)) {
$message = sprintf('There are no commands defined in the "%s" namespace.', $namespace);
if ($alternatives = $this->findAlternatives($namespace, $allNamespaces, array())) {
if ($alternatives = $this->findAlternatives($namespace, $allNamespaces)) {
if (1 == count($alternatives)) {
$message .= "\n\nDid you mean this?\n ";
} else {
@ -537,7 +537,7 @@ class Application
$message = sprintf('Command "%s" is not defined.', $name);
if ($alternatives = $this->findAlternatives($name, $allCommands, array())) {
if ($alternatives = $this->findAlternatives($name, $allCommands)) {
if (1 == count($alternatives)) {
$message .= "\n\nDid you mean this?\n ";
} else {
@ -628,7 +628,7 @@ class Application
*/
public function asText($namespace = null, $raw = false)
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
$descriptor = new TextDescriptor();
$output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, !$raw);
@ -649,7 +649,7 @@ class Application
*/
public function asXml($namespace = null, $asDom = false)
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
$descriptor = new XmlDescriptor();
@ -1086,7 +1086,7 @@ class Application
}
}
$alternatives = array_filter($alternatives, function ($lev) use ($threshold) { return $lev < 2*$threshold; });
$alternatives = array_filter($alternatives, function ($lev) use ($threshold) { return $lev < 2 * $threshold; });
asort($alternatives);
return array_keys($alternatives);

View File

@ -645,7 +645,7 @@ class Command
*/
public function asText()
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
$descriptor = new TextDescriptor();
$output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true);
@ -665,7 +665,7 @@ class Command
*/
public function asXml($asDom = false)
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
$descriptor = new XmlDescriptor();

View File

@ -77,7 +77,7 @@ EOF
}
if ($input->getOption('xml')) {
trigger_error('The --xml option was deprecated in version 2.7 and will be removed in version 3.0. Use the --format option instead.', E_USER_DEPRECATED);
@trigger_error('The --xml option was deprecated in version 2.7 and will be removed in version 3.0. Use the --format option instead.', E_USER_DEPRECATED);
$input->setOption('format', 'xml');
}

View File

@ -69,7 +69,7 @@ EOF
protected function execute(InputInterface $input, OutputInterface $output)
{
if ($input->getOption('xml')) {
trigger_error('The --xml option was deprecated in version 2.7 and will be removed in version 3.0. Use the --format option instead.', E_USER_DEPRECATED);
@trigger_error('The --xml option was deprecated in version 2.7 and will be removed in version 3.0. Use the --format option instead.', E_USER_DEPRECATED);
$input->setOption('format', 'xml');
}

View File

@ -31,7 +31,7 @@ class DialogHelper extends InputAwareHelper
public function __construct($triggerDeprecationError = true)
{
if ($triggerDeprecationError) {
trigger_error('"Symfony\Component\Console\Helper\DialogHelper" is deprecated since version 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\QuestionHelper" instead.', E_USER_DEPRECATED);
@trigger_error('"Symfony\Component\Console\Helper\DialogHelper" is deprecated since version 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\QuestionHelper" instead.', E_USER_DEPRECATED);
}
}

View File

@ -79,11 +79,11 @@ class HelperSet implements \IteratorAggregate
}
if ('dialog' === $name && $this->helpers[$name] instanceof DialogHelper) {
trigger_error('"Symfony\Component\Console\Helper\DialogHelper" is deprecated since version 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\QuestionHelper" instead.', E_USER_DEPRECATED);
@trigger_error('"Symfony\Component\Console\Helper\DialogHelper" is deprecated since version 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\QuestionHelper" instead.', E_USER_DEPRECATED);
} elseif ('progress' === $name && $this->helpers[$name] instanceof ProgressHelper) {
trigger_error('"Symfony\Component\Console\Helper\ProgressHelper" is deprecated since version 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\ProgressBar" instead.', E_USER_DEPRECATED);
@trigger_error('"Symfony\Component\Console\Helper\ProgressHelper" is deprecated since version 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\ProgressBar" instead.', E_USER_DEPRECATED);
} elseif ('table' === $name && $this->helpers[$name] instanceof TableHelper) {
trigger_error('"Symfony\Component\Console\Helper\TableHelper" is deprecated since version 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\Table" instead.', E_USER_DEPRECATED);
@trigger_error('"Symfony\Component\Console\Helper\TableHelper" is deprecated since version 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\Table" instead.', E_USER_DEPRECATED);
}
return $this->helpers[$name];

View File

@ -177,7 +177,7 @@ class ProgressBar
*/
public function getStep()
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the getProgress() method instead.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the getProgress() method instead.', E_USER_DEPRECATED);
return $this->getProgress();
}
@ -368,7 +368,7 @@ class ProgressBar
*/
public function setCurrent($step)
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the setProgress() method instead.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the setProgress() method instead.', E_USER_DEPRECATED);
$this->setProgress($step);
}

View File

@ -121,7 +121,7 @@ class ProgressHelper extends Helper
public function __construct($triggerDeprecationError = true)
{
if ($triggerDeprecationError) {
trigger_error('The '.__CLASS__.' class is deprecated since version 2.5 and will be removed in 3.0. Use the Symfony\Component\Console\Helper\ProgressBar class instead.', E_USER_DEPRECATED);
@trigger_error('The '.__CLASS__.' class is deprecated since version 2.5 and will be removed in 3.0. Use the Symfony\Component\Console\Helper\ProgressBar class instead.', E_USER_DEPRECATED);
}
}

View File

@ -385,7 +385,7 @@ class Table
$unmergedRows = array();
foreach ($rows[$line] as $column => $cell) {
if ($cell instanceof TableCell && $cell->getRowspan() > 1) {
$nbLines = $cell->getRowspan()-1;
$nbLines = $cell->getRowspan() - 1;
$lines = array($cell);
if (strstr($cell, "\n")) {
$lines = explode("\n", $cell);
@ -412,7 +412,7 @@ class Table
array_splice($rows[$unmergedRowKey], $cellKey, 0, array($cell));
}
} else {
$row = $this->copyRow($rows, $unmergedRowKey-1);
$row = $this->copyRow($rows, $unmergedRowKey - 1);
foreach ($unmergedRow as $column => $cell) {
if (!empty($cell)) {
$row[$column] = $unmergedRow[$column];
@ -476,7 +476,7 @@ class Table
{
$columns = count($row);
foreach ($row as $column) {
$columns += $column instanceof TableCell ? ($column->getColspan()-1) : 0;
$columns += $column instanceof TableCell ? ($column->getColspan() - 1) : 0;
}
return $columns;
@ -491,11 +491,11 @@ class Table
*/
private function getRowColumns($row)
{
$columns = range(0, $this->numberOfColumns-1);
$columns = range(0, $this->numberOfColumns - 1);
foreach ($row as $cellKey => $cell) {
if ($cell instanceof TableCell && $cell->getColspan() > 1) {
// exclude grouped columns.
$columns = array_diff($columns, range($cellKey+1, $cellKey + $cell->getColspan()-1));
$columns = array_diff($columns, range($cellKey + 1, $cellKey + $cell->getColspan() - 1));
}
}
@ -550,12 +550,13 @@ class Table
{
if (isset($row[$column])) {
$cell = $row[$column];
$cellWidth = Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell);
if ($cell instanceof TableCell && $cell->getColspan() > 1) {
// we assume that cell value will be across more than one column.
$cell = substr($cell, 0, strlen($cell)/$cell->getColspan());
$cellWidth = $cellWidth / $cell->getColspan();
}
return Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell);
return $cellWidth;
}
return 0;

View File

@ -37,7 +37,7 @@ class TableHelper extends Helper
public function __construct($triggerDeprecationError = true)
{
if ($triggerDeprecationError) {
trigger_error('The '.__CLASS__.' class is deprecated since version 2.5 and will be removed in 3.0. Use the Symfony\Component\Console\Helper\Table class instead.', E_USER_DEPRECATED);
@trigger_error('The '.__CLASS__.' class is deprecated since version 2.5 and will be removed in 3.0. Use the Symfony\Component\Console\Helper\Table class instead.', E_USER_DEPRECATED);
}
$this->table = new Table(new NullOutput());

View File

@ -449,7 +449,7 @@ class InputDefinition
*/
public function asText()
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
$descriptor = new TextDescriptor();
$output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true);
@ -469,7 +469,7 @@ class InputDefinition
*/
public function asXml($asDom = false)
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
$descriptor = new XmlDescriptor();

View File

@ -40,7 +40,7 @@ class StringInput extends ArgvInput
public function __construct($input, InputDefinition $definition = null)
{
if ($definition) {
trigger_error('The $definition argument of the '.__METHOD__.' method is deprecated and will be removed in 3.0. Set this parameter with the bind() method instead.', E_USER_DEPRECATED);
@trigger_error('The $definition argument of the '.__METHOD__.' method is deprecated and will be removed in 3.0. Set this parameter with the bind() method instead.', E_USER_DEPRECATED);
}
parent::__construct(array(), null);

View File

@ -18,6 +18,7 @@ use Symfony\Component\Console\Helper\ProgressBar;
use Symfony\Component\Console\Helper\SymfonyQuestionHelper;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\BufferedOutput;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\ChoiceQuestion;
use Symfony\Component\Console\Question\ConfirmationQuestion;
@ -36,6 +37,7 @@ class SymfonyStyle extends OutputStyle
private $questionHelper;
private $progressBar;
private $lineLength;
private $bufferedOutput;
/**
* @param InputInterface $input
@ -44,7 +46,9 @@ class SymfonyStyle extends OutputStyle
public function __construct(InputInterface $input, OutputInterface $output)
{
$this->input = $input;
$this->lineLength = min($this->getTerminalWidth(), self::MAX_LINE_LENGTH);
$this->bufferedOutput = new BufferedOutput($output->getVerbosity(), false, clone $output->getFormatter());
// Windows cmd wraps lines as soon as the terminal width is reached, whether there are following chars or not.
$this->lineLength = min($this->getTerminalWidth() - (int) (DIRECTORY_SEPARATOR === '\\'), self::MAX_LINE_LENGTH);
parent::__construct($output);
}
@ -60,6 +64,7 @@ class SymfonyStyle extends OutputStyle
*/
public function block($messages, $type = null, $style = null, $prefix = ' ', $padding = false)
{
$this->autoPrependBlock();
$messages = is_array($messages) ? array_values($messages) : array($messages);
$lines = array();
@ -71,7 +76,7 @@ class SymfonyStyle extends OutputStyle
// wrap and add newlines for each element
foreach ($messages as $key => $message) {
$message = OutputFormatter::escape($message);
$lines = array_merge($lines, explode("\n", wordwrap($message, $this->lineLength - Helper::strlen($prefix))));
$lines = array_merge($lines, explode(PHP_EOL, wordwrap($message, $this->lineLength - Helper::strlen($prefix), PHP_EOL, true)));
if (count($messages) > 1 && $key < count($messages) - 1) {
$lines[] = '';
@ -92,7 +97,8 @@ class SymfonyStyle extends OutputStyle
}
}
$this->writeln(implode("\n", $lines)."\n");
$this->writeln($lines);
$this->newLine();
}
/**
@ -100,7 +106,12 @@ class SymfonyStyle extends OutputStyle
*/
public function title($message)
{
$this->writeln(sprintf("\n<comment>%s</>\n<comment>%s</>\n", $message, str_repeat('=', strlen($message))));
$this->autoPrependBlock();
$this->writeln(array(
sprintf('<comment>%s</>', $message),
sprintf('<comment>%s</>', str_repeat('=', strlen($message))),
));
$this->newLine();
}
/**
@ -108,7 +119,12 @@ class SymfonyStyle extends OutputStyle
*/
public function section($message)
{
$this->writeln(sprintf("<comment>%s</>\n<comment>%s</>\n", $message, str_repeat('-', strlen($message))));
$this->autoPrependBlock();
$this->writeln(array(
sprintf('<comment>%s</>', $message),
sprintf('<comment>%s</>', str_repeat('-', strlen($message))),
));
$this->newLine();
}
/**
@ -116,13 +132,13 @@ class SymfonyStyle extends OutputStyle
*/
public function listing(array $elements)
{
$this->autoPrependText();
$elements = array_map(function ($element) {
return sprintf(' * %s', $element);
},
$elements
);
return sprintf(' * %s', $element);
}, $elements);
$this->writeln(implode("\n", $elements)."\n");
$this->writeln($elements);
$this->newLine();
}
/**
@ -130,6 +146,8 @@ class SymfonyStyle extends OutputStyle
*/
public function text($message)
{
$this->autoPrependText();
if (!is_array($message)) {
$this->writeln(sprintf(' // %s', $message));
@ -205,7 +223,7 @@ class SymfonyStyle extends OutputStyle
$question = new Question($question, $default);
$question->setValidator($validator);
return $this->askQuestion($question, $validator);
return $this->askQuestion($question);
}
/**
@ -214,9 +232,11 @@ class SymfonyStyle extends OutputStyle
public function askHidden($question, $validator = null)
{
$question = new Question($question);
$question->setHidden(true);
return $this->askQuestion($question, $validator);
$question->setHidden(true);
$question->setValidator($validator);
return $this->askQuestion($question);
}
/**
@ -290,17 +310,51 @@ class SymfonyStyle extends OutputStyle
*/
public function askQuestion(Question $question)
{
if ($this->input->isInteractive()) {
$this->autoPrependBlock();
}
if (!$this->questionHelper) {
$this->questionHelper = new SymfonyQuestionHelper();
}
$answer = $this->questionHelper->ask($this->input, $this, $question);
$this->newLine();
if ($this->input->isInteractive()) {
$this->newLine();
$this->bufferedOutput->write("\n");
}
return $answer;
}
/**
* {@inheritdoc}
*/
public function writeln($messages, $type = self::OUTPUT_NORMAL)
{
parent::writeln($messages, $type);
$this->bufferedOutput->writeln($this->reduceBuffer($messages), $type);
}
/**
* {@inheritdoc}
*/
public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL)
{
parent::write($messages, $newline, $type);
$this->bufferedOutput->write($this->reduceBuffer($messages), $newline, $type);
}
/**
* {@inheritdoc}
*/
public function newLine($count = 1)
{
parent::newLine($count);
$this->bufferedOutput->write(str_repeat("\n", $count));
}
/**
* @return ProgressBar
*/
@ -320,4 +374,33 @@ class SymfonyStyle extends OutputStyle
return $dimensions[0] ?: self::MAX_LINE_LENGTH;
}
private function autoPrependBlock()
{
$chars = substr(str_replace(PHP_EOL, "\n", $this->bufferedOutput->fetch()), -2);
if (false === $chars) {
return $this->newLine(); //empty history, so we should start with a new line.
}
//Prepend new line for each non LF chars (This means no blank line was output before)
$this->newLine(2 - substr_count($chars, "\n"));
}
private function autoPrependText()
{
$fetched = $this->bufferedOutput->fetch();
//Prepend new line if last char isn't EOL:
if ("\n" !== substr($fetched, -1)) {
$this->newLine();
}
}
private function reduceBuffer($messages)
{
// We need to know if the two last chars are PHP_EOL
// Preserve the last 4 chars inserted (PHP_EOL on windows is two chars) in the history buffer
return array_map(function ($value) {
return substr($value, -4);
}, array_merge(array($this->bufferedOutput->fetch()), (array) $messages));
}
}

View File

@ -0,0 +1,11 @@
<?php
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
//Ensure has single blank line at start when using block element
return function (InputInterface $input, OutputInterface $output) {
$output = new SymfonyStyle($input, $output);
$output->caution('Lorem ipsum dolor sit amet');
};

View File

@ -0,0 +1,13 @@
<?php
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
//Ensure has single blank line between titles and blocks
return function (InputInterface $input, OutputInterface $output) {
$output = new SymfonyStyle($input, $output);
$output->title('Title');
$output->warning('Lorem ipsum dolor sit amet');
$output->title('Title');
};

View File

@ -0,0 +1,16 @@
<?php
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
//Ensure has single blank line between blocks
return function (InputInterface $input, OutputInterface $output) {
$output = new SymfonyStyle($input, $output);
$output->warning('Warning');
$output->caution('Caution');
$output->error('Error');
$output->success('Success');
$output->note('Note');
$output->block('Custom block', 'CUSTOM', 'fg=white;bg=green', 'X ', true);
};

View File

@ -0,0 +1,12 @@
<?php
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
//Ensure has single blank line between two titles
return function (InputInterface $input, OutputInterface $output) {
$output = new SymfonyStyle($input, $output);
$output->title('First title');
$output->title('Second title');
};

View File

@ -0,0 +1,34 @@
<?php
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
//Ensure has single blank line after any text and a title
return function (InputInterface $input, OutputInterface $output) {
$output = new SymfonyStyle($input, $output);
$output->write('Lorem ipsum dolor sit amet');
$output->title('First title');
$output->writeln('Lorem ipsum dolor sit amet');
$output->title('Second title');
$output->write('Lorem ipsum dolor sit amet');
$output->write('');
$output->title('Third title');
//Ensure edge case by appending empty strings to history:
$output->write('Lorem ipsum dolor sit amet');
$output->write(array('', '', ''));
$output->title('Fourth title');
//Ensure have manual control over number of blank lines:
$output->writeln('Lorem ipsum dolor sit amet');
$output->writeln(array('', '')); //Should append an extra blank line
$output->title('Fifth title');
$output->writeln('Lorem ipsum dolor sit amet');
$output->newLine(2); //Should append an extra blank line
$output->title('Fifth title');
};

View File

@ -0,0 +1,29 @@
<?php
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
//Ensure has proper line ending before outputing a text block like with SymfonyStyle::listing() or SymfonyStyle::text()
return function (InputInterface $input, OutputInterface $output) {
$output = new SymfonyStyle($input, $output);
$output->writeln('Lorem ipsum dolor sit amet');
$output->listing(array(
'Lorem ipsum dolor sit amet',
'consectetur adipiscing elit',
));
//Even using write:
$output->write('Lorem ipsum dolor sit amet');
$output->listing(array(
'Lorem ipsum dolor sit amet',
'consectetur adipiscing elit',
));
$output->write('Lorem ipsum dolor sit amet');
$output->text(array(
'Lorem ipsum dolor sit amet',
'consectetur adipiscing elit',
));
};

View File

@ -0,0 +1,16 @@
<?php
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
//Ensure has proper blank line after text block when using a block like with SymfonyStyle::success
return function (InputInterface $input, OutputInterface $output) {
$output = new SymfonyStyle($input, $output);
$output->listing(array(
'Lorem ipsum dolor sit amet',
'consectetur adipiscing elit',
));
$output->success('Lorem ipsum dolor sit amet');
};

View File

@ -0,0 +1,15 @@
<?php
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
//Ensure questions do not output anything when input is non-interactive
return function (InputInterface $input, OutputInterface $output) {
$output = new SymfonyStyle($input, $output);
$output->title('Title');
$output->askHidden('Hidden question');
$output->choice('Choice question with default', array('choice1', 'choice2'), 'choice1');
$output->confirm('Confirmation with yes default', true);
$output->text('Duis aute irure dolor in reprehenderit in voluptate velit esse');
};

View File

@ -0,0 +1,3 @@
! [CAUTION] Lorem ipsum dolor sit amet

View File

@ -0,0 +1,9 @@
Title
=====
[WARNING] Lorem ipsum dolor sit amet
Title
=====

View File

@ -0,0 +1,13 @@
[WARNING] Warning
! [CAUTION] Caution
[ERROR] Error
[OK] Success
! [NOTE] Note
X [CUSTOM] Custom block

View File

@ -0,0 +1,7 @@
First title
===========
Second title
============

View File

@ -0,0 +1,32 @@
Lorem ipsum dolor sit amet
First title
===========
Lorem ipsum dolor sit amet
Second title
============
Lorem ipsum dolor sit amet
Third title
===========
Lorem ipsum dolor sit amet
Fourth title
============
Lorem ipsum dolor sit amet
Fifth title
===========
Lorem ipsum dolor sit amet
Fifth title
===========

View File

@ -0,0 +1,11 @@
Lorem ipsum dolor sit amet
* Lorem ipsum dolor sit amet
* consectetur adipiscing elit
Lorem ipsum dolor sit amet
* Lorem ipsum dolor sit amet
* consectetur adipiscing elit
Lorem ipsum dolor sit amet
// Lorem ipsum dolor sit amet
// consectetur adipiscing elit

View File

@ -0,0 +1,6 @@
* Lorem ipsum dolor sit amet
* consectetur adipiscing elit
[OK] Lorem ipsum dolor sit amet

View File

@ -0,0 +1,5 @@
Title
=====
// Duis aute irure dolor in reprehenderit in voluptate velit esse

View File

@ -0,0 +1,64 @@
<?php
namespace Symfony\Component\Console\Tests\Style;
use PHPUnit_Framework_TestCase;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\Console\Tester\CommandTester;
class SymfonyStyleTest extends PHPUnit_Framework_TestCase
{
/** @var Command */
protected $command;
/** @var CommandTester */
protected $tester;
protected function setUp()
{
$this->command = new Command('sfstyle');
$this->tester = new CommandTester($this->command);
}
protected function tearDown()
{
$this->command = null;
$this->tester = null;
}
/**
* @dataProvider inputCommandToOutputFilesProvider
*/
public function testOutputs($inputCommandFilepath, $outputFilepath)
{
$code = require $inputCommandFilepath;
$this->command->setCode($code);
$this->tester->execute(array(), array('interactive' => false, 'decorated' => false));
$this->assertStringEqualsFile($outputFilepath, $this->tester->getDisplay(true));
}
public function inputCommandToOutputFilesProvider()
{
$baseDir = __DIR__.'/../Fixtures/Style/SymfonyStyle';
return array_map(null, glob($baseDir.'/command/command_*.php'), glob($baseDir.'/output/output_*.txt'));
}
public function testLongWordsBlockWrapping()
{
$word = 'Lopadotemachoselachogaleokranioleipsanodrimhypotrimmatosilphioparaomelitokatakechymenokichlepikossyphophattoperisteralektryonoptekephalliokigklopeleiolagoiosiraiobaphetraganopterygon';
$wordLength = strlen($word);
$maxLineLength = SymfonyStyle::MAX_LINE_LENGTH - 3;
$this->command->setCode(function (InputInterface $input, OutputInterface $output) use ($word) {
$sfStyle = new SymfonyStyle($input, $output);
$sfStyle->block($word, 'CUSTOM', 'fg=white;bg=blue', ' § ', false);
});
$this->tester->execute(array(), array('interactive' => false, 'decorated' => false));
$expectedCount = (int) ceil($wordLength / ($maxLineLength)) + (int) ($wordLength > $maxLineLength - 5);
$this->assertSame($expectedCount, substr_count($this->tester->getDisplay(true), ' § '));
}
}

View File

@ -0,0 +1,3 @@
vendor/
composer.lock
phpunit.xml

View File

@ -45,7 +45,7 @@ class DebugClassLoader
$this->wasFinder = is_object($classLoader) && method_exists($classLoader, 'findFile');
if ($this->wasFinder) {
trigger_error('The '.__METHOD__.' method will no longer support receiving an object into its $classLoader argument in 3.0.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method will no longer support receiving an object into its $classLoader argument in 3.0.', E_USER_DEPRECATED);
$this->classLoader = array($classLoader, 'loadClass');
$this->isFinder = true;
} else {
@ -127,7 +127,7 @@ class DebugClassLoader
*/
public function findFile($class)
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
if ($this->wasFinder) {
return $this->classLoader[0]->findFile($class);
@ -200,12 +200,12 @@ class DebugClassLoader
if (!$parent || strncmp($ns, $parent->name, $len)) {
if ($parent && isset(self::$deprecated[$parent->name]) && strncmp($ns, $parent->name, $len)) {
trigger_error(sprintf('The %s class extends %s that is deprecated %s', $name, $parent->name, self::$deprecated[$parent->name]), E_USER_DEPRECATED);
@trigger_error(sprintf('The %s class extends %s that is deprecated %s', $name, $parent->name, self::$deprecated[$parent->name]), E_USER_DEPRECATED);
}
foreach ($refl->getInterfaceNames() as $interface) {
if (isset(self::$deprecated[$interface]) && strncmp($ns, $interface, $len) && !($parent && $parent->implementsInterface($interface))) {
trigger_error(sprintf('The %s %s %s that is deprecated %s', $name, $refl->isInterface() ? 'interface extends' : 'class implements', $interface, self::$deprecated[$interface]), E_USER_DEPRECATED);
@trigger_error(sprintf('The %s %s %s that is deprecated %s', $name, $refl->isInterface() ? 'interface extends' : 'class implements', $interface, self::$deprecated[$interface]), E_USER_DEPRECATED);
}
}
}

View File

@ -611,7 +611,7 @@ class ErrorHandler
*/
public function setLevel($level)
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the throwAt() method instead.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the throwAt() method instead.', E_USER_DEPRECATED);
$level = null === $level ? error_reporting() : $level;
$this->throwAt($level, true);
@ -626,7 +626,7 @@ class ErrorHandler
*/
public function setDisplayErrors($displayErrors)
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the throwAt() method instead.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the throwAt() method instead.', E_USER_DEPRECATED);
if ($displayErrors) {
$this->throwAt($this->displayErrors, true);
@ -647,7 +647,7 @@ class ErrorHandler
*/
public static function setLogger(LoggerInterface $logger, $channel = 'deprecation')
{
trigger_error('The '.__METHOD__.' static method is deprecated since version 2.6 and will be removed in 3.0. Use the setLoggers() or setDefaultLogger() methods instead.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' static method is deprecated since version 2.6 and will be removed in 3.0. Use the setLoggers() or setDefaultLogger() methods instead.', E_USER_DEPRECATED);
$handler = set_error_handler('var_dump', 0);
$handler = is_array($handler) ? $handler[0] : null;
@ -684,7 +684,7 @@ class ErrorHandler
*/
public function handleFatal()
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the handleFatalError() method instead.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the handleFatalError() method instead.', E_USER_DEPRECATED);
static::handleFatalError();
}

View File

@ -11,7 +11,7 @@
namespace Symfony\Component\Debug\Exception;
trigger_error('The '.__NAMESPACE__.'\DummyException class is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
@trigger_error('The '.__NAMESPACE__.'\DummyException class is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
/**
* @author Fabien Potencier <fabien@symfony.com>

View File

@ -428,7 +428,7 @@ EOF;
*/
protected static function utf8Htmlize($str)
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.7 and will be removed in 3.0.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.7 and will be removed in 3.0.', E_USER_DEPRECATED);
return htmlspecialchars($str, ENT_QUOTES | (PHP_VERSION_ID >= 50400 ? ENT_SUBSTITUTE : 0), 'UTF-8');
}

View File

@ -0,0 +1,3 @@
vendor/
composer.lock
phpunit.xml

View File

@ -982,7 +982,13 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
if ($callable = $definition->getConfigurator()) {
if (is_array($callable)) {
$callable[0] = $callable[0] instanceof Reference ? $this->get((string) $callable[0]) : $parameterBag->resolveValue($callable[0]);
$callable[0] = $parameterBag->resolveValue($callable[0]);
if ($callable[0] instanceof Reference) {
$callable[0] = $this->get((string) $callable[0], $callable[0]->getInvalidBehavior());
} elseif ($callable[0] instanceof Definition) {
$callable[0] = $this->createService($callable[0], null);
}
}
if (!is_callable($callable)) {
@ -1127,7 +1133,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
private function synchronize($id)
{
if ('request' !== $id) {
trigger_error('The '.__METHOD__.' method is deprecated in version 2.7 and will be removed in version 3.0.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method is deprecated in version 2.7 and will be removed in version 3.0.', E_USER_DEPRECATED);
}
foreach ($this->definitions as $definitionId => $definition) {

View File

@ -98,7 +98,7 @@ class Definition
*/
public function setFactoryClass($factoryClass)
{
trigger_error(sprintf('%s(%s) is deprecated since version 2.6 and will be removed in 3.0. Use Definition::setFactory() instead.', __METHOD__, $factoryClass), E_USER_DEPRECATED);
@trigger_error(sprintf('%s(%s) is deprecated since version 2.6 and will be removed in 3.0. Use Definition::setFactory() instead.', __METHOD__, $factoryClass), E_USER_DEPRECATED);
$this->factoryClass = $factoryClass;
@ -116,7 +116,7 @@ class Definition
public function getFactoryClass($triggerDeprecationError = true)
{
if ($triggerDeprecationError) {
trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0.', E_USER_DEPRECATED);
}
return $this->factoryClass;
@ -134,7 +134,7 @@ class Definition
*/
public function setFactoryMethod($factoryMethod)
{
trigger_error(sprintf('%s(%s) is deprecated since version 2.6 and will be removed in 3.0. Use Definition::setFactory() instead.', __METHOD__, $factoryMethod), E_USER_DEPRECATED);
@trigger_error(sprintf('%s(%s) is deprecated since version 2.6 and will be removed in 3.0. Use Definition::setFactory() instead.', __METHOD__, $factoryMethod), E_USER_DEPRECATED);
$this->factoryMethod = $factoryMethod;
@ -187,7 +187,7 @@ class Definition
public function getFactoryMethod($triggerDeprecationError = true)
{
if ($triggerDeprecationError) {
trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0.', E_USER_DEPRECATED);
}
return $this->factoryMethod;
@ -205,7 +205,7 @@ class Definition
*/
public function setFactoryService($factoryService)
{
trigger_error(sprintf('%s(%s) is deprecated since version 2.6 and will be removed in 3.0. Use Definition::setFactory() instead.', __METHOD__, $factoryService), E_USER_DEPRECATED);
@trigger_error(sprintf('%s(%s) is deprecated since version 2.6 and will be removed in 3.0. Use Definition::setFactory() instead.', __METHOD__, $factoryService), E_USER_DEPRECATED);
$this->factoryService = $factoryService;
@ -223,7 +223,7 @@ class Definition
public function getFactoryService($triggerDeprecationError = true)
{
if ($triggerDeprecationError) {
trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0.', E_USER_DEPRECATED);
}
return $this->factoryService;
@ -667,7 +667,7 @@ class Definition
public function setSynchronized($boolean, $triggerDeprecationError = true)
{
if ($triggerDeprecationError) {
trigger_error('The '.__METHOD__.' method is deprecated since version 2.7 and will be removed in 3.0.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.7 and will be removed in 3.0.', E_USER_DEPRECATED);
}
$this->synchronized = (bool) $boolean;
@ -687,7 +687,7 @@ class Definition
public function isSynchronized($triggerDeprecationError = true)
{
if ($triggerDeprecationError) {
trigger_error('The '.__METHOD__.' method is deprecated since version 2.7 and will be removed in 3.0.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.7 and will be removed in 3.0.', E_USER_DEPRECATED);
}
return $this->synchronized;

View File

@ -705,7 +705,7 @@ EOF;
}
if ('request' !== $id) {
trigger_error('Synchronized services were deprecated in version 2.7 and won\'t work anymore in 3.0.', E_USER_DEPRECATED);
@trigger_error('Synchronized services were deprecated in version 2.7 and won\'t work anymore in 3.0.', E_USER_DEPRECATED);
}
$code = '';
@ -1414,7 +1414,7 @@ EOF;
*/
public function addExpressionLanguageProvider(ExpressionFunctionProviderInterface $provider)
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.6.2 and will be removed in 3.0. Use the Symfony\Component\DependencyInjection\ContainerBuilder::addExpressionLanguageProvider method instead.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.6.2 and will be removed in 3.0. Use the Symfony\Component\DependencyInjection\ContainerBuilder::addExpressionLanguageProvider method instead.', E_USER_DEPRECATED);
$this->expressionLanguageProviders[] = $provider;
}

View File

@ -126,10 +126,11 @@ class XmlFileLoader extends FileLoader
* Parses an individual Definition.
*
* @param \DOMElement $service
* @param string $file
*
* @return Definition|null
*/
private function parseDefinition(\DOMElement $service)
private function parseDefinition(\DOMElement $service, $file)
{
if ($alias = $service->getAttribute('alias')) {
$public = true;
@ -149,13 +150,22 @@ class XmlFileLoader extends FileLoader
foreach (array('class', 'scope', 'public', 'factory-class', 'factory-method', 'factory-service', 'synthetic', 'lazy', 'abstract') as $key) {
if ($value = $service->getAttribute($key)) {
if (in_array($key, array('factory-class', 'factory-method', 'factory-service'))) {
@trigger_error(sprintf('The "%s" attribute in file "%s" is deprecated since version 2.6 and will be removed in 3.0. Use the "factory" element instead.', $key, $file), E_USER_DEPRECATED);
}
$method = 'set'.str_replace('-', '', $key);
$definition->$method(XmlUtils::phpize($value));
}
}
if ($value = $service->getAttribute('synchronized')) {
$definition->setSynchronized(XmlUtils::phpize($value), 'request' !== (string) $service->getAttribute('id'));
$triggerDeprecation = 'request' !== (string) $service->getAttribute('id');
if ($triggerDeprecation) {
@trigger_error(sprintf('The "synchronized" attribute in file "%s" is deprecated since version 2.7 and will be removed in 3.0.', $file), E_USER_DEPRECATED);
}
$definition->setSynchronized(XmlUtils::phpize($value), $triggerDeprecation);
}
if ($files = $this->getChildren($service, 'file')) {
@ -173,7 +183,7 @@ class XmlFileLoader extends FileLoader
$factoryService = $this->getChildren($factory, 'service');
if (isset($factoryService[0])) {
$class = $this->parseDefinition($factoryService[0]);
$class = $this->parseDefinition($factoryService[0], $file);
} elseif ($childService = $factory->getAttribute('service')) {
$class = new Reference($childService, ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, false);
} else {
@ -192,7 +202,7 @@ class XmlFileLoader extends FileLoader
$configuratorService = $this->getChildren($configurator, 'service');
if (isset($configuratorService[0])) {
$class = $this->parseDefinition($configuratorService[0]);
$class = $this->parseDefinition($configuratorService[0], $file);
} elseif ($childService = $configurator->getAttribute('service')) {
$class = new Reference($childService, ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, false);
} else {
@ -233,7 +243,7 @@ class XmlFileLoader extends FileLoader
}
/**
* Parses a XML file to a \DOMDocument
* Parses a XML file to a \DOMDocument.
*
* @param string $file Path to a file
*
@ -392,7 +402,7 @@ class XmlFileLoader extends FileLoader
}
/**
* Get child elements by name
* Get child elements by name.
*
* @param \DOMNode $node
* @param mixed $name

View File

@ -172,6 +172,7 @@ class YamlFileLoader extends FileLoader
}
if (isset($service['synchronized'])) {
@trigger_error(sprintf('The "synchronized" key in file "%s" is deprecated since version 2.7 and will be removed in 3.0.', $file), E_USER_DEPRECATED);
$definition->setSynchronized($service['synchronized'], 'request' !== $id);
}
@ -201,14 +202,17 @@ class YamlFileLoader extends FileLoader
}
if (isset($service['factory_class'])) {
@trigger_error(sprintf('The "factory_class" key in file "%s" is deprecated since version 2.6 and will be removed in 3.0. Use "factory" instead.', $file), E_USER_DEPRECATED);
$definition->setFactoryClass($service['factory_class']);
}
if (isset($service['factory_method'])) {
@trigger_error(sprintf('The "factory_method" key in file "%s" is deprecated since version 2.6 and will be removed in 3.0. Use "factory" instead.', $file), E_USER_DEPRECATED);
$definition->setFactoryMethod($service['factory_method']);
}
if (isset($service['factory_service'])) {
@trigger_error(sprintf('The "factory_service" key in file "%s" is deprecated since version 2.6 and will be removed in 3.0. Use "factory" instead.', $file), E_USER_DEPRECATED);
$definition->setFactoryService($service['factory_service']);
}

View File

@ -11,7 +11,7 @@
namespace Symfony\Component\DependencyInjection;
trigger_error('The '.__NAMESPACE__.'\SimpleXMLElement method is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
@trigger_error('The '.__NAMESPACE__.'\SimpleXMLElement method is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
use Symfony\Component\Config\Util\XmlUtils;
use Symfony\Component\ExpressionLanguage\Expression;

View File

@ -405,9 +405,12 @@ class ContainerBuilderTest extends \PHPUnit_Framework_TestCase
$builder->register('foo3', 'Bar\FooClass')->setConfigurator(array(new Reference('baz'), 'configure'));
$this->assertTrue($builder->get('foo3')->configured, '->createService() calls the configurator');
$builder->register('foo4', 'Bar\FooClass')->setConfigurator('foo');
$builder->register('foo4', 'Bar\FooClass')->setConfigurator(array($builder->getDefinition('baz'), 'configure'));
$this->assertTrue($builder->get('foo4')->configured, '->createService() calls the configurator');
$builder->register('foo5', 'Bar\FooClass')->setConfigurator('foo');
try {
$builder->get('foo4');
$builder->get('foo5');
$this->fail('->createService() throws an InvalidArgumentException if the configure callable is not a valid callable');
} catch (\InvalidArgumentException $e) {
$this->assertEquals('The configure callable for class "Bar\FooClass" is not a callable.', $e->getMessage(), '->createService() throws an InvalidArgumentException if the configure callable is not a valid callable');

View File

@ -6,5 +6,6 @@
<services>
<service id="constructor" class="FooClass" factory-method="getInstance" />
<service id="factory_service" factory-method="getInstance" factory-service="baz_factory" />
<service id="request" class="Request" synthetic="true" synchronized="true" lazy="true"/>
</services>
</container>

View File

@ -47,7 +47,6 @@
</service>
<service id="alias_for_foo" alias="foo" />
<service id="another_alias_for_foo" alias="foo" public="false" />
<service id="request" class="Request" synthetic="true" synchronized="true" lazy="true"/>
<service id="decorator_service" decorates="decorated" />
<service id="decorator_service_with_name" decorates="decorated" decoration-inner-name="decorated.pif-pouf"/>
<service id="new_factory1" class="FooBarClass">

View File

@ -1,3 +1,8 @@
services:
constructor: { class: FooClass, factory_method: getInstance }
factory_service: { class: BazClass, factory_method: getInstance, factory_service: baz_factory }
request:
class: Request
synthetic: true
synchronized: true
lazy: true

View File

@ -23,11 +23,6 @@ services:
another_alias_for_foo:
alias: foo
public: false
request:
class: Request
synthetic: true
synchronized: true
lazy: true
decorator_service:
decorates: decorated
decorator_service_with_name:

View File

@ -206,6 +206,10 @@ class XmlFileLoaderTest extends \PHPUnit_Framework_TestCase
$this->assertNull($services['factory_service']->getClass());
$this->assertEquals('baz_factory', $services['factory_service']->getFactoryService());
$this->assertEquals('getInstance', $services['factory_service']->getFactoryMethod());
$this->assertTrue($services['request']->isSynthetic(), '->load() parses the synthetic flag');
$this->assertTrue($services['request']->isSynchronized(), '->load() parses the synchronized flag');
$this->assertTrue($services['request']->isLazy(), '->load() parses the lazy flag');
$this->assertNull($services['request']->getDecoratedService());
}
public function testLoadServices()
@ -231,10 +235,6 @@ class XmlFileLoaderTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(array(new Reference('baz', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, false), 'getClass'), $services['new_factory2']->getFactory(), '->load() parses the factory tag');
$this->assertEquals(array('BazClass', 'getInstance'), $services['new_factory3']->getFactory(), '->load() parses the factory tag');
$this->assertTrue($services['request']->isSynthetic(), '->load() parses the synthetic flag');
$this->assertTrue($services['request']->isSynchronized(false), '->load() parses the synchronized flag');
$this->assertTrue($services['request']->isLazy(), '->load() parses the lazy flag');
$aliases = $container->getAliases();
$this->assertTrue(isset($aliases['alias_for_foo']), '->load() parses <service> elements');
$this->assertEquals('foo', (string) $aliases['alias_for_foo'], '->load() parses aliases');
@ -243,7 +243,6 @@ class XmlFileLoaderTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('foo', (string) $aliases['another_alias_for_foo']);
$this->assertFalse($aliases['another_alias_for_foo']->isPublic());
$this->assertNull($services['request']->getDecoratedService());
$this->assertEquals(array('decorated', null), $services['decorator_service']->getDecoratedService());
$this->assertEquals(array('decorated', 'decorated.pif-pouf'), $services['decorator_service_with_name']->getDecoratedService());
}

View File

@ -135,6 +135,10 @@ class YamlFileLoaderTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('BazClass', $services['factory_service']->getClass());
$this->assertEquals('baz_factory', $services['factory_service']->getFactoryService());
$this->assertEquals('getInstance', $services['factory_service']->getFactoryMethod());
$this->assertTrue($services['request']->isSynthetic(), '->load() parses the synthetic flag');
$this->assertTrue($services['request']->isSynchronized(), '->load() parses the synchronized flag');
$this->assertTrue($services['request']->isLazy(), '->load() parses the lazy flag');
$this->assertNull($services['request']->getDecoratedService());
}
public function testLoadServices()
@ -160,10 +164,6 @@ class YamlFileLoaderTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(array(new Reference('baz'), 'getClass'), $services['new_factory2']->getFactory(), '->load() parses the factory tag');
$this->assertEquals(array('BazClass', 'getInstance'), $services['new_factory3']->getFactory(), '->load() parses the factory tag');
$this->assertTrue($services['request']->isSynthetic(), '->load() parses the synthetic flag');
$this->assertTrue($services['request']->isSynchronized(false), '->load() parses the synchronized flag');
$this->assertTrue($services['request']->isLazy(), '->load() parses the lazy flag');
$aliases = $container->getAliases();
$this->assertTrue(isset($aliases['alias_for_foo']), '->load() parses aliases');
$this->assertEquals('foo', (string) $aliases['alias_for_foo'], '->load() parses aliases');
@ -172,7 +172,6 @@ class YamlFileLoaderTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('foo', (string) $aliases['another_alias_for_foo']);
$this->assertFalse($aliases['another_alias_for_foo']->isPublic());
$this->assertNull($services['request']->getDecoratedService());
$this->assertEquals(array('decorated', null), $services['decorator_service']->getDecoratedService());
$this->assertEquals(array('decorated', 'decorated.pif-pouf'), $services['decorator_service_with_name']->getDecoratedService());
}

View File

@ -0,0 +1,3 @@
vendor/
composer.lock
phpunit.xml

View File

@ -97,7 +97,7 @@ class Event
*/
public function getDispatcher()
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.4 and will be removed in 3.0. The event dispatcher instance can be received in the listener call instead.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.4 and will be removed in 3.0. The event dispatcher instance can be received in the listener call instead.', E_USER_DEPRECATED);
return $this->dispatcher;
}
@ -113,7 +113,7 @@ class Event
*/
public function getName()
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.4 and will be removed in 3.0. The event name can be received in the listener call instead.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.4 and will be removed in 3.0. The event name can be received in the listener call instead.', E_USER_DEPRECATED);
return $this->name;
}

View File

@ -0,0 +1,3 @@
vendor/
composer.lock
phpunit.xml

View File

@ -1557,8 +1557,8 @@ class Request
*/
public function getContent($asResource = false)
{
if (false === $this->content || (true === $asResource && null !== $this->content)) {
throw new \LogicException('getContent() can only be called once when using the resource return type.');
if (PHP_VERSION_ID < 50600 && (false === $this->content || (true === $asResource && null !== $this->content))) {
throw new \LogicException('getContent() can only be called once when using the resource return type and PHP below 5.6.');
}
if (true === $asResource) {

View File

@ -1080,7 +1080,7 @@ class Response
$lastModified = $this->headers->get('Last-Modified');
$modifiedSince = $request->headers->get('If-Modified-Since');
if ($etags = $request->getEtags()) {
if ($etags = $request->getETags()) {
$notModified = in_array($this->getEtag(), $etags) || in_array('*', $etags);
}

View File

@ -175,7 +175,7 @@ class FlashBag implements FlashBagInterface, \IteratorAggregate
*/
public function getIterator()
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.4 and will be removed in 3.0.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.4 and will be removed in 3.0.', E_USER_DEPRECATED);
return new \ArrayIterator($this->all());
}

View File

@ -11,7 +11,7 @@
namespace Symfony\Component\HttpFoundation\Session\Storage\Handler;
trigger_error('The '.__NAMESPACE__.'\LegacyPdoSessionHandler class is deprecated since version 2.6 and will be removed in 3.0. Use the Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler class instead.', E_USER_DEPRECATED);
@trigger_error('The '.__NAMESPACE__.'\LegacyPdoSessionHandler class is deprecated since version 2.6 and will be removed in 3.0. Use the Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler class instead.', E_USER_DEPRECATED);
/**
* Session handler using a PDO connection to read and write data.

View File

@ -179,7 +179,7 @@ class BinaryFileResponseTest extends ResponseTestCase
$file = new FakeFile($realpath, __DIR__.'/File/Fixtures/test');
BinaryFileResponse::trustXSendFileTypeHeader();
BinaryFileResponse::trustXSendfileTypeHeader();
$response = new BinaryFileResponse($file);
$reflection = new \ReflectionObject($response);
$property = $reflection->getProperty('file');

View File

@ -975,11 +975,40 @@ class RequestTest extends \PHPUnit_Framework_TestCase
*/
public function testGetContentCantBeCalledTwiceWithResources($first, $second)
{
if (PHP_VERSION_ID >= 50600) {
$this->markTestSkipped('PHP >= 5.6 allows to open php://input several times.');
}
$req = new Request();
$req->getContent($first);
$req->getContent($second);
}
/**
*
* @dataProvider getContentCantBeCalledTwiceWithResourcesProvider
*/
public function testGetContentCanBeCalledTwiceWithResources($first, $second)
{
if (PHP_VERSION_ID < 50600) {
$this->markTestSkipped('PHP < 5.6 does not allow to open php://input several times.');
}
$req = new Request();
$a = $req->getContent($first);
$b = $req->getContent($second);
if ($first) {
$a = stream_get_contents($a);
}
if ($second) {
$b = stream_get_contents($b);
}
$this->assertEquals($a, $b);
}
public function getContentCantBeCalledTwiceWithResourcesProvider()
{
return array(

View File

@ -0,0 +1,5 @@
vendor/
composer.lock
phpunit.xml
Tests/Fixtures/cache/
Tests/Fixtures/logs/

View File

@ -129,7 +129,7 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
$this->data['controller'] = array(
'class' => is_object($controller[0]) ? get_class($controller[0]) : $controller[0],
'method' => $controller[1],
'file' => $r->getFilename(),
'file' => $r->getFileName(),
'line' => $r->getStartLine(),
);
} catch (\ReflectionException $re) {
@ -148,7 +148,7 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
$this->data['controller'] = array(
'class' => $r->getName(),
'method' => null,
'file' => $r->getFilename(),
'file' => $r->getFileName(),
'line' => $r->getStartLine(),
);
} elseif (is_object($controller)) {

View File

@ -11,7 +11,7 @@
namespace Symfony\Component\HttpKernel\Debug;
trigger_error('The '.__NAMESPACE__.'\ErrorHandler class is deprecated since version 2.3 and will be removed in 3.0. Use the Symfony\Component\Debug\ErrorHandler class instead.', E_USER_DEPRECATED);
@trigger_error('The '.__NAMESPACE__.'\ErrorHandler class is deprecated since version 2.3 and will be removed in 3.0. Use the Symfony\Component\Debug\ErrorHandler class instead.', E_USER_DEPRECATED);
use Symfony\Component\Debug\ErrorHandler as DebugErrorHandler;

View File

@ -11,7 +11,7 @@
namespace Symfony\Component\HttpKernel\Debug;
trigger_error('The '.__NAMESPACE__.'\ExceptionHandler class is deprecated since version 2.3 and will be removed in 3.0. Use the Symfony\Component\Debug\ExceptionHandler class instead.', E_USER_DEPRECATED);
@trigger_error('The '.__NAMESPACE__.'\ExceptionHandler class is deprecated since version 2.3 and will be removed in 3.0. Use the Symfony\Component\Debug\ExceptionHandler class instead.', E_USER_DEPRECATED);
use Symfony\Component\Debug\ExceptionHandler as DebugExceptionHandler;

View File

@ -38,7 +38,7 @@ class TraceableEventDispatcher extends BaseTraceableEventDispatcher
*/
public function setProfiler(Profiler $profiler = null)
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.4 and will be removed in 3.0.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.4 and will be removed in 3.0.', E_USER_DEPRECATED);
}
/**

View File

@ -46,7 +46,7 @@ class ContainerAwareHttpKernel extends HttpKernel
parent::__construct($dispatcher, $controllerResolver, $requestStack);
if ($triggerDeprecation) {
trigger_error('The '.__CLASS__.' class is deprecated since version 2.7 and will be removed in 3.0. Use the Symfony\Component\HttpKernel\HttpKernel class instead.', E_USER_DEPRECATED);
@trigger_error('The '.__CLASS__.' class is deprecated since version 2.7 and will be removed in 3.0. Use the Symfony\Component\HttpKernel\HttpKernel class instead.', E_USER_DEPRECATED);
}
$this->container = $container;

View File

@ -60,7 +60,7 @@ class FragmentRendererPass implements CompilerPassInterface
foreach ($tags as $tag) {
if (!isset($tag['alias'])) {
trigger_error(sprintf('Service "%s" will have to define the "alias" attribute on the "%s" tag as of Symfony 3.0.', $id, $this->rendererTag), E_USER_DEPRECATED);
@trigger_error(sprintf('Service "%s" will have to define the "alias" attribute on the "%s" tag as of Symfony 3.0.', $id, $this->rendererTag), E_USER_DEPRECATED);
// register the handler as a non-lazy-loaded one
$definition->addMethodCall('addRenderer', array(new Reference($id)));

View File

@ -11,7 +11,7 @@
namespace Symfony\Component\HttpKernel\DependencyInjection;
trigger_error('The '.__NAMESPACE__.'\RegisterListenersPass is deprecated since version 2.5 and will be removed in 3.0. Use the Symfony\Component\EventDispatcher\DependencyInjection\RegisterListenersPass class instead.', E_USER_DEPRECATED);
@trigger_error('The '.__NAMESPACE__.'\RegisterListenersPass is deprecated since version 2.5 and will be removed in 3.0. Use the Symfony\Component\EventDispatcher\DependencyInjection\RegisterListenersPass class instead.', E_USER_DEPRECATED);
use Symfony\Component\EventDispatcher\DependencyInjection\RegisterListenersPass as BaseRegisterListenersPass;

View File

@ -11,7 +11,7 @@
namespace Symfony\Component\HttpKernel\EventListener;
trigger_error('The '.__NAMESPACE__.'\ErrorsLoggerListener class is deprecated since version 2.6 and will be removed in 3.0. Use the Symfony\Component\HttpKernel\EventListener\DebugHandlersListener class instead.', E_USER_DEPRECATED);
@trigger_error('The '.__NAMESPACE__.'\ErrorsLoggerListener class is deprecated since version 2.6 and will be removed in 3.0. Use the Symfony\Component\HttpKernel\EventListener\DebugHandlersListener class instead.', E_USER_DEPRECATED);
use Psr\Log\LoggerInterface;
use Symfony\Component\Debug\ErrorHandler;

View File

@ -11,7 +11,7 @@
namespace Symfony\Component\HttpKernel\EventListener;
trigger_error('The '.__NAMESPACE__.'\EsiListener class is deprecated since version 2.6 and will be removed in 3.0. Use the Symfony\Component\HttpKernel\EventListener\SurrogateListener class instead.', E_USER_DEPRECATED);
@trigger_error('The '.__NAMESPACE__.'\EsiListener class is deprecated since version 2.6 and will be removed in 3.0. Use the Symfony\Component\HttpKernel\EventListener\SurrogateListener class instead.', E_USER_DEPRECATED);
/**
* EsiListener adds a Surrogate-Control HTTP header when the Response needs to be parsed for ESI.

View File

@ -94,7 +94,7 @@ class FragmentListener implements EventSubscriberInterface
*/
protected function getLocalIpAddresses()
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.3.19 and will be removed in 3.0.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.3.19 and will be removed in 3.0.', E_USER_DEPRECATED);
return array('127.0.0.1', 'fe80::1', '::1');
}

View File

@ -58,7 +58,7 @@ class LocaleListener implements EventSubscriberInterface
*/
public function setRequest(Request $request = null)
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.4 and will be removed in 3.0.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.4 and will be removed in 3.0.', E_USER_DEPRECATED);
if (null === $request) {
return;

View File

@ -53,7 +53,7 @@ class ProfilerListener implements EventSubscriberInterface
// Prevent the deprecation notice to be triggered all the time.
// The onKernelRequest() method fires some logic only when the
// RequestStack instance is not provided as a dependency.
trigger_error('Since version 2.4, the '.__METHOD__.' method must accept a RequestStack instance to get the request instead of using the '.__CLASS__.'::onKernelRequest method that will be removed in 3.0.', E_USER_DEPRECATED);
@trigger_error('Since version 2.4, the '.__METHOD__.' method must accept a RequestStack instance to get the request instead of using the '.__CLASS__.'::onKernelRequest method that will be removed in 3.0.', E_USER_DEPRECATED);
}
$this->profiler = $profiler;

View File

@ -68,7 +68,7 @@ class RouterListener implements EventSubscriberInterface
}
if (!$requestStack instanceof RequestStack) {
trigger_error('The '.__METHOD__.' method now requires a RequestStack instance as '.__CLASS__.'::setRequest method will not be supported anymore in 3.0.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method now requires a RequestStack instance as '.__CLASS__.'::setRequest method will not be supported anymore in 3.0.', E_USER_DEPRECATED);
}
$this->matcher = $matcher;
@ -90,7 +90,7 @@ class RouterListener implements EventSubscriberInterface
*/
public function setRequest(Request $request = null)
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.4 and will be made private in 3.0.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.4 and will be made private in 3.0.', E_USER_DEPRECATED);
$this->setCurrentRequest($request);
}

View File

@ -11,7 +11,7 @@
namespace Symfony\Component\HttpKernel\Exception;
trigger_error('The '.__NAMESPACE__.'\FatalErrorException class is deprecated since version 2.3 and will be removed in 3.0. Use the Symfony\Component\Debug\Exception\FatalErrorException class instead.', E_USER_DEPRECATED);
@trigger_error('The '.__NAMESPACE__.'\FatalErrorException class is deprecated since version 2.3 and will be removed in 3.0. Use the Symfony\Component\Debug\Exception\FatalErrorException class instead.', E_USER_DEPRECATED);
/*
* Fatal Error Exception.

View File

@ -11,7 +11,7 @@
namespace Symfony\Component\HttpKernel\Exception;
trigger_error('The '.__NAMESPACE__.'\FlattenException class is deprecated since version 2.3 and will be removed in 3.0. Use the Symfony\Component\Debug\Exception\FlattenException class instead.', E_USER_DEPRECATED);
@trigger_error('The '.__NAMESPACE__.'\FlattenException class is deprecated since version 2.3 and will be removed in 3.0. Use the Symfony\Component\Debug\Exception\FlattenException class instead.', E_USER_DEPRECATED);
/*
* FlattenException wraps a PHP Exception to be able to serialize it.

View File

@ -80,7 +80,7 @@ class FragmentHandler
*/
public function setRequest(Request $request = null)
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.4 and will be removed in 3.0.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.4 and will be removed in 3.0.', E_USER_DEPRECATED);
$this->request = $request;
}

View File

@ -87,7 +87,7 @@ class Esi implements SurrogateInterface
*/
public function hasSurrogateEsiCapability(Request $request)
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the hasSurrogateCapability() method instead.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the hasSurrogateCapability() method instead.', E_USER_DEPRECATED);
return $this->hasSurrogateCapability($request);
}
@ -114,7 +114,7 @@ class Esi implements SurrogateInterface
*/
public function addSurrogateEsiCapability(Request $request)
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the addSurrogateCapability() method instead.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the addSurrogateCapability() method instead.', E_USER_DEPRECATED);
$this->addSurrogateCapability($request);
}
@ -160,7 +160,7 @@ class Esi implements SurrogateInterface
*/
public function needsEsiParsing(Response $response)
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the needsParsing() method instead.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the needsParsing() method instead.', E_USER_DEPRECATED);
return $this->needsParsing($response);
}

View File

@ -15,7 +15,7 @@
namespace Symfony\Component\HttpKernel\HttpCache;
trigger_error('The '.__NAMESPACE__.'\EsiResponseCacheStrategy class is deprecated since version 2.6 and will be removed in 3.0. Use the Symfony\Component\HttpKernel\HttpCache\ResponseCacheStrategy class instead.', E_USER_DEPRECATED);
@trigger_error('The '.__NAMESPACE__.'\EsiResponseCacheStrategy class is deprecated since version 2.6 and will be removed in 3.0. Use the Symfony\Component\HttpKernel\HttpCache\ResponseCacheStrategy class instead.', E_USER_DEPRECATED);
/**
* EsiResponseCacheStrategy knows how to compute the Response cache HTTP header

View File

@ -15,7 +15,7 @@
namespace Symfony\Component\HttpKernel\HttpCache;
trigger_error('The '.__NAMESPACE__.'\EsiResponseCacheStrategyInterface class is deprecated since version 2.6 and will be removed in 3.0. Use the Symfony\Component\HttpKernel\HttpCache\ResponseCacheStrategyInterface class instead.', E_USER_DEPRECATED);
@trigger_error('The '.__NAMESPACE__.'\EsiResponseCacheStrategyInterface class is deprecated since version 2.6 and will be removed in 3.0. Use the Symfony\Component\HttpKernel\HttpCache\ResponseCacheStrategyInterface class instead.', E_USER_DEPRECATED);
/**
* ResponseCacheStrategyInterface implementations know how to compute the

View File

@ -174,7 +174,7 @@ class HttpCache implements HttpKernelInterface, TerminableInterface
*/
public function getEsi()
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the getSurrogate() method instead.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the getSurrogate() method instead.', E_USER_DEPRECATED);
if (!$this->surrogate instanceof Esi) {
throw new \LogicException('This instance of HttpCache was not set up to use ESI as surrogate handler. You must overwrite and use createSurrogate');
@ -388,7 +388,7 @@ class HttpCache implements HttpKernelInterface, TerminableInterface
// We keep the etags from the client to handle the case when the client
// has a different private valid entry which is not cached here.
$cachedEtags = $entry->getEtag() ? array($entry->getEtag()) : array();
$requestEtags = $request->getEtags();
$requestEtags = $request->getETags();
if ($etags = array_unique(array_merge($cachedEtags, $requestEtags))) {
$subRequest->headers->set('if_none_match', implode(', ', $etags));
}

View File

@ -60,11 +60,11 @@ abstract class Kernel implements KernelInterface, TerminableInterface
protected $startTime;
protected $loadClassCache;
const VERSION = '2.7.0';
const VERSION_ID = '20700';
const VERSION = '2.7.1';
const VERSION_ID = '20701';
const MAJOR_VERSION = '2';
const MINOR_VERSION = '7';
const RELEASE_VERSION = '0';
const RELEASE_VERSION = '1';
const EXTRA_VERSION = '';
const END_OF_MAINTENANCE = '05/2018';
@ -93,7 +93,7 @@ abstract class Kernel implements KernelInterface, TerminableInterface
$defClass = $defClass->getDeclaringClass()->name;
if (__CLASS__ !== $defClass) {
trigger_error(sprintf('Calling the %s::init() method is deprecated since version 2.3 and will be removed in 3.0. Move your logic to the constructor method instead.', $defClass), E_USER_DEPRECATED);
@trigger_error(sprintf('Calling the %s::init() method is deprecated since version 2.3 and will be removed in 3.0. Move your logic to the constructor method instead.', $defClass), E_USER_DEPRECATED);
$this->init();
}
}
@ -103,7 +103,7 @@ abstract class Kernel implements KernelInterface, TerminableInterface
*/
public function init()
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0. Move your logic to the constructor method instead.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.3 and will be removed in 3.0. Move your logic to the constructor method instead.', E_USER_DEPRECATED);
}
public function __clone()
@ -225,7 +225,7 @@ abstract class Kernel implements KernelInterface, TerminableInterface
*/
public function isClassInActiveBundle($class)
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in version 3.0.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in version 3.0.', E_USER_DEPRECATED);
foreach ($this->getBundles() as $bundle) {
if (0 === strpos($class, $bundle->getNamespace())) {

View File

@ -11,7 +11,7 @@
namespace Symfony\Component\HttpKernel\Log;
trigger_error('The '.__NAMESPACE__.'\NullLogger class is deprecated since version 2.2 and will be removed in 3.0. Use the Psr\Log\NullLogger class instead from the psr/log Composer package.', E_USER_DEPRECATED);
@trigger_error('The '.__NAMESPACE__.'\NullLogger class is deprecated since version 2.2 and will be removed in 3.0. Use the Psr\Log\NullLogger class instead from the psr/log Composer package.', E_USER_DEPRECATED);
use Psr\Log\NullLogger as PsrNullLogger;
@ -29,7 +29,7 @@ class NullLogger extends PsrNullLogger implements LoggerInterface
*/
public function emerg($message, array $context = array())
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.2 and will be removed in 3.0. You should use the new emergency() method instead, which is PSR-3 compatible.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.2 and will be removed in 3.0. You should use the new emergency() method instead, which is PSR-3 compatible.', E_USER_DEPRECATED);
}
/**
@ -37,7 +37,7 @@ class NullLogger extends PsrNullLogger implements LoggerInterface
*/
public function crit($message, array $context = array())
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.2 and will be removed in 3.0. You should use the new critical() method instead, which is PSR-3 compatible.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.2 and will be removed in 3.0. You should use the new critical() method instead, which is PSR-3 compatible.', E_USER_DEPRECATED);
}
/**
@ -45,7 +45,7 @@ class NullLogger extends PsrNullLogger implements LoggerInterface
*/
public function err($message, array $context = array())
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.2 and will be removed in 3.0. You should use the new error() method instead, which is PSR-3 compatible.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.2 and will be removed in 3.0. You should use the new error() method instead, which is PSR-3 compatible.', E_USER_DEPRECATED);
}
/**
@ -53,6 +53,6 @@ class NullLogger extends PsrNullLogger implements LoggerInterface
*/
public function warn($message, array $context = array())
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.2 and will be removed in 3.0. You should use the new warning() method instead, which is PSR-3 compatible.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.2 and will be removed in 3.0. You should use the new warning() method instead, which is PSR-3 compatible.', E_USER_DEPRECATED);
}
}

View File

@ -41,7 +41,7 @@ class MemcacheProfilerStorage extends BaseMemcacheProfilerStorage
$port = $matches[3];
$memcache = new \Memcache();
$memcache->addServer($host, $port);
$memcache->addserver($host, $port);
$this->memcache = $memcache;
}

View File

@ -37,9 +37,9 @@ class ConfigDataCollectorTest extends \PHPUnit_Framework_TestCase
// if else clause because we don't know it
if (extension_loaded('xdebug')) {
$this->assertTrue($c->hasXdebug());
$this->assertTrue($c->hasXDebug());
} else {
$this->assertFalse($c->hasXdebug());
$this->assertFalse($c->hasXDebug());
}
// if else clause because we don't know it

View File

@ -0,0 +1,3 @@
vendor/
composer.lock
phpunit.xml

View File

@ -1069,7 +1069,7 @@ class Process
*/
public function getStdin()
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0. Use the getInput() method instead.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0. Use the getInput() method instead.', E_USER_DEPRECATED);
return $this->getInput();
}
@ -1099,7 +1099,7 @@ class Process
*/
public function setStdin($stdin)
{
trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0. Use the setInput() method instead.', E_USER_DEPRECATED);
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0. Use the setInput() method instead.', E_USER_DEPRECATED);
return $this->setInput($stdin);
}

View File

@ -97,7 +97,7 @@ class ProcessUtils
}
// deprecated as of Symfony 2.5, to be removed in 3.0
if (is_object($input) && method_exists($input, '__toString')) {
trigger_error('Passing an object as an input is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
@trigger_error('Passing an object as an input is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
return (string) $input;
}

View File

@ -91,7 +91,7 @@ class PhpExecutableFinderTest extends \PHPUnit_Framework_TestCase
//TODO maybe php executable is custom or even Windows
if ('\\' === DIRECTORY_SEPARATOR) {
$this->assertTrue(is_executable($current));
$this->assertTrue((bool) preg_match('/'.addSlashes(DIRECTORY_SEPARATOR).'php\.(exe|bat|cmd|com)$/i', $current), '::find() returns the executable PHP with suffixes');
$this->assertTrue((bool) preg_match('/'.addslashes(DIRECTORY_SEPARATOR).'php\.(exe|bat|cmd|com)$/i', $current), '::find() returns the executable PHP with suffixes');
}
}
}

Some files were not shown because too many files have changed in this diff Show More