cocur / slugify

Converts a string to a slug. Includes integrations for Symfony, Silex, Laravel, Zend Framework 2, Twig, Nette and Latte.
MIT License
2.89k stars 252 forks source link

Update SlugifyInterface.php #273

Closed ThomasLandauer closed 3 years ago

ThomasLandauer commented 4 years ago

When injecting the library with typehint Cocur\Slugify\SlugifyInterface (as recommended in README), I'm getting this error from PhpStan when I do $this->slugify->addRule(...);:

Call to an undefined method Cocur\Slugify\SlugifyInterface::addRule()

This PR fixes it, but I guess the other methods of Slugify (activateRuleSet() etc.) should be added too?

OskarStark commented 4 years ago

Adding a method to an interface is a Bc break. It can only be done via an @method annotation in the interface in the stable version and a deprecation and then adding it to the interface as a real method in the next major.

florianeckerstorfer commented 3 years ago

@ThomasLandauer The methods were left out of SlugifyInterface to keep the interface as stable as possible and avoid BC breaks. If you implementation requires using the additional methods from the Slugify class you should type directly against Slugify

ThomasLandauer commented 3 years ago

Well, OK, then I'm closing this...