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

Rename Meilisearch class to maintain autoload compatibility #441

Closed
wants to merge 1 commit into from

Conversation

n8man
Copy link

@n8man n8man commented Jan 5, 2023

#431 Renamed the namespace from MeiliSearch to Meilisearch, which isn't a problem because the Composer config was also updated to allow PSR-4 matching of both cases.

The problem is that the class MeiliSearch\MeiliSearch was also renamed to Meilisearch\Meilisearch, not just the namespace. This breaks Composer autoloading because Composer class-name matching is case-sensitive.

This PR fixes the name of this class in order to maintain compatibility.

If the renaming of the that class is both intentional and permanent:

  • the README should be updated with a notice
  • the version number should be incremented by at least a new point release (0.27.x) instead of sub-point (0.26.1 is not ideal to make a breaking change)

If you need a quick fix for laravel/scout or other projects, composer require meilisearch/meilisearch-php "0.26.0" should do the trick.

@driesvints
Copy link

I'd also very much opt to revert these changes as they're breaking. It's best that you only do this in a major release.

@norkunas
Copy link
Collaborator

norkunas commented Jan 6, 2023

class_alias could be used to provide compatibility

@brunoocasali
Copy link
Member

Hi @n8man, I'm sorry that renaming brings so many headaches for everyone in the community.

I would like to keep the current naming Meilisearch\Meilisearch.

I released it as a patch because PHP deals with those names case-insensitively without breaking, and it was not supposed to be breaking.

So, I'll release a new version, 0.27.0, and mark 0.26.1 as deprecated on packagist. I'll also put a notice in the release changelog for both versions explaining the new version.

Since many users are already using the new version 0.26.1 with laravel/scout @driesvints don't you think it will bring more breakings? But now for the people who already fixed the environment?

@driesvints
Copy link

Yeah a workaround now might be better

bors bot added a commit that referenced this pull request Jan 10, 2023
444: Update the version for the next release (v0.27.0) r=brunoocasali a=brunoocasali

Release a new version to mark the latest changes as **breaking**.

The previous release `v0.26.1` will be deprecated in the packagist.

Related information can be verified here #441, #431

Co-authored-by: Bruno Casali <brunoocasali@gmail.com>
@brunoocasali
Copy link
Member

Yeah a workaround now might be better

Released a new package version v0.27.0. Unfortunately, I didn't find a way to inform the users automatically by packagist, as I said before because this is a basic feature I can do in different stacks.

I'll also close this PR @n8man, thanks for the help it is very much appreciated.

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.

4 participants