Skip to content

Commit 66cba2c

Browse files
greg0irederrabus
andauthored
Apply suggestions from code review
Co-authored-by: Alexander M. Turek <me@derrabus.de>
1 parent 4eb9289 commit 66cba2c

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

docs/en/cookbook/decorator-pattern.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -167,14 +167,14 @@ of the getSpecial() method to its return value.
167167
{
168168
169169
#[Column(type: 'string', nullable: true)]
170-
protected $special;
170+
protected string|null $special = null;
171171
172-
public function setSpecial(string $special): void
172+
public function setSpecial(string|null $special): void
173173
{
174174
$this->special = $special;
175175
}
176176
177-
public function getSpecial(): string
177+
public function getSpecial(): string|null
178178
{
179179
return $this->special;
180180
}

docs/en/tutorials/composite-primary-keys.rst

+8-7
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ and year of production as primary keys:
3333
{
3434
public function __construct(
3535
#[Id, Column(type: 'string')]
36-
string $name,
36+
private string $name,
3737
#[Id, Column(type: 'integer')]
38-
int $year,
38+
private int $year,
3939
) {
4040
}
4141
@@ -235,14 +235,14 @@ One good example for this is a user-address relationship:
235235
class User
236236
{
237237
#[Id, Column(type: 'integer'), GeneratedValue]
238-
private $id;
238+
private int|null $id = null;
239239
}
240240
241241
#[Entity]
242242
class Address
243243
{
244244
#[Id, OneToOne(targetEntity: User::class)]
245-
private $user;
245+
private User|null $user = null;
246246
}
247247
248248
.. code-block:: yaml
@@ -299,9 +299,10 @@ of products purchased and maybe even the current price.
299299
#[Column(type: 'datetime')]
300300
private DateTime $created;
301301
302-
public function __construct(Customer $customer)
303-
{
304-
$this->customer = $customer;
302+
public function __construct(
303+
#[ManyToOne(targetEntity: Customer::class)]
304+
private Customer $customer,
305+
) {
305306
$this->items = new ArrayCollection();
306307
$this->created = new DateTime("now");
307308
}

docs/en/tutorials/ordered-associations.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ can specify the ``@OrderBy`` in the following way:
2222
{
2323
// ...
2424
25-
#[ManyToMany(targetEntity: "Group")]
25+
#[ManyToMany(targetEntity: Group::class)]
2626
#[OrderBy(["name" => "ASC"])]
27-
private $groups;
27+
private Collection $groups;
2828
}
2929
3030
.. code-block:: xml

0 commit comments

Comments
 (0)