Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed QueryBuilder type hints #3439

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions lib/Doctrine/DBAL/Query/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,14 @@ class QueryBuilder
/**
* The index of the first result to retrieve.
*
* @var int
* @var int|null
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not supposed to be nullable. The "non specified" first result is the same as 0.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default value of property this is null, init value is not set in constructor, so it should be marked as nullable.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default value should be 0, not null unless it breaks some existing API contract.

*/
private $firstResult = null;

/**
* The maximum number of results to retrieve.
*
* @var int
* @var int|null
*/
private $maxResults = null;

Expand Down Expand Up @@ -347,7 +347,7 @@ public function getParameterType($key)
/**
* Sets the position of the first result to retrieve (the "offset").
*
* @param int $firstResult The first result to return.
* @param int|null $firstResult The first result to return.
*
* @return $this This QueryBuilder instance.
*/
Expand All @@ -363,7 +363,7 @@ public function setFirstResult($firstResult)
* Gets the position of the first result the query object was set to retrieve (the "offset").
* Returns NULL if {@link setFirstResult} was not applied to this QueryBuilder.
*
* @return int The position of the first result.
* @return int|null The position of the first result.
*/
public function getFirstResult()
{
Expand All @@ -373,7 +373,7 @@ public function getFirstResult()
/**
* Sets the maximum number of results to retrieve (the "limit").
*
* @param int $maxResults The maximum number of results to retrieve.
* @param int|null $maxResults The maximum number of results to retrieve.
*
* @return $this This QueryBuilder instance.
*/
Expand All @@ -389,7 +389,7 @@ public function setMaxResults($maxResults)
* Gets the maximum number of results the query object was set to retrieve (the "limit").
* Returns NULL if {@link setMaxResults} was not applied to this query builder.
*
* @return int The maximum number of results.
* @return int|null The maximum number of results.
*/
public function getMaxResults()
{
Expand Down