Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b74be85

Browse filesBrowse files
committed
Merge branch '2.7' into 2.8
* 2.7: Use gender-neutral language in the main Serializer article [symfony#9497] fix typo Removed the term "simple" from creating a new page Update datetime.rst components/phpunit_bridge.rst Add best practice note about version Use is_numeric() [Console] Fix SymfonyStyle::ask usage Update BC policy to tell about adding/removing return types
2 parents 8871e5c + 7328eec commit b74be85
Copy full SHA for b74be85

File tree

7 files changed

+48
-27
lines changed
Filter options

7 files changed

+48
-27
lines changed

‎components/phpunit_bridge.rst

Copy file name to clipboardExpand all lines: components/phpunit_bridge.rst
+8-1Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,19 @@ Installation
2929

3030
.. code-block:: terminal
3131
32-
$ composer require symfony/phpunit-bridge
32+
$ composer require --dev "symfony/phpunit-bridge:*"
3333
3434
Alternatively, you can clone the `<https://github.com/symfony/phpunit-bridge>`_ repository.
3535

3636
.. include:: /components/require_autoload.rst.inc
3737

38+
.. note::
39+
40+
The PHPUnit bridge is designed to work with all maintained versions of
41+
Symfony components, even across different major versions of them. You should
42+
always use its very latest stable major version to get the most accurate
43+
deprecation report.
44+
3845
Usage
3946
-----
4047

‎components/serializer.rst

Copy file name to clipboardExpand all lines: components/serializer.rst
+20-20Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ simple schema.
1616

1717
.. image:: /_images/components/serializer/serializer_workflow.png
1818

19-
As you can see in the picture above, an array is used as a man in
20-
the middle. This way, Encoders will only deal with turning specific
21-
**formats** into **arrays** and vice versa. The same way, Normalizers
19+
As you can see in the picture above, an array is used as an intermediary between
20+
objects and serialized contents. This way, encoders will only deal with turning
21+
specific **formats** into **arrays** and vice versa. The same way, Normalizers
2222
will deal with turning specific **objects** into **arrays** and vice versa.
2323

2424
Serialization is a complex topic. This component may not cover all your use cases out of the box,
@@ -66,13 +66,13 @@ Serializing an Object
6666
For the sake of this example, assume the following class already
6767
exists in your project::
6868

69-
namespace Acme;
69+
namespace App\Model;
7070

7171
class Person
7272
{
7373
private $age;
7474
private $name;
75-
private $sportsman;
75+
private $sportsperson;
7676
private $createdAt;
7777

7878
// Getters
@@ -92,9 +92,9 @@ exists in your project::
9292
}
9393

9494
// Issers
95-
public function isSportsman()
95+
public function isSportsperson()
9696
{
97-
return $this->sportsman;
97+
return $this->sportsperson;
9898
}
9999

100100
// Setters
@@ -108,9 +108,9 @@ exists in your project::
108108
$this->age = $age;
109109
}
110110

111-
public function setSportsman($sportsman)
111+
public function setSportsperson($sportsperson)
112112
{
113-
$this->sportsman = $sportsman;
113+
$this->sportsperson = $sportsperson;
114114
}
115115

116116
public function setCreatedAt($createdAt)
@@ -122,14 +122,14 @@ exists in your project::
122122
Now, if you want to serialize this object into JSON, you only need to
123123
use the Serializer service created before::
124124

125-
$person = new Acme\Person();
125+
$person = new App\Model\Person();
126126
$person->setName('foo');
127127
$person->setAge(99);
128-
$person->setSportsman(false);
128+
$person->setSportsperson(false);
129129

130130
$jsonContent = $serializer->serialize($person, 'json');
131131

132-
// $jsonContent contains {"name":"foo","age":99,"sportsman":false}
132+
// $jsonContent contains {"name":"foo","age":99,"sportsperson":false}
133133

134134
echo $jsonContent; // or return it in a Response
135135

@@ -143,13 +143,13 @@ Deserializing an Object
143143
You'll now learn how to do the exact opposite. This time, the information
144144
of the ``Person`` class would be encoded in XML format::
145145

146-
use Acme\Person;
146+
use App\Model\Person;
147147

148148
$data = <<<EOF
149149
<person>
150150
<name>foo</name>
151151
<age>99</age>
152-
<sportsman>false</sportsman>
152+
<sportsperson>false</sportsperson>
153153
</person>
154154
EOF;
155155

@@ -171,7 +171,7 @@ The serializer can also be used to update an existing object::
171171
$person = new Person();
172172
$person->setName('bar');
173173
$person->setAge(99);
174-
$person->setSportsman(true);
174+
$person->setSportsperson(true);
175175

176176
$data = <<<EOF
177177
<person>
@@ -181,7 +181,7 @@ The serializer can also be used to update an existing object::
181181
EOF;
182182

183183
$serializer->deserialize($data, Person::class, 'xml', array('object_to_populate' => $person));
184-
// $person = Acme\Person(name: 'foo', age: '69', sportsman: true)
184+
// $person = App\Model\Person(name: 'foo', age: '69', sportsperson: true)
185185

186186
This is a common need when working with an ORM.
187187

@@ -356,7 +356,7 @@ method on the normalizer definition::
356356
$encoder = new JsonEncoder();
357357

358358
$serializer = new Serializer(array($normalizer), array($encoder));
359-
$serializer->serialize($person, 'json'); // Output: {"name":"foo","sportsman":false}
359+
$serializer->serialize($person, 'json'); // Output: {"name":"foo","sportsperson":false}
360360

361361
.. _component-serializer-converting-property-names-when-serializing-and-deserializing:
362362

@@ -476,8 +476,8 @@ Serializing Boolean Attributes
476476
------------------------------
477477

478478
If you are using isser methods (methods prefixed by ``is``, like
479-
``Acme\Person::isSportsman()``), the Serializer component will automatically
480-
detect and use it to serialize related attributes.
479+
``App\Model\Person::isSportsperson()``), the Serializer component will
480+
automatically detect and use it to serialize related attributes.
481481

482482
The ``ObjectNormalizer`` also takes care of methods starting with ``has``, ``add``
483483
and ``remove``.
@@ -487,7 +487,7 @@ Using Callbacks to Serialize Properties with Object Instances
487487

488488
When serializing, you can set a callback to format a specific object property::
489489

490-
use Acme\Person;
490+
use App\Model\Person;
491491
use Symfony\Component\Serializer\Encoder\JsonEncoder;
492492
use Symfony\Component\Serializer\Normalizer\GetSetMethodNormalizer;
493493
use Symfony\Component\Serializer\Serializer;

‎console/style.rst

Copy file name to clipboardExpand all lines: console/style.rst
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,11 +238,11 @@ User Input Methods
238238
the third argument::
239239

240240
$io->ask('Number of workers to start', 1, function ($number) {
241-
if (!is_integer($number)) {
242-
throw new \RuntimeException('You must type an integer.');
241+
if (!is_numeric($number)) {
242+
throw new \RuntimeException('You must type a number.');
243243
}
244244

245-
return $number;
245+
return (int) $number;
246246
});
247247

248248
:method:`Symfony\\Component\\Console\\Style\\SymfonyStyle::askHidden`

‎contributing/code/bc.rst

Copy file name to clipboardExpand all lines: contributing/code/bc.rst
+12Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ backward compatibility promise:
7373
+-----------------------------------------------+-----------------------------+
7474
| Add a default value to an argument | Yes |
7575
+-----------------------------------------------+-----------------------------+
76+
| Add a return type to an implemented method | Yes |
77+
+-----------------------------------------------+-----------------------------+
7678

7779
Using our Classes
7880
~~~~~~~~~~~~~~~~~
@@ -164,6 +166,8 @@ Remove default value of an argument No
164166
Add type hint to an argument No
165167
Remove type hint of an argument No
166168
Change argument type No
169+
Add return type No
170+
Remove return type No [9]_
167171
Change return type No
168172
**Constants**
169173
Add constant Yes
@@ -220,6 +224,8 @@ Remove default value of an argument No
220224
Add type hint to an argument No [7]_ [8]_
221225
Remove type hint of an argument No [7]_ [8]_
222226
Change argument type No [7]_ [8]_
227+
Add return type No [7]_ [8]_
228+
Remove return type No [7]_ [8]_ [9]_
223229
Change return type No [7]_ [8]_
224230
**Protected Methods**
225231
Add protected method Yes
@@ -235,6 +241,8 @@ Remove default value of an argument No [7]_
235241
Add type hint to an argument No [7]_ [8]_
236242
Remove type hint of an argument No [7]_ [8]_
237243
Change argument type No [7]_ [8]_
244+
Add return type No [7]_ [8]_
245+
Remove return type No [7]_ [8]_ [9]_
238246
Change return type No [7]_ [8]_
239247
**Private Methods**
240248
Add private method Yes
@@ -248,6 +256,8 @@ Remove default value of an argument Yes
248256
Add type hint to an argument Yes
249257
Remove type hint of an argument Yes
250258
Change argument type Yes
259+
Add return type Yes
260+
Remove return type Yes
251261
Change return type Yes
252262
**Static Methods**
253263
Turn non static into static No [7]_ [8]_
@@ -291,6 +301,8 @@ Change value of a constant Yes [1]_ [5]_
291301
Changing an argument type is only possible with a parent type.
292302
Changing a return type is only possible with a child type.
293303
304+
.. [9] Allowed for the ``void`` return type.
305+
294306
.. _Semantic Versioning: https://semver.org/
295307
.. _scalar type: https://php.net/manual/en/function.is-scalar.php
296308
.. _boolean values: https://php.net/manual/en/function.boolval.php

‎contributing/code/core_team.rst

Copy file name to clipboardExpand all lines: contributing/code/core_team.rst
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ Active Core Members
9797
* **Tobias Nyholm** (`Nyholm`_) manages the official and contrib recipes
9898
repositories;
9999

100-
* **Samuel Rozé** (`sroze`_) can merge into Messenger_ component.
100+
* **Samuel Rozé** (`sroze`_) can merge into the Messenger_ component.
101101

102102
* **Deciders Team** (``@symfony/deciders`` on GitHub):
103103

‎page_creation.rst

Copy file name to clipboardExpand all lines: page_creation.rst
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Create your First Page in Symfony
88
=================================
99

1010
Creating a new page - whether it's an HTML page or a JSON endpoint - is a
11-
simple two-step process:
11+
two-step process:
1212

1313
#. **Create a route**: A route is the URL (e.g. ``/about``) to your page and
1414
points to a controller;

‎reference/forms/types/datetime.rst

Copy file name to clipboardExpand all lines: reference/forms/types/datetime.rst
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ If the ``widget`` option is set to ``single_text``, this option specifies
114114
the format of the input, i.e. how Symfony will interpret the given input
115115
as a datetime string. It defaults to the `RFC 3339`_ format which is used
116116
by the HTML5 ``datetime`` field. Keeping the default value will cause the
117-
field to be rendered as an ``input`` field with ``type="datetime"``.
117+
field to be rendered as an ``input`` field with ``type="datetime"``. For
118+
more information on valid formats, see `Date/Time Format Syntax`_.
118119

119120
.. include:: /reference/forms/types/options/hours.rst.inc
120121

@@ -221,3 +222,4 @@ Field Variables
221222
+----------+------------+----------------------------------------------------------------------+
222223

223224
.. _`RFC 3339`: https://tools.ietf.org/html/rfc3339
225+
.. _`Date/Time Format Syntax`: http://userguide.icu-project.org/formatparse/datetime#TOC-Date-Time-Format-Syntax

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.