algolia / algolia/algoliasearch-client-php

[bug]: Use enums

Open
#748 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
697
Forks
112
PR merge metrics
No merged PRs in 30d

Description

### Description

Use enums (https://www.php.net/manual/en/language.types.enumerations.php) wherever possible, e.g. in OperationType. The `setOperation` method of `OperationIndexParams `expects a parameter of type `OperationType`, but `MOVE` and `COPY` are currently defined as a string, so calling

```
(new OperationIndexParams())
->setOperation(OperationType::MOVE)
```

generates the warning `Expected parameter of type '\Algolia\AlgoliaSearch\Model\Search\OperationType', 'string' provided`.

### Client

All

### Version

4.15.0

Contributor guide

No contributing guide indexed for this repository

Research direction

Inspect the OperationType definition and the setOperation method on OperationIndexParams, then reproduce the warning with the example call in the issue. The work is done when MOVE and COPY are represented as OperationType values and the call no longer reports a string type mismatch.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.