From 2094e1604f159742e9ee8e6d711e62f00512b86b Mon Sep 17 00:00:00 2001 From: WouterJ Date: Thu, 7 Feb 2013 23:08:40 +0100 Subject: [PATCH] Fixed spacing issues in PHP arrays --- book/controller.rst | 2 +- book/forms.rst | 21 +++++--- book/http_cache.rst | 4 +- book/internals.rst | 4 +- book/page_creation.rst | 7 ++- book/routing.rst | 16 +++--- book/security.rst | 45 +++++++++-------- book/service_container.rst | 22 ++++---- book/templating.rst | 5 +- book/testing.rst | 8 +-- book/translation.rst | 2 +- book/validation.rst | 8 +-- .../dependency_injection/compilation.rst | 2 +- components/http_foundation/introduction.rst | 2 +- components/http_kernel/introduction.rst | 13 ++--- components/routing/introduction.rst | 6 +-- components/security/authentication.rst | 4 +- components/yaml/introduction.rst | 2 +- cookbook/assetic/apply_to_option.rst | 28 +++++++---- cookbook/assetic/asset_management.rst | 26 ++++++---- cookbook/assetic/jpeg_optimize.rst | 5 +- cookbook/assetic/yuicompressor.rst | 9 ++-- cookbook/bundles/extension.rst | 10 ++-- .../configuration/external_parameters.rst | 12 +++-- .../configuration/pdo_session_storage.rst | 2 +- cookbook/doctrine/registration_form.rst | 4 +- cookbook/email/spool.rst | 2 +- .../event_dispatcher/before_after_filters.rst | 15 ++++-- cookbook/form/create_custom_field_type.rst | 2 +- cookbook/form/form_collections.rst | 8 +-- cookbook/form/form_customization.rst | 50 ++++++++++++------- cookbook/profiler/data_collector.rst | 5 +- cookbook/request/mime_type.rst | 5 +- .../custom_authentication_provider.rst | 4 +- cookbook/security/force_https.rst | 14 +++--- cookbook/security/form_login.rst | 44 ++++++++++------ cookbook/security/remember_me.rst | 14 +++--- cookbook/symfony1.rst | 5 +- cookbook/templating/PHP.rst | 12 +++-- reference/configuration/framework.rst | 4 +- 40 files changed, 270 insertions(+), 183 deletions(-) diff --git a/book/controller.rst b/book/controller.rst index a434b3c5027..cc4c1943908 100644 --- a/book/controller.rst +++ b/book/controller.rst @@ -437,7 +437,7 @@ object that's returned from that controller:: { $response = $this->forward('AcmeHelloBundle:Hello:fancy', array( 'name' => $name, - 'color' => 'green' + 'color' => 'green', )); // ... further modify the response or return it directly diff --git a/book/forms.rst b/book/forms.rst index b06e55e054b..6eb7c18807a 100644 --- a/book/forms.rst +++ b/book/forms.rst @@ -390,7 +390,7 @@ method:: public function getDefaultOptions(array $options) { return array( - 'validation_groups' => array('registration') + 'validation_groups' => array('registration'), ); } @@ -1222,9 +1222,11 @@ file: // app/config/config.php $container->loadFromExtension('twig', array( - 'form' => array('resources' => array( - 'AcmeTaskBundle:Form:fields.html.twig', - )) + 'form' => array( + 'resources' => array( + 'AcmeTaskBundle:Form:fields.html.twig', + ), + ), // ... )); @@ -1301,10 +1303,13 @@ file: // app/config/config.php $container->loadFromExtension('framework', array( - 'templating' => array('form' => - array('resources' => array( - 'AcmeTaskBundle:Form', - ))) + 'templating' => array( + 'form' => array( + 'resources' => array( + 'AcmeTaskBundle:Form', + ), + ), + ) // ... )); diff --git a/book/http_cache.rst b/book/http_cache.rst index 161be0975d8..1859d19703b 100644 --- a/book/http_cache.rst +++ b/book/http_cache.rst @@ -851,7 +851,7 @@ First, to use ESI, be sure to enable it in your application configuration: // app/config/config.php $container->loadFromExtension('framework', array( - // ... + ..., 'esi' => array('enabled' => true), )); @@ -890,7 +890,7 @@ matter), Symfony2 uses the standard ``render`` helper to configure ESI tags: $view['router']->generate('latest_news', array('max' => 5), true), array(), array('standalone' => true) - ) ?> + ); ?> .. include:: /book/_security-2012-6431.rst.inc diff --git a/book/internals.rst b/book/internals.rst index fba3d0143b5..031f5853e85 100644 --- a/book/internals.rst +++ b/book/internals.rst @@ -539,9 +539,9 @@ the configuration for the development environment: // enable the web profiler $container->loadFromExtension('web_profiler', array( - 'toolbar' => true, + 'toolbar' => true, 'intercept-redirects' => true, - 'verbose' => true, + 'verbose' => true, )); When ``only-exceptions`` is set to ``true``, the profiler only collects data diff --git a/book/page_creation.rst b/book/page_creation.rst index 14566a5fdc6..ac68949432d 100644 --- a/book/page_creation.rst +++ b/book/page_creation.rst @@ -77,7 +77,7 @@ the bundle is registered with the kernel:: public function registerBundles() { $bundles = array( - // ... + ..., new Acme\HelloBundle\AcmeHelloBundle(), ); // ... @@ -653,8 +653,7 @@ Now that you've created the bundle, enable it via the ``AppKernel`` class:: public function registerBundles() { $bundles = array( - // ... - + ..., // register your bundles new Acme\TestBundle\AcmeTestBundle(), ); @@ -792,7 +791,7 @@ format you prefer: 'csrf-protection' => array(), 'validation' => array('annotations' => true), 'templating' => array( - 'engines' => array('twig'), + 'engines' => array('twig'), #'assets_version' => "SomeVersionScheme", ), 'session' => array( diff --git a/book/routing.rst b/book/routing.rst index 7c5d0428795..3b00c335310 100644 --- a/book/routing.rst +++ b/book/routing.rst @@ -171,7 +171,7 @@ file: // app/config/config.php $container->loadFromExtension('framework', array( // ... - 'router' => array('resource' => '%kernel.root_dir%/config/routing.php'), + 'router' => array('resource' => '%kernel.root_dir%/config/routing.php'), )); .. tip:: @@ -397,7 +397,7 @@ This is done by including it in the ``defaults`` collection: $collection = new RouteCollection(); $collection->add('blog', new Route('/blog/{page}', array( '_controller' => 'AcmeBlogBundle:Blog:index', - 'page' => 1, + 'page' => 1, ))); return $collection; @@ -466,7 +466,7 @@ Take a quick look at the routes that have been created so far: $collection = new RouteCollection(); $collection->add('blog', new Route('/blog/{page}', array( '_controller' => 'AcmeBlogBundle:Blog:index', - 'page' => 1, + 'page' => 1, ))); $collection->add('blog_show', new Route('/blog/{show}', array( @@ -528,7 +528,7 @@ requirements can easily be added for each parameter. For example: $collection = new RouteCollection(); $collection->add('blog', new Route('/blog/{page}', array( '_controller' => 'AcmeBlogBundle:Blog:index', - 'page' => 1, + 'page' => 1, ), array( 'page' => '\d+', ))); @@ -598,7 +598,7 @@ URL: $collection = new RouteCollection(); $collection->add('homepage', new Route('/{culture}', array( '_controller' => 'AcmeDemoBundle:Main:homepage', - 'culture' => 'en', + 'culture' => 'en', ), array( 'culture' => 'en|fr', ))); @@ -747,11 +747,11 @@ routing system can be: $collection = new RouteCollection(); $collection->add('homepage', new Route('/articles/{culture}/{year}/{title}.{_format}', array( '_controller' => 'AcmeDemoBundle:Article:show', - '_format' => 'html', + '_format' => 'html', ), array( 'culture' => 'en|fr', '_format' => 'html|rss', - 'year' => '\d+', + 'year' => '\d+', ))); return $collection; @@ -1069,7 +1069,7 @@ system. Take the ``blog_show`` example route from earlier:: $params = $router->match('/blog/my-blog-post'); // array( - // 'slug' => 'my-blog-post', + // 'slug' => 'my-blog-post', // '_controller' => 'AcmeBlogBundle:Blog:show', // ) diff --git a/book/security.rst b/book/security.rst index 51b01cceb77..2ac95b76ce4 100644 --- a/book/security.rst +++ b/book/security.rst @@ -98,10 +98,10 @@ authentication (i.e. the old-school username/password box): $container->loadFromExtension('security', array( 'firewalls' => array( 'secured_area' => array( - 'pattern' => '^/', - 'anonymous' => array(), + 'pattern' => '^/', + 'anonymous' => array(), 'http_basic' => array( - 'realm' => 'Secured Demo Area', + 'realm' => 'Secured Demo Area', ), ), ), @@ -111,8 +111,8 @@ authentication (i.e. the old-school username/password box): 'providers' => array( 'in_memory' => array( 'users' => array( - 'ryan' => array('password' => 'ryanpass', 'roles' => 'ROLE_USER'), - 'admin' => array('password' => 'kitten', 'roles' => 'ROLE_ADMIN'), + 'ryan' => array('password' => 'ryanpass', 'roles' => 'ROLE_USER'), + 'admin' => array('password' => 'kitten', 'roles' => 'ROLE_ADMIN'), ), ), ), @@ -319,8 +319,8 @@ First, enable form login under your firewall: $container->loadFromExtension('security', array( 'firewalls' => array( 'secured_area' => array( - 'pattern' => '^/', - 'anonymous' => array(), + 'pattern' => '^/', + 'anonymous' => array(), 'form_login' => array( 'login_path' => '/login', 'check_path' => '/login_check', @@ -634,11 +634,11 @@ see :doc:`/cookbook/security/form_login`. 'firewalls' => array( 'login_firewall' => array( - 'pattern' => '^/login$', + 'pattern' => '^/login$', 'anonymous' => array(), ), 'secured_area' => array( - 'pattern' => '^/', + 'pattern' => '^/', 'form_login' => array(), ), ), @@ -719,7 +719,7 @@ You can define as many URL patterns as you need - each is a regular expression. // app/config/security.php $container->loadFromExtension('security', array( - // ... + ..., 'access_control' => array( array('path' => '^/admin/users', 'role' => 'ROLE_SUPER_ADMIN'), array('path' => '^/admin', 'role' => 'ROLE_ADMIN'), @@ -1068,12 +1068,12 @@ In fact, you've seen this already in the example in this chapter. // app/config/security.php $container->loadFromExtension('security', array( - // ... + ..., 'providers' => array( 'default_provider' => array( 'users' => array( - 'ryan' => array('password' => 'ryanpass', 'roles' => 'ROLE_USER'), - 'admin' => array('password' => 'kitten', 'roles' => 'ROLE_ADMIN'), + 'ryan' => array('password' => 'ryanpass', 'roles' => 'ROLE_USER'), + 'admin' => array('password' => 'kitten', 'roles' => 'ROLE_ADMIN'), ), ), ), @@ -1249,7 +1249,7 @@ do the following: 'providers' => array( 'in_memory' => array( 'users' => array( - 'ryan' => array('password' => 'bb87a29949f3a1ee0559f8a57357487151281386', 'roles' => 'ROLE_USER'), + 'ryan' => array('password' => 'bb87a29949f3a1ee0559f8a57357487151281386', 'roles' => 'ROLE_USER'), 'admin' => array('password' => '74913f5cd5f61ec0bcfdb775414c2fb3d161b620', 'roles' => 'ROLE_ADMIN'), ), ), @@ -1298,8 +1298,7 @@ configure the encoder for that user: // app/config/security.php $container->loadFromExtension('security', array( - // ... - + ..., 'encoders' => array( 'Acme\UserBundle\Entity\User' => 'sha512', ), @@ -1499,10 +1498,10 @@ the first provider is always used: $container->loadFromExtension('security', array( 'firewalls' => array( 'secured_area' => array( - // ... + ..., 'provider' => 'user_db', 'http_basic' => array( - // ... + ..., 'provider' => 'in_memory', ), 'form_login' => array(), @@ -1613,7 +1612,7 @@ the firewall can handle this automatically for you when you activate the $container->loadFromExtension('security', array( 'firewalls' => array( 'secured_area' => array( - // ... + ..., 'logout' => array('path' => 'logout', 'target' => '/'), ), ), @@ -1768,7 +1767,7 @@ done by activating the ``switch_user`` firewall listener: $container->loadFromExtension('security', array( 'firewalls' => array( 'main'=> array( - // ... + ..., 'switch_user' => true ), ), @@ -1802,7 +1801,11 @@ to show a link to exit impersonation: .. code-block:: html+php isGranted('ROLE_PREVIOUS_ADMIN')): ?> - Exit impersonation + + Exit impersonation + Of course, this feature needs to be made available to a small group of users. diff --git a/book/service_container.rst b/book/service_container.rst index a563c2c36b0..917eb0264e0 100644 --- a/book/service_container.rst +++ b/book/service_container.rst @@ -300,10 +300,10 @@ arrays. use Symfony\Component\DependencyInjection\Definition; $container->setParameter('my_mailer.gateways', array('mail1', 'mail2', 'mail3')); - $container->setParameter('my_multilang.language_fallback', - array('en' => array('en', 'fr'), - 'fr' => array('fr', 'en'), - )); + $container->setParameter('my_multilang.language_fallback', array( + 'en' => array('en', 'fr'), + 'fr' => array('fr', 'en'), + )); Importing other Container Configuration Resources @@ -727,7 +727,7 @@ Injecting the dependency by the setter method just needs a change of syntax: $container->setDefinition('newsletter_manager', new Definition( '%newsletter_manager.class%' ))->addMethodCall('setMailer', array( - new Reference('my_mailer') + new Reference('my_mailer'), )); .. note:: @@ -788,10 +788,12 @@ it exists and do nothing if it doesn't: $container->setDefinition('my_mailer', ...); $container->setDefinition('newsletter_manager', new Definition( '%newsletter_manager.class%', - array(new Reference( - 'my_mailer', - ContainerInterface::IGNORE_ON_INVALID_REFERENCE - )) + array( + new Reference( + 'my_mailer', + ContainerInterface::IGNORE_ON_INVALID_REFERENCE + ) + ) )); In YAML, the special ``@?`` syntax tells the service container that the dependency @@ -875,7 +877,7 @@ Configuring the service container is easy: '%newsletter_manager.class%', array( new Reference('mailer'), - new Reference('templating') + new Reference('templating'), ) )); diff --git a/book/templating.rst b/book/templating.rst index 0d0fc4e8890..d794ed02f58 100644 --- a/book/templating.rst +++ b/book/templating.rst @@ -547,7 +547,10 @@ Including this template from any other template is simple:

Recent Articles

- render('AcmeArticleBundle:Article:articleDetails.html.php', array('article' => $article)) ?> + render( + 'AcmeArticleBundle:Article:articleDetails.html.php', + array('article' => $article) + ) ?> stop() ?> diff --git a/book/testing.rst b/book/testing.rst index 9e885daed13..c0dfececbef 100644 --- a/book/testing.rst +++ b/book/testing.rst @@ -354,10 +354,10 @@ or perform more complex requests:: // or $photo = array( 'tmp_name' => '/path/to/photo.jpg', - 'name' => 'photo.jpg', - 'type' => 'image/jpeg', - 'size' => 123, - 'error' => UPLOAD_ERR_OK + 'name' => 'photo.jpg', + 'type' => 'image/jpeg', + 'size' => 123, + 'error' => UPLOAD_ERR_OK ); $client->request( 'POST', diff --git a/book/translation.rst b/book/translation.rst index 16661bead5a..4db3f72af13 100644 --- a/book/translation.rst +++ b/book/translation.rst @@ -422,7 +422,7 @@ Symfony2 will discover these files and use them when translating either return array( 'symfony2' => array( 'is' => array( - 'great' => 'Symfony2 is great', + 'great' => 'Symfony2 is great', 'amazing' => 'Symfony2 is amazing', ), 'has' => array( diff --git a/book/validation.rst b/book/validation.rst index 4816e716bb0..8848ab8aaf7 100644 --- a/book/validation.rst +++ b/book/validation.rst @@ -272,9 +272,11 @@ annotations if you're using the annotation method to specify your constraints: .. code-block:: php // app/config/config.php - $container->loadFromExtension('framework', array('validation' => array( - 'enable_annotations' => true, - ))); + $container->loadFromExtension('framework', array( + 'validation' => array( + 'enable_annotations' => true, + ), + )); .. index:: single: Validation; Constraints diff --git a/components/dependency_injection/compilation.rst b/components/dependency_injection/compilation.rst index d0d9a6cd48e..8a97be2b8bc 100644 --- a/components/dependency_injection/compilation.rst +++ b/components/dependency_injection/compilation.rst @@ -144,7 +144,7 @@ like this:: array( 'foo' => 'fooValue', 'bar' => 'barValue', - ) + ), ) Whilst you can manually manage merging the different files, it is much better diff --git a/components/http_foundation/introduction.rst b/components/http_foundation/introduction.rst index 910f216f521..94e2a9d35e8 100644 --- a/components/http_foundation/introduction.rst +++ b/components/http_foundation/introduction.rst @@ -376,7 +376,7 @@ right content and headers. A JSON response might look like this:: $response = new Response(); $response->setContent(json_encode(array( - 'data' => 123 + 'data' => 123, ))); $response->headers->set('Content-Type', 'application/json'); diff --git a/components/http_kernel/introduction.rst b/components/http_kernel/introduction.rst index fda5055c469..d3100265fbd 100644 --- a/components/http_kernel/introduction.rst +++ b/components/http_kernel/introduction.rst @@ -562,11 +562,12 @@ a built-in ControllerResolver that can be used to create a working example:: use Symfony\Component\Routing\RequestContext; $routes = new RouteCollection(); - $routes->add('hello', new Route('/hello/{name}', array('_controller' => - function (Request $request) { - return new Response(sprintf("Hello %s", $request->get('name'))); - } - ))); + $routes->add('hello', new Route('/hello/{name}', array( + '_controller' => function (Request $request) { + return new Response(sprintf("Hello %s", $request->get('name'))); + } + ), + )); $request = Request::createFromGlobals(); @@ -635,4 +636,4 @@ look like this:: .. _Packagist: https://packagist.org/packages/symfony/http-kernel .. _reflection: http://php.net/manual/en/book.reflection.php .. _FOSRestBundle: https://github.com/friendsofsymfony/FOSRestBundle -.. _`Create your own framework... on top of the Symfony2 Components`: http://fabien.potencier.org/article/50/create-your-own-framework-on-top-of-the-symfony2-components-part-1 \ No newline at end of file +.. _`Create your own framework... on top of the Symfony2 Components`: http://fabien.potencier.org/article/50/create-your-own-framework-on-top-of-the-symfony2-components-part-1 diff --git a/components/routing/introduction.rst b/components/routing/introduction.rst index 2dc15adb15f..539061f62b1 100644 --- a/components/routing/introduction.rst +++ b/components/routing/introduction.rst @@ -99,8 +99,8 @@ Take the following route, which combines several of these ideas:: $parameters = $matcher->match('/archive/2012-01'); // array( // 'controller' => 'showArchive', - // 'month' => '2012-01', - // '_route' => ... + // 'month' => '2012-01', + // '_route' => ... // ) $parameters = $matcher->match('/archive/foo'); @@ -203,7 +203,7 @@ a certain route:: $generator = new UrlGenerator($routes, $context); $url = $generator->generate('show_post', array( - 'slug' => 'my-blog-post' + 'slug' => 'my-blog-post', )); // /show/my-blog-post diff --git a/components/security/authentication.rst b/components/security/authentication.rst index 626311fe55a..48154ebb5c5 100644 --- a/components/security/authentication.rst +++ b/components/security/authentication.rst @@ -134,7 +134,7 @@ password was valid:: 'admin' => array( // password is "foo" 'password' => '5FZ2Z8QIkA7UTZ4BYkoC+GsReLf569mSKDsfods6LYQ8t+a8EW9oaircfMpmaLbPBh4FOBiiFyLfuZmTSUwzZg==', - 'roles' => array('ROLE_ADMIN'), + 'roles' => array('ROLE_ADMIN'), ), ) ); @@ -179,7 +179,7 @@ receives an array of encoders:: $encoders = array( 'Symfony\\Component\\Security\\Core\\User\\User' => $defaultEncoder, - 'Acme\\Entity\\LegacyUser' => $weakEncoder, + 'Acme\\Entity\\LegacyUser' => $weakEncoder, // ... ); diff --git a/components/yaml/introduction.rst b/components/yaml/introduction.rst index 6921f15cc0f..43bcb5bc95f 100644 --- a/components/yaml/introduction.rst +++ b/components/yaml/introduction.rst @@ -153,7 +153,7 @@ array to its YAML representation: $array = array( 'foo' => 'bar', - 'bar' => array('foo' => 'bar', 'bar' => 'baz') + 'bar' => array('foo' => 'bar', 'bar' => 'baz'), ); $dumper = new Dumper(); diff --git a/cookbook/assetic/apply_to_option.rst b/cookbook/assetic/apply_to_option.rst index 42da73d26c6..68558b2e3a1 100644 --- a/cookbook/assetic/apply_to_option.rst +++ b/cookbook/assetic/apply_to_option.rst @@ -39,7 +39,7 @@ respectively to ``/usr/bin/coffee`` and ``/usr/bin/node``: $container->loadFromExtension('assetic', array( 'filters' => array( 'coffee' => array( - 'bin' => '/usr/bin/coffee', + 'bin' => '/usr/bin/coffee', 'node' => '/usr/bin/node', ), ), @@ -63,7 +63,8 @@ templates: javascripts( array('@AcmeFooBundle/Resources/public/js/example.coffee'), - array('coffee')) as $url): ?> + array('coffee') + ) as $url): ?> @@ -88,9 +89,12 @@ You can also combine multiple CoffeeScript files into a single output file: .. code-block:: html+php javascripts( - array('@AcmeFooBundle/Resources/public/js/example.coffee', - '@AcmeFooBundle/Resources/public/js/another.coffee'), - array('coffee')) as $url): ?> + array( + '@AcmeFooBundle/Resources/public/js/example.coffee', + '@AcmeFooBundle/Resources/public/js/another.coffee', + ), + array('coffee') + ) as $url): ?> @@ -143,8 +147,8 @@ applied to all ``.coffee`` files: $container->loadFromExtension('assetic', array( 'filters' => array( 'coffee' => array( - 'bin' => '/usr/bin/coffee', - 'node' => '/usr/bin/node', + 'bin' => '/usr/bin/coffee', + 'node' => '/usr/bin/node', 'apply_to' => '\.coffee$', ), ), @@ -168,9 +172,11 @@ being run through the CoffeeScript filter): .. code-block:: html+php javascripts( - array('@AcmeFooBundle/Resources/public/js/example.coffee', - '@AcmeFooBundle/Resources/public/js/another.coffee', - '@AcmeFooBundle/Resources/public/js/regular.js'), - as $url): ?> + array( + '@AcmeFooBundle/Resources/public/js/example.coffee', + '@AcmeFooBundle/Resources/public/js/another.coffee', + '@AcmeFooBundle/Resources/public/js/regular.js', + ) + ) as $url): ?> diff --git a/cookbook/assetic/asset_management.rst b/cookbook/assetic/asset_management.rst index 1ef686d6cba..80fbc91354b 100644 --- a/cookbook/assetic/asset_management.rst +++ b/cookbook/assetic/asset_management.rst @@ -51,7 +51,8 @@ drawn from various sources such as from within a bundle: .. code-block:: html+php javascripts( - array('@AcmeFooBundle/Resources/public/js/*')) as $url): ?> + array('@AcmeFooBundle/Resources/public/js/*') + ) as $url): ?> @@ -71,8 +72,8 @@ drawn from various sources such as from within a bundle: .. code-block:: html+php stylesheets( - array('bundles/acme_foo/css/*') - ) as $url): ?> + array('bundles/acme_foo/css/*') + ) as $url): ?> @@ -116,9 +117,12 @@ them as a single file: .. code-block:: html+php javascripts( - array('@AcmeFooBundle/Resources/public/js/*', - '@AcmeBarBundle/Resources/public/js/form.js', - '@AcmeBarBundle/Resources/public/js/calendar.js')) as $url): ?> + array( + '@AcmeFooBundle/Resources/public/js/*', + '@AcmeBarBundle/Resources/public/js/form.js', + '@AcmeBarBundle/Resources/public/js/calendar.js', + ) + ) as $url): ?> @@ -149,8 +153,11 @@ combine third party assets, such as jQuery, with your own into a single file: .. code-block:: html+php javascripts( - array('@AcmeFooBundle/Resources/public/js/thirdparty/jquery.js', - '@AcmeFooBundle/Resources/public/js/*')) as $url): ?> + array( + '@AcmeFooBundle/Resources/public/js/thirdparty/jquery.js', + '@AcmeFooBundle/Resources/public/js/*', + ) + ) as $url): ?> @@ -223,7 +230,8 @@ into your template: javascripts( array('@AcmeFooBundle/Resources/public/js/*'), - array('yui_js')) as $url): ?> + array('yui_js') + ) as $url): ?> diff --git a/cookbook/assetic/jpeg_optimize.rst b/cookbook/assetic/jpeg_optimize.rst index 4b5994b14f1..f02c18d986d 100644 --- a/cookbook/assetic/jpeg_optimize.rst +++ b/cookbook/assetic/jpeg_optimize.rst @@ -66,7 +66,8 @@ It can now be used from a template: images( array('@AcmeFooBundle/Resources/public/images/example.jpg'), - array('jpegoptim')) as $url): ?> + array('jpegoptim') + ) as $url): ?> Example @@ -104,7 +105,7 @@ remove these by using the ``strip_all`` option: $container->loadFromExtension('assetic', array( 'filters' => array( 'jpegoptim' => array( - 'bin' => 'path/to/jpegoptim', + 'bin' => 'path/to/jpegoptim', 'strip_all' => 'true', ), ), diff --git a/cookbook/assetic/yuicompressor.rst b/cookbook/assetic/yuicompressor.rst index ce5d4166836..7524d6741da 100644 --- a/cookbook/assetic/yuicompressor.rst +++ b/cookbook/assetic/yuicompressor.rst @@ -89,7 +89,8 @@ the view layer, this work is done in your templates: javascripts( array('@AcmeFooBundle/Resources/public/js/*'), - array('yui_js')) as $url): ?> + array('yui_js') + ) as $url): ?> @@ -116,7 +117,8 @@ can be repeated to minify your stylesheets. stylesheets( array('@AcmeFooBundle/Resources/public/css/*'), - array('yui_css')) as $url): ?> + array('yui_css') + ) as $url): ?> @@ -141,7 +143,8 @@ apply this filter when debug mode is off. javascripts( array('@AcmeFooBundle/Resources/public/js/*'), - array('?yui_js')) as $url): ?> + array('?yui_js') + ) as $url): ?> diff --git a/cookbook/bundles/extension.rst b/cookbook/bundles/extension.rst index 14a5fc34e87..634f23fca22 100644 --- a/cookbook/bundles/extension.rst +++ b/cookbook/bundles/extension.rst @@ -32,9 +32,9 @@ as integration of other related components: .. code-block:: php $container->loadFromExtension('framework', array( - // ... - 'form' => true, - // ... + ..., + 'form' => true, + ..., )); When you create a bundle, you have two choices on how to handle configuration: @@ -225,7 +225,7 @@ The array passed to your ``load()`` method will look like this:: array( 'foo' => 'fooValue', 'bar' => 'barValue', - ) + ), ) Notice that this is an *array of arrays*, not just a single flat array of the @@ -394,7 +394,7 @@ configuration value: // app/config/config.php $container->loadFromExtension('acme_hello', array( 'my_type' => 'foo', - // ... + ..., )); Global Parameters diff --git a/cookbook/configuration/external_parameters.rst b/cookbook/configuration/external_parameters.rst index 041e5ea4fd2..30b53c9279e 100644 --- a/cookbook/configuration/external_parameters.rst +++ b/cookbook/configuration/external_parameters.rst @@ -85,11 +85,13 @@ You can now reference these parameters wherever you need them. .. code-block:: php - $container->loadFromExtension('doctrine', array('dbal' => array( - 'driver' => 'pdo_mysql', - 'dbname' => 'symfony2_project', - 'user' => '%database.user%', - 'password' => '%database.password%', + $container->loadFromExtension('doctrine', array( + 'dbal' => array( + 'driver' => 'pdo_mysql', + 'dbname' => 'symfony2_project', + 'user' => '%database.user%', + 'password' => '%database.password%', + ) )); Constants diff --git a/cookbook/configuration/pdo_session_storage.rst b/cookbook/configuration/pdo_session_storage.rst index 5b24b458067..ba9c490f6a2 100644 --- a/cookbook/configuration/pdo_session_storage.rst +++ b/cookbook/configuration/pdo_session_storage.rst @@ -80,7 +80,7 @@ configuration format of your choice): use Symfony\Component\DependencyInjection\Reference; $container->loadFromExtension('framework', array( - // ... + ..., 'session' => array( // ... diff --git a/cookbook/doctrine/registration_form.rst b/cookbook/doctrine/registration_form.rst index fccd55ba97f..20bf7152d73 100644 --- a/cookbook/doctrine/registration_form.rst +++ b/cookbook/doctrine/registration_form.rst @@ -102,9 +102,9 @@ Next, create the form for the ``User`` model:: { $builder->add('email', 'email'); $builder->add('plainPassword', 'repeated', array( - 'first_name' => 'password', + 'first_name' => 'password', 'second_name' => 'confirm', - 'type' => 'password', + 'type' => 'password', )); } diff --git a/cookbook/email/spool.rst b/cookbook/email/spool.rst index 1119543894e..f059616925b 100644 --- a/cookbook/email/spool.rst +++ b/cookbook/email/spool.rst @@ -52,7 +52,7 @@ In order to use the spool, use the following configuration: 'spool' => array( 'type' => 'file', 'path' => '/path/to/spool', - ) + ), )); .. tip:: diff --git a/cookbook/event_dispatcher/before_after_filters.rst b/cookbook/event_dispatcher/before_after_filters.rst index bd61d37d2a3..c8b5260ed6e 100755 --- a/cookbook/event_dispatcher/before_after_filters.rst +++ b/cookbook/event_dispatcher/before_after_filters.rst @@ -174,7 +174,10 @@ your listener to be called just before any controller is executed. use Symfony\Component\DependencyInjection\Definition; $listener = new Definition('Acme\DemoBundle\EventListener\TokenListener', array('%tokens%')); - $listener->addTag('kernel.event_listener', array('event' => 'kernel.controller', 'method' => 'onKernelController')); + $listener->addTag('kernel.event_listener', array( + 'event' => 'kernel.controller', + 'method' => 'onKernelController' + )); $container->setDefinition('demo.tokens.action_listener', $listener); With this configuration, your ``TokenListener`` ``onKernelController`` method @@ -268,8 +271,14 @@ event: use Symfony\Component\DependencyInjection\Definition; $listener = new Definition('Acme\DemoBundle\EventListener\TokenListener', array('%tokens%')); - $listener->addTag('kernel.event_listener', array('event' => 'kernel.controller', 'method' => 'onKernelController')); - $listener->addTag('kernel.event_listener', array('event' => 'kernel.response', 'method' => 'onKernelResponse')); + $listener->addTag('kernel.event_listener', array( + 'event' => 'kernel.controller', + 'method' => 'onKernelController' + )); + $listener->addTag('kernel.event_listener', array( + 'event' => 'kernel.response', + 'method' => 'onKernelResponse' + )); $container->setDefinition('demo.tokens.action_listener', $listener); That's it! The ``TokenListener`` is now notified before every controller is diff --git a/cookbook/form/create_custom_field_type.rst b/cookbook/form/create_custom_field_type.rst index 521c8b845f8..6d467961eb6 100644 --- a/cookbook/form/create_custom_field_type.rst +++ b/cookbook/form/create_custom_field_type.rst @@ -34,7 +34,7 @@ for form fields, which is ``\Form\Type``. Make sure the field extend 'choices' => array( 'm' => 'Male', 'f' => 'Female', - ) + ), ); } diff --git a/cookbook/form/form_collections.rst b/cookbook/form/form_collections.rst index f54e0d61ef5..39fefe979e6 100755 --- a/cookbook/form/form_collections.rst +++ b/cookbook/form/form_collections.rst @@ -290,8 +290,8 @@ add the ``allow_add`` option to your collection field:: $builder->add('description'); $builder->add('tags', 'collection', array( - 'type' => new TagType(), - 'allow_add' => true, + 'type' => new TagType(), + 'allow_add' => true, 'by_reference' => false, )); } @@ -519,8 +519,8 @@ Start by adding the ``allow_delete`` option in the form Type:: $builder->add('description'); $builder->add('tags', 'collection', array( - 'type' => new TagType(), - 'allow_add' => true, + 'type' => new TagType(), + 'allow_add' => true, 'allow_delete' => true, 'by_reference' => false, )); diff --git a/cookbook/form/form_customization.rst b/cookbook/form/form_customization.rst index a967dc448e1..8b59289e46e 100644 --- a/cookbook/form/form_customization.rst +++ b/cookbook/form/form_customization.rst @@ -433,11 +433,13 @@ form is rendered. // app/config/config.php $container->loadFromExtension('twig', array( - 'form' => array('resources' => array( - 'AcmeDemoBundle:Form:fields.html.twig', - )), + 'form' => array( + 'resources' => array( + 'AcmeDemoBundle:Form:fields.html.twig', + ), + ), - // ... + // ... )); By default, Twig uses a *div* layout when rendering forms. Some people, however, @@ -468,11 +470,13 @@ resource to use such a layout: // app/config/config.php $container->loadFromExtension('twig', array( - 'form' => array('resources' => array( - 'form_table_layout.html.twig', - )), + 'form' => array( + 'resources' => array( + 'form_table_layout.html.twig', + ), + ), - // ... + // ... )); If you only want to make the change in one template, add the following line to @@ -523,10 +527,13 @@ form is rendered. // app/config/config.php // PHP $container->loadFromExtension('framework', array( - 'templating' => array('form' => - array('resources' => array( - 'AcmeDemoBundle:Form', - ))), + 'templating' => array( + 'form' => array( + 'resources' => array( + 'AcmeDemoBundle:Form', + ), + ), + ), // ... )); @@ -562,10 +569,13 @@ resource to use such a layout: // app/config/config.php $container->loadFromExtension('framework', array( - 'templating' => array('form' => - array('resources' => array( - 'FrameworkBundle:FormTable', - ))), + 'templating' => array( + 'form' => array( + 'resources' => array( + 'FrameworkBundle:FormTable', + ), + ), + ), // ... )); @@ -928,9 +938,11 @@ customizations directly. Look at the following example: .. code-block:: php - widget($form['name'], array('attr' => array( - 'class' => 'foo', - ))) ?> + widget($form['name'], array( + 'attr' => array( + 'class' => 'foo', + ), + )) ?> The array passed as the second argument contains form "variables". For more details about this concept in Twig, see :ref:`twig-reference-form-variables`. diff --git a/cookbook/profiler/data_collector.rst b/cookbook/profiler/data_collector.rst index 0e9c97a7932..2582d4f5430 100644 --- a/cookbook/profiler/data_collector.rst +++ b/cookbook/profiler/data_collector.rst @@ -166,5 +166,8 @@ tag in your configuration. For example, assuming your template is in some $container ->register('data_collector.your_collector_name', 'Acme\DebugBundle\Collector\Class\Name') - ->addTag('data_collector', array('template' => 'AcmeDebugBundle:Collector:templatename', 'id' => 'your_collector_name')) + ->addTag('data_collector', array( + 'template' => 'AcmeDebugBundle:Collector:templatename', + 'id' => 'your_collector_name', + )) ; diff --git a/cookbook/request/mime_type.rst b/cookbook/request/mime_type.rst index 2dcab3fd865..3e2fbe640ac 100644 --- a/cookbook/request/mime_type.rst +++ b/cookbook/request/mime_type.rst @@ -76,7 +76,10 @@ file and register it as a listener by adding the ``kernel.event_listener`` tag: # app/config/config.php $definition = new Definition('Acme\DemoBundle\RequestListener'); - $definition->addTag('kernel.event_listener', array('event' => 'kernel.request', 'method' => 'onKernelRequest')); + $definition->addTag('kernel.event_listener', array( + 'event' => 'kernel.request', + 'method' => 'onKernelRequest', + )); $container->setDefinition('acme.demobundle.listener.request', $definition); At this point, the ``acme.demobundle.listener.request`` service has been diff --git a/cookbook/security/custom_authentication_provider.rst b/cookbook/security/custom_authentication_provider.rst index cc2a8be663f..2dc156046a3 100644 --- a/cookbook/security/custom_authentication_provider.rst +++ b/cookbook/security/custom_authentication_provider.rst @@ -401,7 +401,7 @@ to service ids that do not exist yet: ``wsse.security.authentication.provider`` new Definition( 'Acme\DemoBundle\Security\Firewall\WsseListener', array( new Reference('security.context'), - new Reference('security.authentication.manager')) + new Reference('security.authentication.manager')), )); Now that your services are defined, tell your security context about your @@ -461,7 +461,7 @@ security configuration: // app/config/security.php $container->loadFromExtension('security', array( 'factories' => array( - "%kernel.root_dir%/../src/Acme/DemoBundle/Resources/config/security_factories.php" + "%kernel.root_dir%/../src/Acme/DemoBundle/Resources/config/security_factories.php", ), )); diff --git a/cookbook/security/force_https.rst b/cookbook/security/force_https.rst index 3d6c251cbc5..46736abf430 100644 --- a/cookbook/security/force_https.rst +++ b/cookbook/security/force_https.rst @@ -27,9 +27,10 @@ to use ``HTTPS`` then you could use the following configuration: .. code-block:: php 'access_control' => array( - array('path' => '^/secure', - 'role' => 'ROLE_ADMIN', - 'requires_channel' => 'https' + array( + 'path' => '^/secure', + 'role' => 'ROLE_ADMIN', + 'requires_channel' => 'https', ), ), @@ -58,9 +59,10 @@ role: .. code-block:: php 'access_control' => array( - array('path' => '^/login', - 'role' => 'IS_AUTHENTICATED_ANONYMOUSLY', - 'requires_channel' => 'https' + array( + 'path' => '^/login', + 'role' => 'IS_AUTHENTICATED_ANONYMOUSLY', + 'requires_channel' => 'https', ), ), diff --git a/cookbook/security/form_login.rst b/cookbook/security/form_login.rst index d5992206b13..1e8b31f96d0 100644 --- a/cookbook/security/form_login.rst +++ b/cookbook/security/form_login.rst @@ -66,11 +66,14 @@ the following config: // app/config/security.php $container->loadFromExtension('security', array( 'firewalls' => array( - 'main' => array('form_login' => array( + 'main' => array( // ... - 'default_target_path' => '/admin', - )), + 'form_login' => array( + // ... + 'default_target_path' => '/admin', + ), + ), ), )); @@ -111,11 +114,14 @@ of what URL they had requested previously by setting the // app/config/security.php $container->loadFromExtension('security', array( 'firewalls' => array( - 'main' => array('form_login' => array( + 'main' => array( // ... - 'always_use_default_target_path' => true, - )), + 'form_login' => array( + // ... + 'always_use_default_target_path' => true, + ), + ), ), )); @@ -154,11 +160,14 @@ this by setting ``use_referer`` to true (it defaults to false): // app/config/security.php $container->loadFromExtension('security', array( 'firewalls' => array( - 'main' => array('form_login' => array( + 'main' => array( // ... - 'use_referer' => true, - )), + 'form_login' => array( + // ... + 'use_referer' => true, + ), + ), ), )); @@ -241,9 +250,11 @@ option to another value. // app/config/security.php $container->loadFromExtension('security', array( 'firewalls' => array( - 'main' => array('form_login' => array( - 'target_path_parameter' => redirect_url, - )), + 'main' => array( + 'form_login' => array( + 'target_path_parameter' => redirect_url, + ), + ), ), )); @@ -284,10 +295,13 @@ following config: // app/config/security.php $container->loadFromExtension('security', array( 'firewalls' => array( - 'main' => array('form_login' => array( + 'main' => array( // ... - 'failure_path' => login_failure, - )), + 'form_login' => array( + // ... + 'failure_path' => login_failure, + ), + ), ), )); diff --git a/cookbook/security/remember_me.rst b/cookbook/security/remember_me.rst index 007a50e8cff..7bb3fb5f786 100644 --- a/cookbook/security/remember_me.rst +++ b/cookbook/security/remember_me.rst @@ -45,12 +45,14 @@ are shown here: // app/config/security.php $container->loadFromExtension('security', array( 'firewalls' => array( - 'main' => array('remember_me' => array( - 'key' => '%secret%', - 'lifetime' => 31536000, // 365 days in seconds - 'path' => '/', - 'domain' => '', // Defaults to the current domain from $_SERVER - )), + 'main' => array( + 'remember_me' => array( + 'key' => '%secret%', + 'lifetime' => 31536000, // 365 days in seconds + 'path' => '/', + 'domain' => '', // Defaults to the current domain from $_SERVER + ), + ), ), )); diff --git a/cookbook/symfony1.rst b/cookbook/symfony1.rst index 12427c3f0eb..395b78046ea 100644 --- a/cookbook/symfony1.rst +++ b/cookbook/symfony1.rst @@ -149,7 +149,7 @@ namespace in the ``vendor/bundle`` directory: $loader->registerNamespaces(array( // ... - 'Sensio' => __DIR__.'/../vendor/bundles', + 'Sensio' => __DIR__.'/../vendor/bundles', )); If the file did *not* live at this exact location, you'd receive a @@ -240,7 +240,8 @@ class:: // config/ProjectConfiguration.class.php public function setup() { - $this->enableAllPluginsExcept(array(... some plugins here)); + // some plugins here + $this->enableAllPluginsExcept(array(...)); } In Symfony2, the bundles are activated inside the application kernel:: diff --git a/cookbook/templating/PHP.rst b/cookbook/templating/PHP.rst index 709ea290b78..61749ee0b09 100644 --- a/cookbook/templating/PHP.rst +++ b/cookbook/templating/PHP.rst @@ -40,7 +40,7 @@ your application configuration file: $container->loadFromExtension('framework', array( // ... - 'templating' => array( + 'templating' => array( 'engines' => array('twig', 'php'), ), )); @@ -226,7 +226,10 @@ If you create a ``fancy`` action, and want to include it into the .. code-block:: html+php - render('AcmeHelloBundle:Hello:fancy', array('name' => $name, 'color' => 'green')) ?> + render('AcmeHelloBundle:Hello:fancy', array( + 'name' => $name, + 'color' => 'green' + )) ?> Here, the ``AcmeHelloBundle:Hello:fancy`` string refers to the ``fancy`` action of the ``Hello`` controller:: @@ -240,7 +243,10 @@ Here, the ``AcmeHelloBundle:Hello:fancy`` string refers to the ``fancy`` action // create some object, based on the $color variable $object = ...; - return $this->render('AcmeHelloBundle:Hello:fancy.html.php', array('name' => $name, 'object' => $object)); + return $this->render('AcmeHelloBundle:Hello:fancy.html.php', array( + 'name' => $name, + 'object' => $object + )); } // ... diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index aa8f1277e7b..52382977696 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -221,9 +221,9 @@ Now, activate the ``assets_version`` option: // app/config/config.php $container->loadFromExtension('framework', array( - // ... + ..., 'templating' => array( - 'engines' => array('twig'), + 'engines' => array('twig'), 'assets_version' => 'v2', ), ));