Skip to content

Commit 03f46c1

Browse files
committed
Merge branch '3.3' into 3.4
* 3.3: Update custom_constraint.rst [#8087] fix merge Updated language for annouce event Update form best practises regarding Form::isValid Add form_theme in error customization Fix typo er(r)or Update questionhelper.rst Typo: lowercase letter Wrap the instantiation in parenthesis, and chain away fix variable being overwritten
2 parents 40e6e51 + 4c2a37d commit 03f46c1

File tree

11 files changed

+20
-14
lines changed

11 files changed

+20
-14
lines changed

best_practices/forms.rst

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,6 @@ and a ``createAction()`` that *only* processes the form submit. Both those
204204
actions will be almost identical. So it's much simpler to let ``newAction()``
205205
handle everything.
206206

207-
Second, we recommend using ``$form->isSubmitted()`` in the ``if`` statement
208-
for clarity. This isn't technically needed, since ``isValid()`` first calls
209-
``isSubmitted()``. But without this, the flow doesn't read well as it *looks*
210-
like the form is *always* processed (even on the GET request).
207+
Second, is it required to call ``$form->isSubmitted()`` in the ``if`` statement
208+
before calling ``isValid()``. Calling ``isValid()`` with an unsubmitted form
209+
is deprecated since version 3.2 and will throw an exception in 4.0.

components/console/helpers/questionhelper.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,14 +212,15 @@ convenient for passwords::
212212
On Windows systems, this ``stty`` command may generate gibberish output and
213213
mangle the input text. If that's your case, disable it with this command::
214214

215+
use Symfony\Component\Console\Helper\QuestionHelper;
215216
use Symfony\Component\Console\Question\ChoiceQuestion;
216217

217218
// ...
218219
public function execute(InputInterface $input, OutputInterface $output)
219220
{
220221
// ...
221222
$helper = $this->getHelper('question');
222-
$helper->disableStty();
223+
QuestionHelper::disableStty();
223224

224225
// ...
225226
}

controller.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ method. Here are several common services you might need::
372372
// you can also fetch parameters
373373
$someParameter = $this->getParameter('some_parameter');
374374

375-
If you receive an eror like:
375+
If you receive an error like:
376376

377377
.. code-block:: text
378378

email.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ an email is pretty straightforward::
103103

104104
public function indexAction($name, \Swift_Mailer $mailer)
105105
{
106-
$message = new \Swift_Message('Hello Email')
106+
$message = (new \Swift_Message('Hello Email'))
107107
->setFrom('[email protected]')
108108
->setTo('[email protected]')
109109
->setBody(

email/dev_environment.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ Now, suppose you're sending an email to ``[email protected]``.
100100
101101
public function indexAction($name, \Swift_Mailer $mailer)
102102
{
103-
$message = new \Swift_Message('Hello Email')
103+
$message = (new \Swift_Message('Hello Email'))
104104
->setFrom('[email protected]')
105105
->setTo('[email protected]')
106106
->setBody(

email/testing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Start with an easy controller action that sends an email::
1414

1515
public function sendEmailAction($name, \Swift_Mailer $mailer)
1616
{
17-
$message = new \Swift_Message('Hello Email')
17+
$message = (new \Swift_Message('Hello Email'))
1818
->setFrom('[email protected]')
1919
->setTo('[email protected]')
2020
->setBody('You should see me from the profiler!')

form/form_customization.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -873,6 +873,8 @@ and customize the ``form_errors`` fragment.
873873

874874
.. code-block:: html+twig
875875

876+
{% form_theme form _self %}
877+
876878
{# form_errors.html.twig #}
877879
{% block form_errors %}
878880
{% spaceless %}
@@ -933,6 +935,8 @@ fields (e.g. a whole form), and not just an individual field.
933935

934936
.. code-block:: html+twig
935937

938+
{% form_theme form _self %}
939+
936940
{# form_errors.html.twig #}
937941
{% block form_errors %}
938942
{% spaceless %}

performance.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,15 @@ If you're using the Standard Distribution, make the following changes::
138138
139139
use Symfony\Component\ClassLoader\ApcClassLoader;
140140

141-
$loader = require __DIR__.'/../app/autoload.php';
141+
// do not use $loader as a variable name here as it would
142+
// be overwritten when loading the bootstrap.php.cache file
143+
$classLoader = require __DIR__.'/../app/autoload.php';
142144
include_once __DIR__.'/../app/bootstrap.php.cache';
143145

144146
// Use APC for autoloading to improve performance
145147
// Change 'sf2' by the prefix you want in order
146148
// to prevent key conflict with another application
147-
$loader = new ApcClassLoader('sf2', $loader);
149+
$loader = new ApcClassLoader('sf2', $classLoader);
148150
$loader->register(true);
149151

150152
// ...

testing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ command:
2929
3030
$ phpunit
3131
32-
PHPunit is configured by the ``phpunit.xml.dist`` file in the root of your
32+
PHPUnit is configured by the ``phpunit.xml.dist`` file in the root of your
3333
Symfony application.
3434

3535
.. tip::

validation/custom_constraint.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ includes some simple default logic::
4545
// in the base Symfony\Component\Validator\Constraint class
4646
public function validatedBy()
4747
{
48-
return get_class($this).'Validator';
48+
return ContainsAlphanumericValidator::class;
4949
}
5050

5151
In other words, if you create a custom ``Constraint`` (e.g. ``MyConstraint``),

workflow/usage.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ order:
241241
* ``workflow.[workflow name].entered.[place name]``
242242

243243
``workflow.announce``
244-
Triggered once for each workflow that now is available for the object.
244+
Triggered for each place that now is available for the object.
245245

246246
The three events being dispatched are:
247247

0 commit comments

Comments
 (0)