Skip to content

Commit cccb2e2

Browse files
authored
Docs: use canonical order for phpdoc tags, add missed semicolon (#9190)
1 parent 18138d8 commit cccb2e2

File tree

5 files changed

+38
-40
lines changed

5 files changed

+38
-40
lines changed

docs/en/cookbook/advanced-field-value-conversion-using-custom-mapping-types.rst

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Advanced field value conversion using custom mapping types
44
.. sectionauthor:: Jan Sorgalla <[email protected]>
55

66
When creating entities, you sometimes have the need to transform field values
7-
before they are saved to the database. In Doctrine you can use Custom Mapping
7+
before they are saved to the database. In Doctrine you can use Custom Mapping
88
Types to solve this (see: :ref:`reference-basic-mapping-custom-mapping-types`).
99

1010
There are several ways to achieve this: converting the value inside the Type
@@ -15,7 +15,7 @@ type `Point <https://dev.mysql.com/doc/refman/8.0/en/gis-class-point.html>`_.
1515

1616
The ``Point`` type is part of the `Spatial extension <https://dev.mysql.com/doc/refman/8.0/en/spatial-extensions.html>`_
1717
of MySQL and enables you to store a single location in a coordinate space by
18-
using x and y coordinates. You can use the Point type to store a
18+
using x and y coordinates. You can use the Point type to store a
1919
longitude/latitude pair to represent a geographic location.
2020

2121
The entity
@@ -29,9 +29,9 @@ The entity class:
2929
.. code-block:: php
3030
3131
<?php
32-
32+
3333
namespace Geo\Entity;
34-
34+
3535
/**
3636
* @Entity
3737
*/
@@ -84,15 +84,15 @@ The entity class:
8484
}
8585
}
8686
87-
We use the custom type ``point`` in the ``@Column`` docblock annotation of the
87+
We use the custom type ``point`` in the ``@Column`` docblock annotation of the
8888
``$point`` field. We will create this custom mapping type in the next chapter.
8989

9090
The point class:
9191

9292
.. code-block:: php
9393
9494
<?php
95-
95+
9696
namespace Geo\ValueObject;
9797
9898
class Point
@@ -196,7 +196,7 @@ The format of the string representation format is called
196196
`Well-known text (WKT) <https://en.wikipedia.org/wiki/Well-known_text>`_.
197197
The advantage of this format is, that it is both human readable and parsable by MySQL.
198198

199-
Internally, MySQL stores geometry values in a binary format that is not
199+
Internally, MySQL stores geometry values in a binary format that is not
200200
identical to the WKT format. So, we need to let MySQL transform the WKT
201201
representation into its internal format.
202202

@@ -210,13 +210,13 @@ which convert WKT strings to and from the internal format of MySQL.
210210

211211
.. note::
212212

213-
When using DQL queries, the ``convertToPHPValueSQL`` and
213+
When using DQL queries, the ``convertToPHPValueSQL`` and
214214
``convertToDatabaseValueSQL`` methods only apply to identification variables
215-
and path expressions in SELECT clauses. Expressions in WHERE clauses are
215+
and path expressions in SELECT clauses. Expressions in WHERE clauses are
216216
**not** wrapped!
217217

218218
If you want to use Point values in WHERE clauses, you have to implement a
219-
:doc:`user defined function <dql-user-defined-functions>` for
219+
:doc:`user defined function <dql-user-defined-functions>` for
220220
``PointFromText``.
221221

222222
Example usage
@@ -252,5 +252,5 @@ Example usage
252252
$query = $em->createQuery("SELECT l FROM Geo\Entity\Location l WHERE l.address = '1600 Amphitheatre Parkway, Mountain View, CA'");
253253
$location = $query->getSingleResult();
254254
255-
/* @var Geo\ValueObject\Point */
255+
/** @var Geo\ValueObject\Point */
256256
$point = $location->getPoint();

docs/en/cookbook/dql-custom-walkers.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ API would look for this use-case:
8888
$pageNum = 1;
8989
$query = $em->createQuery($dql);
9090
$query->setFirstResult( ($pageNum-1) * 20)->setMaxResults(20);
91-
91+
9292
$totalResults = Paginate::count($query);
9393
$results = $query->getResult();
9494
@@ -101,12 +101,12 @@ The ``Paginate::count(Query $query)`` looks like:
101101
{
102102
static public function count(Query $query)
103103
{
104-
/* @var $countQuery Query */
104+
/** @var Query $countQuery */
105105
$countQuery = clone $query;
106-
106+
107107
$countQuery->setHint(Query::HINT_CUSTOM_TREE_WALKERS, array('DoctrineExtensions\Paginate\CountSqlWalker'));
108108
$countQuery->setFirstResult(null)->setMaxResults(null);
109-
109+
110110
return $countQuery->getSingleScalarResult();
111111
}
112112
}
@@ -137,13 +137,13 @@ implementation is:
137137
break;
138138
}
139139
}
140-
140+
141141
$pathExpression = new PathExpression(
142142
PathExpression::TYPE_STATE_FIELD | PathExpression::TYPE_SINGLE_VALUED_ASSOCIATION, $parentName,
143143
$parent['metadata']->getSingleIdentifierFieldName()
144144
);
145145
$pathExpression->type = PathExpression::TYPE_STATE_FIELD;
146-
146+
147147
$AST->selectClause->selectExpressions = array(
148148
new SelectExpression(
149149
new AggregateExpression('count', $pathExpression, true), null
@@ -196,15 +196,15 @@ modify the generation of the SELECT clause, adding the
196196
public function walkSelectClause($selectClause)
197197
{
198198
$sql = parent::walkSelectClause($selectClause);
199-
199+
200200
if ($this->getQuery()->getHint('mysqlWalker.sqlNoCache') === true) {
201201
if ($selectClause->isDistinct) {
202202
$sql = str_replace('SELECT DISTINCT', 'SELECT DISTINCT SQL_NO_CACHE', $sql);
203203
} else {
204204
$sql = str_replace('SELECT', 'SELECT SQL_NO_CACHE', $sql);
205205
}
206206
}
207-
207+
208208
return $sql;
209209
}
210210
}

docs/en/cookbook/dql-user-defined-functions.rst

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ configuration:
4545
$config->addCustomStringFunction($name, $class);
4646
$config->addCustomNumericFunction($name, $class);
4747
$config->addCustomDatetimeFunction($name, $class);
48-
48+
4949
$em = EntityManager::create($dbParams, $config);
5050
5151
The ``$name`` is the name the function will be referred to in the
@@ -96,7 +96,7 @@ discuss it step by step:
9696
// (1)
9797
public $firstDateExpression = null;
9898
public $secondDateExpression = null;
99-
99+
100100
public function parse(\Doctrine\ORM\Query\Parser $parser)
101101
{
102102
$parser->match(Lexer::T_IDENTIFIER); // (2)
@@ -106,7 +106,7 @@ discuss it step by step:
106106
$this->secondDateExpression = $parser->ArithmeticPrimary(); // (6)
107107
$parser->match(Lexer::T_CLOSE_PARENTHESIS); // (3)
108108
}
109-
109+
110110
public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
111111
{
112112
return 'DATEDIFF(' .
@@ -180,28 +180,28 @@ I'll skip the blah and show the code for this function:
180180
public $firstDateExpression = null;
181181
public $intervalExpression = null;
182182
public $unit = null;
183-
183+
184184
public function parse(\Doctrine\ORM\Query\Parser $parser)
185185
{
186186
$parser->match(Lexer::T_IDENTIFIER);
187187
$parser->match(Lexer::T_OPEN_PARENTHESIS);
188-
188+
189189
$this->firstDateExpression = $parser->ArithmeticPrimary();
190-
190+
191191
$parser->match(Lexer::T_COMMA);
192192
$parser->match(Lexer::T_IDENTIFIER);
193-
193+
194194
$this->intervalExpression = $parser->ArithmeticPrimary();
195-
195+
196196
$parser->match(Lexer::T_IDENTIFIER);
197-
198-
/* @var $lexer Lexer */
197+
198+
/** @var Lexer $lexer */
199199
$lexer = $parser->getLexer();
200200
$this->unit = $lexer->token['value'];
201-
201+
202202
$parser->match(Lexer::T_CLOSE_PARENTHESIS);
203203
}
204-
204+
205205
public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
206206
{
207207
return 'DATE_ADD(' .

docs/en/reference/second-level-cache.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ By providing a cache logger you should be able to get information about all cach
231231
.. code-block:: php
232232
233233
<?php
234-
/* @var $config \Doctrine\ORM\Configuration */
234+
/** @var \Doctrine\ORM\Configuration $config */
235235
$logger = new \Doctrine\ORM\Cache\Logging\StatisticsCacheLogger();
236236
237237
// Cache logger
@@ -533,7 +533,7 @@ The query cache stores the results of the query but as identifiers, entity value
533533
.. code-block:: php
534534
535535
<?php
536-
/* @var $em \Doctrine\ORM\EntityManager */
536+
/** @var \Doctrine\ORM\EntityManager $em */
537537
538538
// Execute database query, store query cache and entity cache
539539
$result1 = $em->createQuery('SELECT c FROM Country c ORDER BY c.name')
@@ -560,7 +560,7 @@ The Cache Mode controls how a particular query interacts with the second-level c
560560
.. code-block:: php
561561
562562
<?php
563-
/* @var $em \Doctrine\ORM\EntityManager */
563+
/** @var \Doctrine\ORM\EntityManager $em */
564564
// Will refresh the query cache and all entities the cache as it reads from the database.
565565
$result1 = $em->createQuery('SELECT c FROM Country c ORDER BY c.name')
566566
->setCacheMode(\Doctrine\ORM\Cache::MODE_GET)
@@ -649,7 +649,7 @@ However, you can use the cache API to check / invalidate cache entries.
649649
.. code-block:: php
650650
651651
<?php
652-
/* @var $cache \Doctrine\ORM\Cache */
652+
/** @var \Doctrine\ORM\Cache $cache */
653653
$cache = $em->getCache();
654654
655655
$cache->containsEntity('Entity\State', 1) // Check if the cache exists
@@ -694,11 +694,11 @@ For performance reasons the cache API does not extract from composite primary ke
694694
}
695695
696696
// Supported
697-
/* @var $article Article */
697+
/** @var Article $article */
698698
$article = $em->find('Article', 1);
699699
700700
// Supported
701-
/* @var $article Article */
701+
/** @var Article $article */
702702
$article = $em->find('Article', $article);
703703
704704
// Supported

tests/Doctrine/Tests/ORM/Functional/SecondLevelCacheManyToOneTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,7 @@ public function testPutAndLoadNonCacheableCompositeManyToOne(): void
239239
self::assertFalse($this->cache->containsEntity(Action::class, $action3->name));
240240

241241
$queryCount = $this->getCurrentQueryCount();
242-
/**
243-
* @var $entity Token
244-
*/
242+
245243
$entity = $this->_em->find(Token::class, $token->token);
246244

247245
self::assertInstanceOf(Token::class, $entity);

0 commit comments

Comments
 (0)