Skip to content

Fixed spacing issues in PHP arrays #2222

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 25, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion book/controller.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 13 additions & 8 deletions book/forms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ method::
public function getDefaultOptions(array $options)
{
return array(
'validation_groups' => array('registration')
'validation_groups' => array('registration'),
);
}

Expand Down Expand Up @@ -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',
),
),
// ...
));

Expand Down Expand Up @@ -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',
),
),
)
// ...
));

Expand Down
4 changes: 2 additions & 2 deletions book/http_cache.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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),
));

Expand Down Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions book/internals.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 3 additions & 4 deletions book/page_creation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ the bundle is registered with the kernel::
public function registerBundles()
{
$bundles = array(
// ...
...,
new Acme\HelloBundle\AcmeHelloBundle(),
);
// ...
Expand Down Expand Up @@ -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(),
);
Expand Down Expand Up @@ -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(
Expand Down
16 changes: 8 additions & 8 deletions book/routing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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::
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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+',
)));
Expand Down Expand Up @@ -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',
)));
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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',
// )

Expand Down
45 changes: 24 additions & 21 deletions book/security.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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',
),
),
),
Expand All @@ -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'),
),
),
),
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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(),
),
),
Expand Down Expand Up @@ -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'),
Expand Down Expand Up @@ -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'),
),
),
),
Expand Down Expand Up @@ -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'),
),
),
Expand Down Expand Up @@ -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',
),
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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' => '/'),
),
),
Expand Down Expand Up @@ -1768,7 +1767,7 @@ done by activating the ``switch_user`` firewall listener:
$container->loadFromExtension('security', array(
'firewalls' => array(
'main'=> array(
// ...
...,
'switch_user' => true
),
),
Expand Down Expand Up @@ -1802,7 +1801,11 @@ to show a link to exit impersonation:
.. code-block:: html+php

<?php if ($view['security']->isGranted('ROLE_PREVIOUS_ADMIN')): ?>
<a href="<?php echo $view['router']->generate('homepage', array('_switch_user' => '_exit') ?>">Exit impersonation</a>
<a
href="<?php echo $view['router']->generate('homepage', array('_switch_user' => '_exit') ?>"
>
Exit impersonation
</a>
<?php endif; ?>

Of course, this feature needs to be made available to a small group of users.
Expand Down
22 changes: 12 additions & 10 deletions book/service_container.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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::
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -875,7 +877,7 @@ Configuring the service container is easy:
'%newsletter_manager.class%',
array(
new Reference('mailer'),
new Reference('templating')
new Reference('templating'),
)
));

Expand Down
5 changes: 4 additions & 1 deletion book/templating.rst
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,10 @@ Including this template from any other template is simple:
<h1>Recent Articles</h1>

<?php foreach ($articles as $article): ?>
<?php echo $view->render('AcmeArticleBundle:Article:articleDetails.html.php', array('article' => $article)) ?>
<?php echo $view->render(
'AcmeArticleBundle:Article:articleDetails.html.php',
array('article' => $article)
) ?>
<?php endforeach; ?>
<?php $view['slots']->stop() ?>

Expand Down
8 changes: 4 additions & 4 deletions book/testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Loading