Skip to content

Commit 34e2cd2

Browse files
committed
Merge branch '4.1'
* 4.1: {% if label is not same as(false) and required %} minor language tweak Update service_container.rst Fix wrong exception used in custom authentication provider example [Console] Replace useless usage of ContainerAwareCommand Shorten ternary operator Fix wrong usage in custom authenticator checking if password is invalid [Process] Fix typo in Process object initialization update hardcoded 5.1 version link Explain dump server usage outside of Symfony Add undocumented sortByAccessedTime, sortByChangedTime and sortByModifiedTime methods in finder component Update bugs.rst [#10200] remove trailing spaces action_method is missing $task variable [#10177] fix markup Clarifying when you need to or don't need to install the server bundle Fix bad link Update setup.rst Also requiring annotations so they can be used
2 parents 1bbaa64 + 2828795 commit 34e2cd2

16 files changed

+48
-22
lines changed

components/finder.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,14 @@ Sort the result by name or by type (directories first, then files)::
178178
.. versionadded:: 4.2
179179
The option to use the natural sort order was introduced in Symfony 4.2.
180180

181+
Sort the files and directories by the last accessed, changed or modified time::
182+
183+
$finder->sortByAccessedTime();
184+
185+
$finder->sortByChangedTime();
186+
187+
$finder->sortByModifiedTime();
188+
181189
You can also define your own sorting algorithm with ``sort()`` method::
182190

183191
$finder->sort(function (\SplFileInfo $a, \SplFileInfo $b) {

components/process.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ Before a process is started, you can specify its standard input using either the
241241
of the constructor. The provided input can be a string, a stream resource or a
242242
Traversable object::
243243

244-
$process = new Process('cat']);
244+
$process = new Process('cat');
245245
$process->setInput('foobar');
246246
$process->run();
247247

components/var_dumper.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,20 @@ Inside a Symfony application, the output of the dump server is configured with
119119
the :ref:`dump_destination option <configuration-debug-dump_destination>` of the
120120
``debug`` package.
121121

122+
Outside a Symfony application, use the ``ServerDumper`` class:
123+
124+
require __DIR__.'/vendor/autoload.php';
125+
126+
use Symfony\Component\VarDumper\VarDumper;
127+
use Symfony\Component\VarDumper\Cloner\VarCloner;
128+
use Symfony\Component\VarDumper\Dumper\ServerDumper;
129+
130+
VarDumper::setHandler(function ($var) {
131+
$cloner = new VarCloner();
132+
$dumper = new ServerDumper('tcp://127.0.0.1:9912');
133+
$dumper->dump($cloner->cloneVar($var));
134+
});
135+
122136
DebugBundle and Twig Integration
123137
--------------------------------
124138

console/request_context.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,14 @@ router service and override its settings::
7878
use Symfony\Component\Routing\RouterInterface;
7979
// ...
8080

81-
class DemoCommand extends ContainerAwareCommand
81+
class DemoCommand extends Command
8282
{
8383
private $router;
8484

8585
public function __construct(RouterInterface $router)
8686
{
87+
parent::__construct();
88+
8789
$this->router = $router;
8890
}
8991

contributing/code/bugs.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ If your problem definitely looks like a bug, report it using the official bug
4444

4545
* *(optional)* Attach a :doc:`patch <patches>`.
4646

47-
.. _`Stack Overflow`: https://stackoverflow.com/questions/tagged/symfony2
47+
.. _`Stack Overflow`: https://stackoverflow.com/questions/tagged/symfony
4848
.. _IRC channel: https://symfony.com/irc
4949
.. _the Symfony Slack: https://symfony.com/slack-invite
5050
.. _tracker: https://github.com/symfony/symfony/issues

create_framework/front_controller.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ web root directory:
153153
Now, configure your web server root directory to point to ``web/`` and all
154154
other files won't be accessible from the client anymore.
155155

156-
To test your changes in a browser (``http://localhost:4321/hello/?name=Fabien``), run
156+
To test your changes in a browser (``http://localhost:4321/hello?name=Fabien``), run
157157
the PHP built-in server:
158158

159159
.. code-block:: terminal

form/action_method.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ form, you can use ``setAction()`` and ``setMethod()``:
2727
{
2828
public function new()
2929
{
30+
// ...
31+
3032
$form = $this->createFormBuilder($task)
3133
->setAction($this->generateUrl('target_route'))
3234
->setMethod('GET')

form/form_customization.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,7 @@ form, modify the ``use`` tag and add the following:
755755
{% block form_label %}
756756
{{ block('base_form_label') }}
757757

758-
{% if required %}
758+
{% if label is not same as(false) and required %}
759759
<span class="required" title="This field is required">*</span>
760760
{% endif %}
761761
{% endblock %}
@@ -770,7 +770,7 @@ the following:
770770
{% block form_label %}
771771
{{ parent() }}
772772

773-
{% if required %}
773+
{% if label is not same as(false) and required %}
774774
<span class="required" title="This field is required">*</span>
775775
{% endif %}
776776
{% endblock %}

page_creation.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,15 +176,16 @@ To get a list of *all* of the routes in your system, use the ``debug:router`` co
176176
177177
$ php bin/console debug:router
178178
179-
You should see your `app_lucky_number` route at the very top:
179+
You should see your ``app_lucky_number`` route at the very top:
180180

181181
================== ======== ======== ====== ===============
182182
Name Method Scheme Host Path
183183
================== ======== ======== ====== ===============
184184
app_lucky_number ANY ANY ANY /lucky/number
185185
================== ======== ======== ====== ===============
186186

187-
You will also see debugging routes below `app_lucky_number` -- more on the debugging routes in the next section.
187+
You will also see debugging routes below ``app_lucky_number`` -- more on
188+
the debugging routes in the next section.
188189

189190
You'll learn about many more commands as you continue!
190191

reference/forms/twig_reference.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ done by using a public ``vars`` property on the
322322
.. code-block:: html+twig
323323

324324
<label for="{{ form.name.vars.id }}"
325-
class="{{ form.name.vars.required ? 'required' : '' }}">
325+
class="{{ form.name.vars.required ? 'required' }}">
326326
{{ form.name.vars.label }}
327327
</label>
328328

security/custom_authentication_provider.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,6 @@ the ``PasswordDigest`` header value matches with the user's password::
206206
use Symfony\Component\Security\Core\Authentication\Provider\AuthenticationProviderInterface;
207207
use Symfony\Component\Security\Core\User\UserProviderInterface;
208208
use Symfony\Component\Security\Core\Exception\AuthenticationException;
209-
use Symfony\Component\Security\Core\Exception\NonceExpiredException;
210209
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
211210
use App\Security\Authentication\Token\WsseUserToken;
212211

@@ -259,7 +258,9 @@ the ``PasswordDigest`` header value matches with the user's password::
259258
// Validate that the nonce is *not* in cache
260259
// if it is, this could be a replay attack
261260
if ($cacheItem->isHit()) {
262-
throw new NonceExpiredException('Previously used nonce detected');
261+
// In a real world application you should throw a custom
262+
// exception extending the AuthenticationException
263+
throw new AuthenticationException('Previously used nonce detected');
263264
}
264265

265266
// Store the item in cache for 5 minutes

security/custom_password_authenticator.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ the user::
6363
if ('' === ($givenPassword = $token->getCredentials())) {
6464
throw new BadCredentialsException('The given password cannot be empty.');
6565
}
66-
if (!$this->encoder->isPasswordValid($user->getPassword(), $givenPassword, $user->getSalt())) {
66+
if (!$this->encoder->isPasswordValid($user, $givenPassword)) {
6767
throw new BadCredentialsException('The given password is invalid.');
6868
}
6969
}

service_container.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,7 @@ But, with ``autoconfigure: true``, you don't need the tag. In fact, if you're us
772772
the :ref:`default services.yaml config <service-container-services-load-example>`,
773773
you don't need to do *anything*: the service will be automatically loaded. Then,
774774
``autoconfigure`` will add the ``twig.extension`` tag *for* you, because your class
775-
implements ``Twig\\Extension\\ExtensionInterface``. And thanks to ``autowire``, you can even add
775+
implements ``Twig\Extension\ExtensionInterface``. And thanks to ``autowire``, you can even add
776776
constructor arguments without any configuration.
777777

778778
.. _container-public:

setup.rst

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,24 +34,22 @@ In other words, your new app is ready!
3434
3535
$ composer create-project symfony/skeleton my-project
3636
37+
# optional: install the web server bundle (explained next)
38+
$ cd my-project
39+
$ composer require symfony/web-server-bundle --dev
40+
3741
Running your Symfony Application
3842
--------------------------------
3943

4044
On production, you should use a web server like Nginx or Apache
4145
(see :doc:`configuring a web server to run Symfony </setup/web_server_configuration>`).
4246
But for development, it's even easier to use the :doc:`Symfony PHP web server <setup/built_in_web_server>`.
4347

44-
First, move into your new project and install the server:
48+
Move into your new project and start the server:
4549

4650
.. code-block:: terminal
4751
4852
$ cd my-project
49-
$ composer require symfony/web-server-bundle --dev
50-
51-
To start the server, run:
52-
53-
.. code-block:: terminal
54-
5553
$ php bin/console server:run
5654
5755
Open your browser and navigate to ``http://localhost:8000/``. If everything is working,

setup/homestead.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,5 +75,5 @@ developing your Symfony application!
7575
.. _Homestead: https://laravel.com/docs/homestead
7676
.. _Vagrant: https://www.vagrantup.com/
7777
.. _the Homestead documentation: https://laravel.com/docs/homestead#installation-and-setup
78-
.. _Daily Usage: https://laravel.com/docs/5.1/homestead#daily-usage
78+
.. _Daily Usage: https://laravel.com/docs/homestead#daily-usage
7979
.. _this blog post: https://www.whitewashing.de/2013/08/19/speedup_symfony2_on_vagrant_boxes.html

validation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ install the validator before using it:
1919

2020
.. code-block:: terminal
2121
22-
$ composer require symfony/validator
22+
$ composer require symfony/validator doctrine/annotations
2323
2424
.. index::
2525
single: Validation; The basics

0 commit comments

Comments
 (0)