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

Proposal to rename StopwordArray class to StopwordsArray #40

Open
Donatello-za opened this issue Feb 8, 2025 · 4 comments
Open

Proposal to rename StopwordArray class to StopwordsArray #40

Donatello-za opened this issue Feb 8, 2025 · 4 comments
Assignees
Labels

Comments

@Donatello-za
Copy link
Owner

A question was asked by @kudashevs asking why the StopwordArray provider class is in singular form, where the rest of the Stopword classes are all plural, e.g. StopwordsPatternFile and StopwordsPHP.

This was simply a poor decision on my side back when I initially created the library. This is the proposed solutions to make it consistent:

  1. Create a new child class that extends StopwordArray and call it StopwordsArray, thereby creating an alias for it. The advantage of this is that if a user already uses StopwordArray there will be no impact as only one class will still be loaded.
  • or the reverse -
  1. Rename the StopwordArray array class to StopwordsArray, then create a new "alias" class called StopwordArray that extends StopwordsArray and that will simply act as a backwards compatibility implementation.

The documentation will be changed to specifically use StopwordsArray instead of StopwordArray. I'm personally leaning towards option 2.

@kudashevs
Copy link
Contributor

kudashevs commented Feb 8, 2025

In my opinion you can just rename StopwordArray to StopwordsArray class.
Because 2.0.0 is going to introduce breaking changes, you are free to change the structure, class names, etc.

In addition, you can mark StopwordArray class as deprecated. This tag informs users that something will be removed in the future.

And, I would recommend moving these three classes and the abstract class into a different folder (Providers or something similar). They definitely represent an abstraction (that retrieves words from different files/sources) and should be together.

@Donatello-za
Copy link
Owner Author

In my opinion you can just rename StopwordArray to StopwordsArray class.
Because 2.0.0 is going to introduce breaking changes, you are free to change the structure, class names, etc

I personally did not really want to introduce breaking changes to the API. The reason is that I actually want to be able to keep updating the v1 branch with additional languages as they are introduced and it is going to cause issues in the documentation. That being said, I'm not 100% decided yet, give me a day or so to finalise my decision. See my thoughts at the end...

In addition, you can mark StopwordArray class as deprecated. This tag informs users that something will be removed in the future.

If we rename StopwordArray to StopwordsArray and introduce a deprecated class called StopwordArray it would be good if we decide to not make any other breaking changes.

And, I would recommend moving these three classes and the abstract class into a different folder (Providers or something similar). They definitely represent an abstraction (that retrieves words from different files/sources) and should be together.

I agree with this, good idea but it is again going to cause backwards compatibility issues. I need to make a decision whether to make breaking changes now or later.

Let me quickly explain what my thoughts are:

  1. Just go ahead and make breaking changes as v1 users will just continue v1 if they installed it using ^1.0 version constraint.
  2. However, I wanted to keep adding languages to v1 for people who can't upgrade their version of PHP. Making breaking changes will cause differences in old and new versions of the documentation and may cause confusion.

My plight is for people who are stuck with a particular PHP version as I am myself in the same situation having to maintain old PHP software on old servers which I have no control over.

@Donatello-za
Copy link
Owner Author

I've finalised my decision on this and have decided we should go ahead with making the breaking change by renaming StopwordArray to StopwordsArray. This also includes moving the Stopwords*.php and AbstractStopwordProvider.php files into a sub folder but I will create a new issue for it.

@kudashevs
Copy link
Contributor

Yeah, almost done 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants