Skip to content

Commit

Permalink
Use Vale on 'quick tour', 'create framework' and getting started sect…
Browse files Browse the repository at this point in the history
…ions
  • Loading branch information
wouterj committed Apr 20, 2024
1 parent 895d2e7 commit ac3b26b
Show file tree
Hide file tree
Showing 16 changed files with 72 additions and 36 deletions.
9 changes: 7 additions & 2 deletions .vale.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ Packages = Microsoft, write-good
Vocab = Symfony

[*]
BasedOnStyles = Vale, Microsoft, write-good
BlockIgnores = (?s) *(\.\. configuration-block::)
BasedOnStyles = Vale, Microsoft, write-good, Symfony
BlockIgnores = (?s) *(\.\. (configuration-block|code-block)::[^\n]+(\n\s[^\n]+)+)
TokenIgnores = (:ref:`.*`)

Microsoft.Headings = NO
Microsoft.Foreign = NO
Microsoft.Quotes = NO
Microsoft.Contractions = NO
6 changes: 6 additions & 0 deletions .vale/Symfony/Headings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
extends: capitalization
message: "'%s' should be in title case"
level: warning
scope: heading
match: $title
style: Chicago
37 changes: 31 additions & 6 deletions .vale/config/vocabularies/Symfony/accept.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,32 @@
Symfony
namespace
autowiring
autowired
boolean
stderr
config
Ctype
iconv
Tokenizer
Monolog
nginx
Laravel
ezPublish
PHPUnit
Xdebug
webpack
(?i)autocompletes
(?i)autoload(ing|ed)
(?i)autoloader
(?i)autowir(ing|ed)
(?i)autowire
(?i)auto-(installing|escaping)
(?i)boolean
(?i)charset
(?i)config
(?i)env
(?i)hardcode(d|s)
(?i)hasser
(?i)inlined
(?i)isser
(?i)namespace
(?i)profiler
(?i)reusability
(?i)stderr
(?i)uncomment
(?i)unvalidated
(?i)validator
6 changes: 3 additions & 3 deletions configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -895,9 +895,9 @@ override environment variables defined in ``.env`` files.
Configuring Environment Variables in Production
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In production, the ``.env`` files are also parsed and loaded on each request. So
the easiest way to define env vars is by creating a ``.env.local`` file on your
production server(s) with your production values.
In production, the ``.env`` files are also parsed and loaded on each request.
The easiest way to define env vars is by creating a ``.env.local`` file on your
production servers with your production values.

To improve performance, you can optionally run the ``dump-env`` Composer command:

Expand Down
4 changes: 2 additions & 2 deletions controller.rst
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ Generating URLs
~~~~~~~~~~~~~~~

The :method:`Symfony\\Bundle\\FrameworkBundle\\Controller\\AbstractController::generateUrl`
method is just a helper method that generates the URL for a given route::
method is just a helper method that generates the URL of a given route::

$url = $this->generateUrl('app_lucky_number', ['max' => 10]);

Expand Down Expand Up @@ -458,7 +458,7 @@ In Symfony, a controller is required to return a ``Response`` object::
$response->headers->set('Content-Type', 'text/css');

To facilitate this, different response objects are included to address different
response types. Some of these are mentioned below. To learn more about the
response types. Some of these are mentioned below. To learn more about the
``Request`` and ``Response`` (and different ``Response`` classes), see the
:ref:`HttpFoundation component documentation <component-http-foundation-request>`.

Expand Down
2 changes: 1 addition & 1 deletion create_framework/dependency_injection.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ reporting turned on and errors displayed in the browser to ease debugging::
environment. Having two different front controllers gives you the opportunity
to have a slightly different configuration for each of them.

So, moving code from the front controller to the framework class makes our
Moving code from the front controller to the framework class makes our
framework more configurable, but at the same time, it introduces a lot of
issues:

Expand Down
8 changes: 4 additions & 4 deletions create_framework/http_foundation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ it suffers from a few problems::
printf('Hello %s', $name);

First, if the ``name`` query parameter is not defined in the URL query string,
you will get a PHP warning; so let's fix it::
you will get a PHP warning; let's fix it::

// framework/index.php
$name = $_GET['name'] ?? 'World';
Expand Down Expand Up @@ -93,8 +93,8 @@ reading this book now and go back to whatever code you were working on before.
Going OOP with the HttpFoundation Component
-------------------------------------------

Writing web code is about interacting with HTTP. So, the fundamental
principles of our framework should be around the `HTTP specification`_.
Writing web code is about interacting with HTTP. The fundamental principles
of our framework should be around the `HTTP specification`_.

The HTTP specification describes how a client (a browser for instance)
interacts with a server (our application via a web server). The dialog between
Expand Down Expand Up @@ -261,7 +261,7 @@ explicitly trust your reverse proxies by calling ``setTrustedProxies()``::
// the client is a known one, so give it some more privilege
}

So, the ``getClientIp()`` method works securely in all circumstances. You can
The ``getClientIp()`` method works securely in all circumstances. You can
use it in all your projects, whatever the configuration is, it will behave
correctly and safely. That's one of the goals of using a framework. If you were
to write a framework from scratch, you would have to think about all these
Expand Down
2 changes: 1 addition & 1 deletion create_framework/http_kernel_controller_resolver.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
The HttpKernel Component: the Controller Resolver
The HttpKernel Component: The Controller Resolver
=================================================

You might think that our framework is already pretty solid and you are
Expand Down
2 changes: 1 addition & 1 deletion create_framework/routing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ With this knowledge in mind, let's write the new version of our framework::

$response->send();

There are a few new things in the code:
This code has a few new things:

* Route names are used for template names;

Expand Down
2 changes: 1 addition & 1 deletion create_framework/unit_testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ controller. We check that the response status is 200 and that its content is
the one we have set in the controller.

To check that we have covered all possible use cases, run the PHPUnit test
coverage feature (you need to enable `XDebug`_ first):
coverage feature (you need to enable `Xdebug`_ first):

.. code-block:: terminal
Expand Down
2 changes: 1 addition & 1 deletion page_creation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ project:
Most of the time, you'll be working in ``src/``, ``templates/`` or ``config/``.
As you keep reading, you'll learn what can be done inside each of these.

So what about the other directories in the project?
What about the other directories in the project?

``bin/``
The famous ``bin/console`` file lives here (and other, less important
Expand Down
2 changes: 1 addition & 1 deletion quick_tour/flex_recipes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ small, simple and *fast*. And you're in total control of what you add.
Flex Recipes and Aliases
------------------------

So how can we install and configure Twig? By running one single command:
How can we install and configure Twig? By running one single command:

.. code-block:: terminal
Expand Down
6 changes: 3 additions & 3 deletions quick_tour/the_big_picture.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Symfony application:
└─ vendor/
Can we already load the project in a browser? Yes! You can setup
:doc:`Nginx or Apache </setup/web_server_configuration>` and configure their
:doc:`nginx or Apache </setup/web_server_configuration>` and configure their
document root to be the ``public/`` directory. But, for development, it's better
to :doc:`install the Symfony local web server </setup/symfony_server>` and run
it as follows:
Expand Down Expand Up @@ -100,7 +100,7 @@ A controller is just a normal function with *one* rule: it must return a Symfony
``Response`` object. But that response can contain anything: simple text, JSON or
a full HTML page.

But the routing system is *much* more powerful. So let's make the route more interesting:
But the routing system is *much* more powerful. Let's make the route more interesting:

.. code-block:: diff
Expand Down Expand Up @@ -135,7 +135,7 @@ Try the page out by going to ``http://localhost:8000/hello/Symfony``. You should
see: Hello Symfony! The value of the ``{name}`` in the URL is available as a ``$name``
argument in your controller.

But this can be even simpler! So let's install annotations support:
But this can be even simpler! Let's install annotations support:

.. code-block:: terminal
Expand Down
12 changes: 6 additions & 6 deletions routing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1098,9 +1098,9 @@ Parameter Conversion

A common routing need is to convert the value stored in some parameter (e.g. an
integer acting as the user ID) into another value (e.g. the object that
represents the user). This feature is called a "param converter".
represents the user). This feature is called a "parameter converter".

To add support for "param converters" we need SensioFrameworkExtraBundle:
To add support for "parameter converters" we need SensioFrameworkExtraBundle:

.. code-block:: terminal
Expand Down Expand Up @@ -1133,11 +1133,11 @@ controller action. Instead of ``string $slug``, add ``BlogPost $post``::
}

If your controller arguments include type-hints for objects (``BlogPost`` in
this case), the "param converter" makes a database request to find the object
this case), the "parameter converter" makes a database request to find the object
using the request parameters (``slug`` in this case). If no object is found,
Symfony generates a 404 response automatically.

Read the `full param converter documentation`_ to learn about the converters
Read the `full parameter converter documentation`_ to learn about the converters
provided by Symfony and how to configure them.

Special Parameters
Expand Down Expand Up @@ -2635,7 +2635,7 @@ use the ``generateUrl()`` helper::
.. caution::

While objects are converted to string when used as placeholders, they are not
converted when used as extra parameters. So, if you're passing an object (e.g. an Uuid)
converted when used as extra parameters. If you're passing an object (e.g. an UUID)
as value of an extra parameter, you need to explicitly convert it to a string::

$this->generateUrl('blog', ['uuid' => (string) $entity->getUuid()]);
Expand Down Expand Up @@ -3067,5 +3067,5 @@ Learn more about Routing

.. _`PHP regular expressions`: https://www.php.net/manual/en/book.pcre.php
.. _`PCRE Unicode properties`: https://www.php.net/manual/en/regexp.reference.unicode.php
.. _`full param converter documentation`: https://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/converters.html
.. _`full parameter converter documentation`: https://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/converters.html
.. _`FOSJsRoutingBundle`: https://github.com/FriendsOfSymfony/FOSJsRoutingBundle
4 changes: 2 additions & 2 deletions setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ to run this command which displays information about the project:
Running Symfony Applications
----------------------------

In production, you should install a web server like Nginx or Apache and
In production, you should install a web server like nginx or Apache and
:doc:`configure it to run Symfony </setup/web_server_configuration>`. This
method can also be used if you're not using the Symfony local web server for
development.
Expand Down Expand Up @@ -211,7 +211,7 @@ Symfony Packs

Sometimes a single feature requires installing several packages and bundles.
Instead of installing them individually, Symfony provides **packs**, which are
Composer metapackages that include several dependencies.
Composer meta-packages that include several dependencies.

For example, to add debugging features in your application, you can run the
``composer require --dev debug`` command. This installs the ``symfony/debug-pack``,
Expand Down
4 changes: 2 additions & 2 deletions templates.rst
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ Build, Versioning & More Advanced CSS, JavaScript and Image Handling
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

For help building, versioning and minifying your JavaScript and
CSS assets in a modern way, read about :doc:`Symfony's Webpack Encore </frontend>`.
CSS assets in a modern way, read about :doc:`Symfony's webpack Encore </frontend>`.

.. _twig-app-variable:

Expand Down Expand Up @@ -1034,7 +1034,7 @@ JavaScript library.

First, include the `hinclude.js`_ library in your page
:ref:`linking to it <templates-link-to-assets>` from the template or adding it
to your application JavaScript :doc:`using Webpack Encore </frontend>`.
to your application JavaScript :doc:`using webpack Encore </frontend>`.

As the embedded content comes from another page (or controller for that matter),
Symfony uses a version of the standard ``render()`` function to configure
Expand Down

0 comments on commit ac3b26b

Please sign in to comment.