Skip to content

Commit ab7b2e2

Browse files
committed
Merge branch '2.3' into 2.5
* 2.3: [Doc] Use Markdown syntax highlighting [Finder] tweaked docs [Finder] Add info about possibilities offered by SplFileInfo fix components tests [Intl] FIxed failing test [Intl] Generated the data for ICU version 54-rc [EventDispatcher] fix doc bloc on EventDispatcherInterface [Validator] Update validators.zh_CN.xlf, fix translation error bumped Symfony version to 2.3.21 updated VERSION for 2.3.20 update CONTRIBUTORS for 2.3.20 updated CHANGELOG for 2.3.20 [Intl] Integrated ICU data into Intl component Conflicts: src/Symfony/Component/HttpKernel/Kernel.php src/Symfony/Component/Intl/ResourceBundle/LocaleBundle.php
2 parents 428fe9e + 17bb005 commit ab7b2e2

File tree

2 files changed

+49
-36
lines changed

2 files changed

+49
-36
lines changed

README.md

Lines changed: 45 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,19 @@ frameworks.
77
``HttpKernelInterface`` is the core interface of the Symfony2 full-stack
88
framework:
99

10-
interface HttpKernelInterface
11-
{
12-
/**
13-
* Handles a Request to convert it to a Response.
14-
*
15-
* @param Request $request A Request instance
16-
*
17-
* @return Response A Response instance
18-
*/
19-
function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true);
20-
}
10+
```php
11+
interface HttpKernelInterface
12+
{
13+
/**
14+
* Handles a Request to convert it to a Response.
15+
*
16+
* @param Request $request A Request instance
17+
*
18+
* @return Response A Response instance
19+
*/
20+
function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true);
21+
}
22+
```
2123

2224
It takes a ``Request`` as an input and should return a ``Response`` as an
2325
output. Using this interface makes your code compatible with all frameworks
@@ -27,53 +29,61 @@ free.
2729
Creating a framework based on the Symfony2 components is really easy. Here is
2830
a very simple, but fully-featured framework based on the Symfony2 components:
2931

30-
$routes = new RouteCollection();
31-
$routes->add('hello', new Route('/hello', array('_controller' =>
32-
function (Request $request) {
33-
return new Response(sprintf("Hello %s", $request->get('name')));
34-
}
35-
)));
32+
```php
33+
$routes = new RouteCollection();
34+
$routes->add('hello', new Route('/hello', array('_controller' =>
35+
function (Request $request) {
36+
return new Response(sprintf("Hello %s", $request->get('name')));
37+
}
38+
)));
3639

37-
$request = Request::createFromGlobals();
40+
$request = Request::createFromGlobals();
3841

39-
$context = new RequestContext();
40-
$context->fromRequest($request);
42+
$context = new RequestContext();
43+
$context->fromRequest($request);
4144

42-
$matcher = new UrlMatcher($routes, $context);
45+
$matcher = new UrlMatcher($routes, $context);
4346

44-
$dispatcher = new EventDispatcher();
45-
$dispatcher->addSubscriber(new RouterListener($matcher));
47+
$dispatcher = new EventDispatcher();
48+
$dispatcher->addSubscriber(new RouterListener($matcher));
4649

47-
$resolver = new ControllerResolver();
50+
$resolver = new ControllerResolver();
4851

49-
$kernel = new HttpKernel($dispatcher, $resolver);
52+
$kernel = new HttpKernel($dispatcher, $resolver);
5053

51-
$kernel->handle($request)->send();
54+
$kernel->handle($request)->send();
55+
```
5256

5357
This is all you need to create a flexible framework with the Symfony2
5458
components.
5559

5660
Want to add an HTTP reverse proxy and benefit from HTTP caching and Edge Side
5761
Includes?
5862

59-
$kernel = new HttpKernel($dispatcher, $resolver);
63+
```php
64+
$kernel = new HttpKernel($dispatcher, $resolver);
6065

61-
$kernel = new HttpCache($kernel, new Store(__DIR__.'/cache'));
66+
$kernel = new HttpCache($kernel, new Store(__DIR__.'/cache'));
67+
```
6268

6369
Want to functional test this small framework?
6470

65-
$client = new Client($kernel);
66-
$crawler = $client->request('GET', '/hello/Fabien');
71+
```php
72+
$client = new Client($kernel);
73+
$crawler = $client->request('GET', '/hello/Fabien');
6774

68-
$this->assertEquals('Fabien', $crawler->filter('p > span')->text());
75+
$this->assertEquals('Fabien', $crawler->filter('p > span')->text());
76+
```
6977

7078
Want nice error pages instead of ugly PHP exceptions?
7179

72-
$dispatcher->addSubscriber(new ExceptionListener(function (Request $request) {
73-
$msg = 'Something went wrong! ('.$request->get('exception')->getMessage().')';
80+
```php
81+
$dispatcher->addSubscriber(new ExceptionListener(function (Request $request) {
82+
$msg = 'Something went wrong! ('.$request->get('exception')->getMessage().')';
7483

75-
return new Response($msg, 500);
76-
}));
84+
return new Response($msg, 500);
85+
}));
86+
```
7787

7888
And that's why the simple looking ``HttpKernelInterface`` is so powerful. It
7989
gives you access to a lot of cool features, ready to be used out of the box,

Tests/DependencyInjection/MergeExtensionConfigurationPassTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ class MergeExtensionConfigurationPassTest extends \PHPUnit_Framework_TestCase
1717
{
1818
public function testAutoloadMainExtension()
1919
{
20-
$container = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerBuilder');
20+
$container = $this->getMock(
21+
'Symfony\\Component\\DependencyInjection\\ContainerBuilder',
22+
array('getExtensionConfig', 'loadFromExtension', 'getParameterBag')
23+
);
2124
$params = $this->getMock('Symfony\\Component\\DependencyInjection\\ParameterBag\\ParameterBag');
2225

2326
$container->expects($this->at(0))

0 commit comments

Comments
 (0)