Skip to content

Minimize horizontal scrolling in code blocks to improve readability #3553

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 18, 2014
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
8 changes: 6 additions & 2 deletions book/controller.rst
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,10 @@ value to each variable.
$subRequest = $request->duplicate(array(), null, $path);

$httpKernel = $this->container->get('http_kernel');
$response = $httpKernel->handle($subRequest, HttpKernelInterface::SUB_REQUEST);
$response = $httpKernel->handle(
$subRequest,
HttpKernelInterface::SUB_REQUEST
);

.. index::
single: Controller; Rendering templates
Expand Down Expand Up @@ -574,7 +577,8 @@ The Symfony templating engine is explained in great detail in the
'AcmeHelloBundle:Hello/Greetings:index.html.twig',
array('name' => $name)
);
// index.html.twig found in Resources/views/Hello/Greetings is rendered.
// index.html.twig found in Resources/views/Hello/Greetings
// is rendered.

.. index::
single: Controller; Accessing services
Expand Down
27 changes: 16 additions & 11 deletions book/doctrine.rst
Original file line number Diff line number Diff line change
Expand Up @@ -622,8 +622,10 @@ Once you have your repository, you have access to all sorts of helpful methods::
You can also take advantage of the useful ``findBy`` and ``findOneBy`` methods
to easily fetch objects based on multiple conditions::

// query for one product matching by name and price
$product = $repository->findOneBy(array('name' => 'foo', 'price' => 19.99));
// query for one product matching be name and price
$product = $repository->findOneBy(
array('name' => 'foo', 'price' => 19.99)
);

// query for all products matching the name, ordered by price
$products = $repository->findBy(
Expand Down Expand Up @@ -1144,7 +1146,8 @@ Now you can see this new code in action! Imagine you're inside a controller::
$em->flush();

return new Response(
'Created product id: '.$product->getId().' and category id: '.$category->getId()
'Created product id: '.$product->getId()
.' and category id: '.$category->getId()
);
}
}
Expand Down Expand Up @@ -1478,8 +1481,8 @@ and ``nullable``. Take a few examples:
protected $name;

/**
* A string field of length 150 that persists to an "email_address" column
* and has a unique index.
* A string field of length 150 that persists to an
* "email_address" column and has a unique index.
*
* @ORM\Column(name="email_address", unique=true, length=150)
*/
Expand All @@ -1489,13 +1492,14 @@ and ``nullable``. Take a few examples:

fields:
# A string field length 255 that cannot be null
# (reflecting the default values for the "length" and *nullable* options)
# type attribute is necessary in YAML definitions
# (reflecting the default values for the "length"
# and *nullable* options) type attribute is
# necessary in YAML definitions
name:
type: string

# A string field of length 150 that persists to an "email_address" column
# and has a unique index.
# A string field of length 150 that persists to
# an "email_address" column and has a unique index.
email:
type: string
column: email_address
Expand All @@ -1506,8 +1510,9 @@ and ``nullable``. Take a few examples:

<!--
A string field length 255 that cannot be null
(reflecting the default values for the "length" and *nullable* options)
type attribute is necessary in XML definitions
(reflecting the default values for the "length"
and *nullable* options) type attribute is
necessary in XML definitions
-->
<field name="name" type="string" />
<field name="email"
Expand Down
13 changes: 9 additions & 4 deletions components/form/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,10 @@ to bootstrap or access Twig and add the :class:`Symfony\\Bridge\\Twig\\Extension
$defaultFormTheme = 'form_div_layout.html.twig';

$vendorDir = realpath(__DIR__ . '/../vendor');
// the path to TwigBridge so Twig can locate the form_div_layout.html.twig file
$vendorTwigBridgeDir = $vendorDir . '/symfony/twig-bridge/Symfony/Bridge/Twig';
// the path to TwigBridge so Twig can locate the
// form_div_layout.html.twig file
$vendorTwigBridgeDir =
$vendorDir . '/symfony/twig-bridge/Symfony/Bridge/Twig';
// the path to your other templates
$viewsDir = realpath(__DIR__ . '/../views');

Expand All @@ -193,7 +195,9 @@ to bootstrap or access Twig and add the :class:`Symfony\\Bridge\\Twig\\Extension
$formEngine = new TwigRendererEngine(array($defaultFormTheme));
$formEngine->setEnvironment($twig);
// add the FormExtension to Twig
$twig->addExtension(new FormExtension(new TwigRenderer($formEngine, $csrfProvider)));
$twig->addExtension(
new FormExtension(new TwigRenderer($formEngine, $csrfProvider))
);

// create your form factory as normal
$formFactory = Forms::createFormFactoryBuilder()
Expand Down Expand Up @@ -307,7 +311,8 @@ Your integration with the Validation component will look something like this::

$vendorDir = realpath(__DIR__ . '/../vendor');
$vendorFormDir = $vendorDir . '/symfony/form/Symfony/Component/Form';
$vendorValidatorDir = $vendorDir . '/symfony/validator/Symfony/Component/Validator';
$vendorValidatorDir =
$vendorDir . '/symfony/validator/Symfony/Component/Validator';

// create the validator - details will vary
$validator = Validation::createValidator();
Expand Down
13 changes: 10 additions & 3 deletions components/http_foundation/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,8 @@ If you need to get full access to parsed data from ``Accept``, ``Accept-Language
}

// accepts items are sorted by descending quality
$accepts = AcceptHeader::fromString($request->headers->get('Accept'))->all();
$accepts = AcceptHeader::fromString($request->headers->get('Accept'))
->all();

Accessing other Data
~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -432,7 +433,10 @@ abstracts the hard work behind a simple API::

use Symfony\Component\HttpFoundation\ResponseHeaderBag;

$d = $response->headers->makeDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, 'foo.pdf');
$d = $response->headers->makeDisposition(
ResponseHeaderBag::DISPOSITION_ATTACHMENT,
'foo.pdf'
);

$response->headers->set('Content-Disposition', $d);

Expand Down Expand Up @@ -460,7 +464,10 @@ if it should::
You can still set the ``Content-Type`` of the sent file, or change its ``Content-Disposition``::

$response->headers->set('Content-Type', 'text/plain');
$response->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, 'filename.txt');
$response->setContentDisposition(
ResponseHeaderBag::DISPOSITION_ATTACHMENT,
'filename.txt'
);

.. _component-http-foundation-json-response:

Expand Down
4 changes: 3 additions & 1 deletion components/http_kernel/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,9 @@ a built-in ControllerResolver that can be used to create a working example::
$routes = new RouteCollection();
$routes->add('hello', new Route('/hello/{name}', array(
'_controller' => function (Request $request) {
return new Response(sprintf("Hello %s", $request->get('name')));
return new Response(
sprintf("Hello %s", $request->get('name'))
);
}
)
));
Expand Down
7 changes: 6 additions & 1 deletion components/intl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,12 @@ multi-valued entries (arrays), the values of the more specific and the fallback
locale will be merged. In order to suppress this behavior, the last parameter
``$fallback`` can be set to ``false``::

echo $reader->readEntry('/path/to/bundle', 'en', array('Data', 'entry1'), false);
echo $reader->readEntry(
'/path/to/bundle',
'en',
array('Data', 'entry1'),
false
);

Accessing ICU Data
------------------
Expand Down