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

Use proper types in tests #2081

Merged
merged 1 commit into from
Jun 21, 2022
Merged

Use proper types in tests #2081

merged 1 commit into from
Jun 21, 2022

Conversation

franmomu
Copy link
Contributor

This PR tries to fix some PHPStan findings in level 5, in this case about calling some method with wrong types.

/**
* Treats missing data as if the bucket does not exist. It will skip the bucket and continue calculating using the next available value.
*/
public const SKIP = 'skip';
/**
* Will replace missing values with a zero (0) and pipeline aggregation computation will proceed as normal.
*/
public const INSERT_ZEROS = 'insert_zeros';
/**
* Is similar to skip, except if the metric provides a non-null, non-NaN value this value is used, otherwise the empty bucket is skipped.
*/
public const KEEP_VALUES = 'keep_values';
/**
* Set the gap policy for this aggregation.
*
* @return $this
*/
public function setGapPolicy(string $gapPolicy);

setGapPolicy expects a string which is one of the policies.

public function setDocAsUpsert(bool $value): self

Document:: setDocAsUpsert() expects a bool

/**
* @param int $port
*
* @return $this
*/
public function setPort($port)
{
return $this->setParam('port', (int) $port);

Connection::setPort() expects an int and also the default value (9200) is stored as int, internally it casts the value to int, but IMO we should stick to int since it represents a port.

@ruflin ruflin merged commit c4e2fbb into ruflin:master Jun 21, 2022
@franmomu franmomu deleted the use_proper_types branch June 21, 2022 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants