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

[bug]: Use enums #748

Open
magicsunday opened this issue Mar 4, 2025 · 1 comment
Open

[bug]: Use enums #748

magicsunday opened this issue Mar 4, 2025 · 1 comment

Comments

@magicsunday
Copy link

magicsunday commented Mar 4, 2025

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

@Fluf22
Copy link
Contributor

Fluf22 commented Mar 4, 2025

Hey @magicsunday 👋🏻
You're right it would be cleaner. I'll look into that.
In the meantime, if you feel like it's okay, you can use:

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

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

No branches or pull requests

2 participants