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

Add null to some PHPDoc types #2070

Merged
merged 4 commits into from
Jun 3, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Removed `egeloen/http-adapter` as suggested package since the project is abandoned by @franmomu [#2069](https://github.com/ruflin/Elastica/pull/2069)
* Removed `0` as valid request data using Analyze API by @franmomu [#2068](https://github.com/ruflin/Elastica/pull/2068)
### Fixed
* Fixed some PHPDoc types adding `null` as possible value by @franmomu [#2070](https://github.com/ruflin/Elastica/pull/2070)
### Security

## [7.1.5](https://github.com/ruflin/Elastica/compare/7.1.5...7.1.4)
Expand Down
6 changes: 3 additions & 3 deletions src/AbstractUpdateAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -307,9 +307,9 @@ public function hasRetryOnConflict()
*/
public function setRefresh($refresh = true)
{
\is_bool($refresh) && $refresh = $refresh
? Reindex::REFRESH_TRUE
: Reindex::REFRESH_FALSE;
if (\is_bool($refresh)) {
$refresh = $refresh ? Reindex::REFRESH_TRUE : Reindex::REFRESH_FALSE;
thePanz marked this conversation as resolved.
Show resolved Hide resolved
}

return $this->setParam(Reindex::REFRESH, $refresh);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -341,15 +341,15 @@ public static function create($params = [])
}

/**
* @return string User
* @return string|null User
*/
public function getUsername()
{
return $this->hasParam('username') ? $this->getParam('username') : null;
}

/**
* @return string Password
* @return string|null Password
*/
public function getPassword()
{
Expand Down
4 changes: 2 additions & 2 deletions src/Query/AbstractGeoDistance.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ abstract class AbstractGeoDistance extends AbstractQuery
/**
* Latitude.
*
* @var float
* @var float|null
*/
protected $_latitude;

/**
* Longitude.
*
* @var float
* @var float|null
*/
protected $_longitude;

Expand Down
4 changes: 3 additions & 1 deletion src/Reindex.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ public function run(): Response

public function setWaitForCompletion($value): void
{
\is_bool($value) && $value = $value ? 'true' : 'false';
if (\is_bool($value)) {
$value = $value ? 'true' : 'false';
thePanz marked this conversation as resolved.
Show resolved Hide resolved
}
thePanz marked this conversation as resolved.
Show resolved Hide resolved

$this->setParam(self::WAIT_FOR_COMPLETION, $value);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Request extends Param
public const NDJSON_CONTENT_TYPE = 'application/x-ndjson';

/**
* @var Connection
* @var Connection|null
*/
protected $_connection;

Expand Down
2 changes: 1 addition & 1 deletion src/Transport/NullTransport.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class NullTransport extends AbstractTransport
/**
* Response you want to get from the transport.
*
* @var Response Response
* @var Response|null Response
*/
protected $_response;

Expand Down