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

View File

@ -69,11 +69,20 @@ class Cookie
$this->rawValue = urlencode($value); $this->rawValue = urlencode($value);
} }
$this->name = $name; $this->name = $name;
$this->expires = null === $expires ? null : (int) $expires;
$this->path = empty($path) ? '/' : $path; $this->path = empty($path) ? '/' : $path;
$this->domain = $domain; $this->domain = $domain;
$this->secure = (bool) $secure; $this->secure = (bool) $secure;
$this->httponly = (bool) $httponly; $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) { if (null !== $this->expires) {
$dateTime = \DateTime::createFromFormat('U', $this->expires, new \DateTimeZone('GMT')); $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])); $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', 'http://www.example.com/foo/foobar');
$client->request('GET', 'bar'); $client->request('GET', 'bar');
$this->assertEquals('http://www.example.com/foo/bar', $client->getRequest()->getUri(), '->request() uses the previous request for relative URLs'); $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() public function testRequestURIConversionByServerHost()
@ -332,7 +347,7 @@ class ClientTest extends \PHPUnit_Framework_TestCase
$client->followRedirect(); $client->followRedirect();
$this->fail('->followRedirect() throws a \LogicException if the request was not redirected'); $this->fail('->followRedirect() throws a \LogicException if the request was not redirected');
} catch (\Exception $e) { } 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'))); $client->setNextResponse(new Response('', 302, array('Location' => 'http://www.example.com/redirected')));
@ -362,7 +377,7 @@ class ClientTest extends \PHPUnit_Framework_TestCase
$client->followRedirect(); $client->followRedirect();
$this->fail('->followRedirect() throws a \LogicException if the request did not respond with 30x HTTP Code'); $this->fail('->followRedirect() throws a \LogicException if the request did not respond with 30x HTTP Code');
} catch (\Exception $e) { } 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(); $client->followRedirect();
$this->fail('->followRedirect() throws a \LogicException if the request was redirected and limit of redirections was reached'); $this->fail('->followRedirect() throws a \LogicException if the request was redirected and limit of redirections was reached');
} catch (\Exception $e) { } 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'))); $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'); $client->request('GET', 'http://www.example.com/foo/foobar');
$this->fail('->request() throws a \RuntimeException if the script has an error'); $this->fail('->request() throws a \RuntimeException if the script has an error');
} catch (\Exception $e) { } 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() 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')); $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=/', (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=/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.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.myotherexample.com; path=/', (string) Cookie::fromString('foo=bar; domain=www.myotherexample.com', 'http://www.example.com/'));
} }
public function testFromStringThrowsAnExceptionIfCookieIsNotValid() public function testFromStringThrowsAnExceptionIfCookieIsNotValid()
{ {
$this->setExpectedException('InvalidArgumentException'); $this->setExpectedException('InvalidArgumentException');
Cookie::FromString('foo'); Cookie::fromString('foo');
} }
public function testFromStringThrowsAnExceptionIfCookieDateIsNotValid() public function testFromStringThrowsAnExceptionIfCookieDateIsNotValid()
{ {
$this->setExpectedException('InvalidArgumentException'); $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() public function testFromStringThrowsAnExceptionIfUrlIsNotValid()
{ {
$this->setExpectedException('InvalidArgumentException'); $this->setExpectedException('InvalidArgumentException');
Cookie::FromString('foo=bar', 'foobar'); Cookie::fromString('foo=bar', 'foobar');
} }
public function testGetName() public function testGetName()

View File

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

View File

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

View File

@ -11,7 +11,7 @@
namespace Symfony\Component\ClassLoader; 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. * ApcUniversalClassLoader implements a "universal" autoloader cached in APC for PHP 5.3.

View File

@ -11,7 +11,7 @@
namespace Symfony\Component\ClassLoader; 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. * Autoloader checking if the class is really defined in the file found.

View File

@ -11,7 +11,7 @@
namespace Symfony\Component\ClassLoader; 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. * Checks that the class is actually declared in the included file.

View File

@ -11,7 +11,7 @@
namespace Symfony\Component\ClassLoader; 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. * UniversalClassLoader implements a "universal" autoloader for PHP 5.3.

View File

@ -488,7 +488,7 @@ class Application
if (empty($namespaces)) { if (empty($namespaces)) {
$message = sprintf('There are no commands defined in the "%s" namespace.', $namespace); $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)) { if (1 == count($alternatives)) {
$message .= "\n\nDid you mean this?\n "; $message .= "\n\nDid you mean this?\n ";
} else { } else {
@ -537,7 +537,7 @@ class Application
$message = sprintf('Command "%s" is not defined.', $name); $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)) { if (1 == count($alternatives)) {
$message .= "\n\nDid you mean this?\n "; $message .= "\n\nDid you mean this?\n ";
} else { } else {
@ -628,7 +628,7 @@ class Application
*/ */
public function asText($namespace = null, $raw = false) 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(); $descriptor = new TextDescriptor();
$output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, !$raw); $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, !$raw);
@ -649,7 +649,7 @@ class Application
*/ */
public function asXml($namespace = null, $asDom = false) 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(); $descriptor = new XmlDescriptor();

View File

@ -645,7 +645,7 @@ class Command
*/ */
public function asText() 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(); $descriptor = new TextDescriptor();
$output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true); $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true);
@ -665,7 +665,7 @@ class Command
*/ */
public function asXml($asDom = false) 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(); $descriptor = new XmlDescriptor();

View File

@ -77,7 +77,7 @@ EOF
} }
if ($input->getOption('xml')) { 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'); $input->setOption('format', 'xml');
} }

View File

@ -69,7 +69,7 @@ EOF
protected function execute(InputInterface $input, OutputInterface $output) protected function execute(InputInterface $input, OutputInterface $output)
{ {
if ($input->getOption('xml')) { 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'); $input->setOption('format', 'xml');
} }

View File

@ -31,7 +31,7 @@ class DialogHelper extends InputAwareHelper
public function __construct($triggerDeprecationError = true) public function __construct($triggerDeprecationError = true)
{ {
if ($triggerDeprecationError) { 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) { 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) { } 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) { } 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]; return $this->helpers[$name];

View File

@ -177,7 +177,7 @@ class ProgressBar
*/ */
public function getStep() 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(); return $this->getProgress();
} }
@ -368,7 +368,7 @@ class ProgressBar
*/ */
public function setCurrent($step) 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); $this->setProgress($step);
} }

View File

@ -121,7 +121,7 @@ class ProgressHelper extends Helper
public function __construct($triggerDeprecationError = true) public function __construct($triggerDeprecationError = true)
{ {
if ($triggerDeprecationError) { 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

@ -550,12 +550,13 @@ class Table
{ {
if (isset($row[$column])) { if (isset($row[$column])) {
$cell = $row[$column]; $cell = $row[$column];
$cellWidth = Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell);
if ($cell instanceof TableCell && $cell->getColspan() > 1) { if ($cell instanceof TableCell && $cell->getColspan() > 1) {
// we assume that cell value will be across more than one column. // 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; return 0;

View File

@ -37,7 +37,7 @@ class TableHelper extends Helper
public function __construct($triggerDeprecationError = true) public function __construct($triggerDeprecationError = true)
{ {
if ($triggerDeprecationError) { 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()); $this->table = new Table(new NullOutput());

View File

@ -449,7 +449,7 @@ class InputDefinition
*/ */
public function asText() 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(); $descriptor = new TextDescriptor();
$output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true); $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true);
@ -469,7 +469,7 @@ class InputDefinition
*/ */
public function asXml($asDom = false) 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(); $descriptor = new XmlDescriptor();

View File

@ -40,7 +40,7 @@ class StringInput extends ArgvInput
public function __construct($input, InputDefinition $definition = null) public function __construct($input, InputDefinition $definition = null)
{ {
if ($definition) { 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); 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\SymfonyQuestionHelper;
use Symfony\Component\Console\Helper\Table; use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\BufferedOutput;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\ChoiceQuestion; use Symfony\Component\Console\Question\ChoiceQuestion;
use Symfony\Component\Console\Question\ConfirmationQuestion; use Symfony\Component\Console\Question\ConfirmationQuestion;
@ -36,6 +37,7 @@ class SymfonyStyle extends OutputStyle
private $questionHelper; private $questionHelper;
private $progressBar; private $progressBar;
private $lineLength; private $lineLength;
private $bufferedOutput;
/** /**
* @param InputInterface $input * @param InputInterface $input
@ -44,7 +46,9 @@ class SymfonyStyle extends OutputStyle
public function __construct(InputInterface $input, OutputInterface $output) public function __construct(InputInterface $input, OutputInterface $output)
{ {
$this->input = $input; $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); parent::__construct($output);
} }
@ -60,6 +64,7 @@ class SymfonyStyle extends OutputStyle
*/ */
public function block($messages, $type = null, $style = null, $prefix = ' ', $padding = false) public function block($messages, $type = null, $style = null, $prefix = ' ', $padding = false)
{ {
$this->autoPrependBlock();
$messages = is_array($messages) ? array_values($messages) : array($messages); $messages = is_array($messages) ? array_values($messages) : array($messages);
$lines = array(); $lines = array();
@ -71,7 +76,7 @@ class SymfonyStyle extends OutputStyle
// wrap and add newlines for each element // wrap and add newlines for each element
foreach ($messages as $key => $message) { foreach ($messages as $key => $message) {
$message = OutputFormatter::escape($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) { if (count($messages) > 1 && $key < count($messages) - 1) {
$lines[] = ''; $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) 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) 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) public function listing(array $elements)
{ {
$this->autoPrependText();
$elements = array_map(function ($element) { $elements = array_map(function ($element) {
return sprintf(' * %s', $element); return sprintf(' * %s', $element);
}, }, $elements);
$elements
);
$this->writeln(implode("\n", $elements)."\n"); $this->writeln($elements);
$this->newLine();
} }
/** /**
@ -130,6 +146,8 @@ class SymfonyStyle extends OutputStyle
*/ */
public function text($message) public function text($message)
{ {
$this->autoPrependText();
if (!is_array($message)) { if (!is_array($message)) {
$this->writeln(sprintf(' // %s', $message)); $this->writeln(sprintf(' // %s', $message));
@ -205,7 +223,7 @@ class SymfonyStyle extends OutputStyle
$question = new Question($question, $default); $question = new Question($question, $default);
$question->setValidator($validator); $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) public function askHidden($question, $validator = null)
{ {
$question = new Question($question); $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) public function askQuestion(Question $question)
{ {
if ($this->input->isInteractive()) {
$this->autoPrependBlock();
}
if (!$this->questionHelper) { if (!$this->questionHelper) {
$this->questionHelper = new SymfonyQuestionHelper(); $this->questionHelper = new SymfonyQuestionHelper();
} }
$answer = $this->questionHelper->ask($this->input, $this, $question); $answer = $this->questionHelper->ask($this->input, $this, $question);
if ($this->input->isInteractive()) {
$this->newLine(); $this->newLine();
$this->bufferedOutput->write("\n");
}
return $answer; 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 * @return ProgressBar
*/ */
@ -320,4 +374,33 @@ class SymfonyStyle extends OutputStyle
return $dimensions[0] ?: self::MAX_LINE_LENGTH; 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'); $this->wasFinder = is_object($classLoader) && method_exists($classLoader, 'findFile');
if ($this->wasFinder) { 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->classLoader = array($classLoader, 'loadClass');
$this->isFinder = true; $this->isFinder = true;
} else { } else {
@ -127,7 +127,7 @@ class DebugClassLoader
*/ */
public function findFile($class) 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) { if ($this->wasFinder) {
return $this->classLoader[0]->findFile($class); return $this->classLoader[0]->findFile($class);
@ -200,12 +200,12 @@ class DebugClassLoader
if (!$parent || strncmp($ns, $parent->name, $len)) { if (!$parent || strncmp($ns, $parent->name, $len)) {
if ($parent && isset(self::$deprecated[$parent->name]) && 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) { foreach ($refl->getInterfaceNames() as $interface) {
if (isset(self::$deprecated[$interface]) && strncmp($ns, $interface, $len) && !($parent && $parent->implementsInterface($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) 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; $level = null === $level ? error_reporting() : $level;
$this->throwAt($level, true); $this->throwAt($level, true);
@ -626,7 +626,7 @@ class ErrorHandler
*/ */
public function setDisplayErrors($displayErrors) 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) { if ($displayErrors) {
$this->throwAt($this->displayErrors, true); $this->throwAt($this->displayErrors, true);
@ -647,7 +647,7 @@ class ErrorHandler
*/ */
public static function setLogger(LoggerInterface $logger, $channel = 'deprecation') 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 = set_error_handler('var_dump', 0);
$handler = is_array($handler) ? $handler[0] : null; $handler = is_array($handler) ? $handler[0] : null;
@ -684,7 +684,7 @@ class ErrorHandler
*/ */
public function handleFatal() 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(); static::handleFatalError();
} }

View File

@ -11,7 +11,7 @@
namespace Symfony\Component\Debug\Exception; 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> * @author Fabien Potencier <fabien@symfony.com>

View File

@ -428,7 +428,7 @@ EOF;
*/ */
protected static function utf8Htmlize($str) 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'); 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 ($callable = $definition->getConfigurator()) {
if (is_array($callable)) { 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)) { if (!is_callable($callable)) {
@ -1127,7 +1133,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
private function synchronize($id) private function synchronize($id)
{ {
if ('request' !== $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) { foreach ($this->definitions as $definitionId => $definition) {

View File

@ -98,7 +98,7 @@ class Definition
*/ */
public function setFactoryClass($factoryClass) 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; $this->factoryClass = $factoryClass;
@ -116,7 +116,7 @@ class Definition
public function getFactoryClass($triggerDeprecationError = true) public function getFactoryClass($triggerDeprecationError = true)
{ {
if ($triggerDeprecationError) { 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; return $this->factoryClass;
@ -134,7 +134,7 @@ class Definition
*/ */
public function setFactoryMethod($factoryMethod) 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; $this->factoryMethod = $factoryMethod;
@ -187,7 +187,7 @@ class Definition
public function getFactoryMethod($triggerDeprecationError = true) public function getFactoryMethod($triggerDeprecationError = true)
{ {
if ($triggerDeprecationError) { 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; return $this->factoryMethod;
@ -205,7 +205,7 @@ class Definition
*/ */
public function setFactoryService($factoryService) 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; $this->factoryService = $factoryService;
@ -223,7 +223,7 @@ class Definition
public function getFactoryService($triggerDeprecationError = true) public function getFactoryService($triggerDeprecationError = true)
{ {
if ($triggerDeprecationError) { 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; return $this->factoryService;
@ -667,7 +667,7 @@ class Definition
public function setSynchronized($boolean, $triggerDeprecationError = true) public function setSynchronized($boolean, $triggerDeprecationError = true)
{ {
if ($triggerDeprecationError) { 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; $this->synchronized = (bool) $boolean;
@ -687,7 +687,7 @@ class Definition
public function isSynchronized($triggerDeprecationError = true) public function isSynchronized($triggerDeprecationError = true)
{ {
if ($triggerDeprecationError) { 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; return $this->synchronized;

View File

@ -705,7 +705,7 @@ EOF;
} }
if ('request' !== $id) { 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 = ''; $code = '';
@ -1414,7 +1414,7 @@ EOF;
*/ */
public function addExpressionLanguageProvider(ExpressionFunctionProviderInterface $provider) 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; $this->expressionLanguageProviders[] = $provider;
} }

View File

@ -126,10 +126,11 @@ class XmlFileLoader extends FileLoader
* Parses an individual Definition. * Parses an individual Definition.
* *
* @param \DOMElement $service * @param \DOMElement $service
* @param string $file
* *
* @return Definition|null * @return Definition|null
*/ */
private function parseDefinition(\DOMElement $service) private function parseDefinition(\DOMElement $service, $file)
{ {
if ($alias = $service->getAttribute('alias')) { if ($alias = $service->getAttribute('alias')) {
$public = true; $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) { foreach (array('class', 'scope', 'public', 'factory-class', 'factory-method', 'factory-service', 'synthetic', 'lazy', 'abstract') as $key) {
if ($value = $service->getAttribute($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); $method = 'set'.str_replace('-', '', $key);
$definition->$method(XmlUtils::phpize($value)); $definition->$method(XmlUtils::phpize($value));
} }
} }
if ($value = $service->getAttribute('synchronized')) { 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')) { if ($files = $this->getChildren($service, 'file')) {
@ -173,7 +183,7 @@ class XmlFileLoader extends FileLoader
$factoryService = $this->getChildren($factory, 'service'); $factoryService = $this->getChildren($factory, 'service');
if (isset($factoryService[0])) { if (isset($factoryService[0])) {
$class = $this->parseDefinition($factoryService[0]); $class = $this->parseDefinition($factoryService[0], $file);
} elseif ($childService = $factory->getAttribute('service')) { } elseif ($childService = $factory->getAttribute('service')) {
$class = new Reference($childService, ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, false); $class = new Reference($childService, ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, false);
} else { } else {
@ -192,7 +202,7 @@ class XmlFileLoader extends FileLoader
$configuratorService = $this->getChildren($configurator, 'service'); $configuratorService = $this->getChildren($configurator, 'service');
if (isset($configuratorService[0])) { if (isset($configuratorService[0])) {
$class = $this->parseDefinition($configuratorService[0]); $class = $this->parseDefinition($configuratorService[0], $file);
} elseif ($childService = $configurator->getAttribute('service')) { } elseif ($childService = $configurator->getAttribute('service')) {
$class = new Reference($childService, ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, false); $class = new Reference($childService, ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, false);
} else { } 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 * @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 \DOMNode $node
* @param mixed $name * @param mixed $name

View File

@ -172,6 +172,7 @@ class YamlFileLoader extends FileLoader
} }
if (isset($service['synchronized'])) { 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); $definition->setSynchronized($service['synchronized'], 'request' !== $id);
} }
@ -201,14 +202,17 @@ class YamlFileLoader extends FileLoader
} }
if (isset($service['factory_class'])) { 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']); $definition->setFactoryClass($service['factory_class']);
} }
if (isset($service['factory_method'])) { 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']); $definition->setFactoryMethod($service['factory_method']);
} }
if (isset($service['factory_service'])) { 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']); $definition->setFactoryService($service['factory_service']);
} }

View File

@ -11,7 +11,7 @@
namespace Symfony\Component\DependencyInjection; 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\Config\Util\XmlUtils;
use Symfony\Component\ExpressionLanguage\Expression; 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')); $builder->register('foo3', 'Bar\FooClass')->setConfigurator(array(new Reference('baz'), 'configure'));
$this->assertTrue($builder->get('foo3')->configured, '->createService() calls the configurator'); $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 { try {
$builder->get('foo4'); $builder->get('foo5');
$this->fail('->createService() throws an InvalidArgumentException if the configure callable is not a valid callable'); $this->fail('->createService() throws an InvalidArgumentException if the configure callable is not a valid callable');
} catch (\InvalidArgumentException $e) { } 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'); $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> <services>
<service id="constructor" class="FooClass" factory-method="getInstance" /> <service id="constructor" class="FooClass" factory-method="getInstance" />
<service id="factory_service" factory-method="getInstance" factory-service="baz_factory" /> <service id="factory_service" factory-method="getInstance" factory-service="baz_factory" />
<service id="request" class="Request" synthetic="true" synchronized="true" lazy="true"/>
</services> </services>
</container> </container>

View File

@ -47,7 +47,6 @@
</service> </service>
<service id="alias_for_foo" alias="foo" /> <service id="alias_for_foo" alias="foo" />
<service id="another_alias_for_foo" alias="foo" public="false" /> <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" decorates="decorated" />
<service id="decorator_service_with_name" decorates="decorated" decoration-inner-name="decorated.pif-pouf"/> <service id="decorator_service_with_name" decorates="decorated" decoration-inner-name="decorated.pif-pouf"/>
<service id="new_factory1" class="FooBarClass"> <service id="new_factory1" class="FooBarClass">

View File

@ -1,3 +1,8 @@
services: services:
constructor: { class: FooClass, factory_method: getInstance } constructor: { class: FooClass, factory_method: getInstance }
factory_service: { class: BazClass, factory_method: getInstance, factory_service: baz_factory } 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: another_alias_for_foo:
alias: foo alias: foo
public: false public: false
request:
class: Request
synthetic: true
synchronized: true
lazy: true
decorator_service: decorator_service:
decorates: decorated decorates: decorated
decorator_service_with_name: decorator_service_with_name:

View File

@ -206,6 +206,10 @@ class XmlFileLoaderTest extends \PHPUnit_Framework_TestCase
$this->assertNull($services['factory_service']->getClass()); $this->assertNull($services['factory_service']->getClass());
$this->assertEquals('baz_factory', $services['factory_service']->getFactoryService()); $this->assertEquals('baz_factory', $services['factory_service']->getFactoryService());
$this->assertEquals('getInstance', $services['factory_service']->getFactoryMethod()); $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() 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(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->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(); $aliases = $container->getAliases();
$this->assertTrue(isset($aliases['alias_for_foo']), '->load() parses <service> elements'); $this->assertTrue(isset($aliases['alias_for_foo']), '->load() parses <service> elements');
$this->assertEquals('foo', (string) $aliases['alias_for_foo'], '->load() parses aliases'); $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->assertEquals('foo', (string) $aliases['another_alias_for_foo']);
$this->assertFalse($aliases['another_alias_for_foo']->isPublic()); $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', null), $services['decorator_service']->getDecoratedService());
$this->assertEquals(array('decorated', 'decorated.pif-pouf'), $services['decorator_service_with_name']->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('BazClass', $services['factory_service']->getClass());
$this->assertEquals('baz_factory', $services['factory_service']->getFactoryService()); $this->assertEquals('baz_factory', $services['factory_service']->getFactoryService());
$this->assertEquals('getInstance', $services['factory_service']->getFactoryMethod()); $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() 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(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->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(); $aliases = $container->getAliases();
$this->assertTrue(isset($aliases['alias_for_foo']), '->load() parses aliases'); $this->assertTrue(isset($aliases['alias_for_foo']), '->load() parses aliases');
$this->assertEquals('foo', (string) $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->assertEquals('foo', (string) $aliases['another_alias_for_foo']);
$this->assertFalse($aliases['another_alias_for_foo']->isPublic()); $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', null), $services['decorator_service']->getDecoratedService());
$this->assertEquals(array('decorated', 'decorated.pif-pouf'), $services['decorator_service_with_name']->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() 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; return $this->dispatcher;
} }
@ -113,7 +113,7 @@ class Event
*/ */
public function getName() 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; 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) public function getContent($asResource = false)
{ {
if (false === $this->content || (true === $asResource && null !== $this->content)) { 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.'); throw new \LogicException('getContent() can only be called once when using the resource return type and PHP below 5.6.');
} }
if (true === $asResource) { if (true === $asResource) {

View File

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

View File

@ -175,7 +175,7 @@ class FlashBag implements FlashBagInterface, \IteratorAggregate
*/ */
public function getIterator() 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()); return new \ArrayIterator($this->all());
} }

View File

@ -11,7 +11,7 @@
namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; 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. * 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'); $file = new FakeFile($realpath, __DIR__.'/File/Fixtures/test');
BinaryFileResponse::trustXSendFileTypeHeader(); BinaryFileResponse::trustXSendfileTypeHeader();
$response = new BinaryFileResponse($file); $response = new BinaryFileResponse($file);
$reflection = new \ReflectionObject($response); $reflection = new \ReflectionObject($response);
$property = $reflection->getProperty('file'); $property = $reflection->getProperty('file');

View File

@ -975,11 +975,40 @@ class RequestTest extends \PHPUnit_Framework_TestCase
*/ */
public function testGetContentCantBeCalledTwiceWithResources($first, $second) 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 = new Request();
$req->getContent($first); $req->getContent($first);
$req->getContent($second); $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() public function getContentCantBeCalledTwiceWithResourcesProvider()
{ {
return array( 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( $this->data['controller'] = array(
'class' => is_object($controller[0]) ? get_class($controller[0]) : $controller[0], 'class' => is_object($controller[0]) ? get_class($controller[0]) : $controller[0],
'method' => $controller[1], 'method' => $controller[1],
'file' => $r->getFilename(), 'file' => $r->getFileName(),
'line' => $r->getStartLine(), 'line' => $r->getStartLine(),
); );
} catch (\ReflectionException $re) { } catch (\ReflectionException $re) {
@ -148,7 +148,7 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
$this->data['controller'] = array( $this->data['controller'] = array(
'class' => $r->getName(), 'class' => $r->getName(),
'method' => null, 'method' => null,
'file' => $r->getFilename(), 'file' => $r->getFileName(),
'line' => $r->getStartLine(), 'line' => $r->getStartLine(),
); );
} elseif (is_object($controller)) { } elseif (is_object($controller)) {

View File

@ -11,7 +11,7 @@
namespace Symfony\Component\HttpKernel\Debug; 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; use Symfony\Component\Debug\ErrorHandler as DebugErrorHandler;

View File

@ -11,7 +11,7 @@
namespace Symfony\Component\HttpKernel\Debug; 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; use Symfony\Component\Debug\ExceptionHandler as DebugExceptionHandler;

View File

@ -38,7 +38,7 @@ class TraceableEventDispatcher extends BaseTraceableEventDispatcher
*/ */
public function setProfiler(Profiler $profiler = null) 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); parent::__construct($dispatcher, $controllerResolver, $requestStack);
if ($triggerDeprecation) { 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; $this->container = $container;

View File

@ -60,7 +60,7 @@ class FragmentRendererPass implements CompilerPassInterface
foreach ($tags as $tag) { foreach ($tags as $tag) {
if (!isset($tag['alias'])) { 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 // register the handler as a non-lazy-loaded one
$definition->addMethodCall('addRenderer', array(new Reference($id))); $definition->addMethodCall('addRenderer', array(new Reference($id)));

View File

@ -11,7 +11,7 @@
namespace Symfony\Component\HttpKernel\DependencyInjection; 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; use Symfony\Component\EventDispatcher\DependencyInjection\RegisterListenersPass as BaseRegisterListenersPass;

View File

@ -11,7 +11,7 @@
namespace Symfony\Component\HttpKernel\EventListener; 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 Psr\Log\LoggerInterface;
use Symfony\Component\Debug\ErrorHandler; use Symfony\Component\Debug\ErrorHandler;

View File

@ -11,7 +11,7 @@
namespace Symfony\Component\HttpKernel\EventListener; 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. * 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() 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'); 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) 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) { if (null === $request) {
return; return;

View File

@ -53,7 +53,7 @@ class ProfilerListener implements EventSubscriberInterface
// Prevent the deprecation notice to be triggered all the time. // Prevent the deprecation notice to be triggered all the time.
// The onKernelRequest() method fires some logic only when the // The onKernelRequest() method fires some logic only when the
// RequestStack instance is not provided as a dependency. // 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; $this->profiler = $profiler;

View File

@ -68,7 +68,7 @@ class RouterListener implements EventSubscriberInterface
} }
if (!$requestStack instanceof RequestStack) { 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; $this->matcher = $matcher;
@ -90,7 +90,7 @@ class RouterListener implements EventSubscriberInterface
*/ */
public function setRequest(Request $request = null) 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); $this->setCurrentRequest($request);
} }

View File

@ -11,7 +11,7 @@
namespace Symfony\Component\HttpKernel\Exception; 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. * Fatal Error Exception.

View File

@ -11,7 +11,7 @@
namespace Symfony\Component\HttpKernel\Exception; 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. * 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) 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; $this->request = $request;
} }

View File

@ -87,7 +87,7 @@ class Esi implements SurrogateInterface
*/ */
public function hasSurrogateEsiCapability(Request $request) 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); return $this->hasSurrogateCapability($request);
} }
@ -114,7 +114,7 @@ class Esi implements SurrogateInterface
*/ */
public function addSurrogateEsiCapability(Request $request) 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); $this->addSurrogateCapability($request);
} }
@ -160,7 +160,7 @@ class Esi implements SurrogateInterface
*/ */
public function needsEsiParsing(Response $response) 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); return $this->needsParsing($response);
} }

View File

@ -15,7 +15,7 @@
namespace Symfony\Component\HttpKernel\HttpCache; 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 * EsiResponseCacheStrategy knows how to compute the Response cache HTTP header

View File

@ -15,7 +15,7 @@
namespace Symfony\Component\HttpKernel\HttpCache; 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 * ResponseCacheStrategyInterface implementations know how to compute the

View File

@ -174,7 +174,7 @@ class HttpCache implements HttpKernelInterface, TerminableInterface
*/ */
public function getEsi() 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) { 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'); 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 // 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. // has a different private valid entry which is not cached here.
$cachedEtags = $entry->getEtag() ? array($entry->getEtag()) : array(); $cachedEtags = $entry->getEtag() ? array($entry->getEtag()) : array();
$requestEtags = $request->getEtags(); $requestEtags = $request->getETags();
if ($etags = array_unique(array_merge($cachedEtags, $requestEtags))) { if ($etags = array_unique(array_merge($cachedEtags, $requestEtags))) {
$subRequest->headers->set('if_none_match', implode(', ', $etags)); $subRequest->headers->set('if_none_match', implode(', ', $etags));
} }

View File

@ -60,11 +60,11 @@ abstract class Kernel implements KernelInterface, TerminableInterface
protected $startTime; protected $startTime;
protected $loadClassCache; protected $loadClassCache;
const VERSION = '2.7.0'; const VERSION = '2.7.1';
const VERSION_ID = '20700'; const VERSION_ID = '20701';
const MAJOR_VERSION = '2'; const MAJOR_VERSION = '2';
const MINOR_VERSION = '7'; const MINOR_VERSION = '7';
const RELEASE_VERSION = '0'; const RELEASE_VERSION = '1';
const EXTRA_VERSION = ''; const EXTRA_VERSION = '';
const END_OF_MAINTENANCE = '05/2018'; const END_OF_MAINTENANCE = '05/2018';
@ -93,7 +93,7 @@ abstract class Kernel implements KernelInterface, TerminableInterface
$defClass = $defClass->getDeclaringClass()->name; $defClass = $defClass->getDeclaringClass()->name;
if (__CLASS__ !== $defClass) { 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(); $this->init();
} }
} }
@ -103,7 +103,7 @@ abstract class Kernel implements KernelInterface, TerminableInterface
*/ */
public function init() 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() public function __clone()
@ -225,7 +225,7 @@ abstract class Kernel implements KernelInterface, TerminableInterface
*/ */
public function isClassInActiveBundle($class) 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) { foreach ($this->getBundles() as $bundle) {
if (0 === strpos($class, $bundle->getNamespace())) { if (0 === strpos($class, $bundle->getNamespace())) {

View File

@ -11,7 +11,7 @@
namespace Symfony\Component\HttpKernel\Log; 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; use Psr\Log\NullLogger as PsrNullLogger;
@ -29,7 +29,7 @@ class NullLogger extends PsrNullLogger implements LoggerInterface
*/ */
public function emerg($message, array $context = array()) 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()) 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()) 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()) 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]; $port = $matches[3];
$memcache = new \Memcache(); $memcache = new \Memcache();
$memcache->addServer($host, $port); $memcache->addserver($host, $port);
$this->memcache = $memcache; $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 else clause because we don't know it
if (extension_loaded('xdebug')) { if (extension_loaded('xdebug')) {
$this->assertTrue($c->hasXdebug()); $this->assertTrue($c->hasXDebug());
} else { } else {
$this->assertFalse($c->hasXdebug()); $this->assertFalse($c->hasXDebug());
} }
// if else clause because we don't know it // 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() 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(); return $this->getInput();
} }
@ -1099,7 +1099,7 @@ class Process
*/ */
public function setStdin($stdin) 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); return $this->setInput($stdin);
} }

View File

@ -97,7 +97,7 @@ class ProcessUtils
} }
// deprecated as of Symfony 2.5, to be removed in 3.0 // deprecated as of Symfony 2.5, to be removed in 3.0
if (is_object($input) && method_exists($input, '__toString')) { 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; return (string) $input;
} }

View File

@ -91,7 +91,7 @@ class PhpExecutableFinderTest extends \PHPUnit_Framework_TestCase
//TODO maybe php executable is custom or even Windows //TODO maybe php executable is custom or even Windows
if ('\\' === DIRECTORY_SEPARATOR) { if ('\\' === DIRECTORY_SEPARATOR) {
$this->assertTrue(is_executable($current)); $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