Naming interfaces


(Alexander Makarov) #1

Yii 1.1 interface naming convention was IName. Yii 2 was NameInterface. With Yii 3 I have experimented with interface naming by removing Interface suffix getting names such as ErrorRenderer.

What do you think about the experiment?

Do you prefer everything to have Interface suffix or not?

  • I prefer NameInterface names with suffix
  • I prefer names without suffix

0 voters


(Bizley) #2

Isn’t it written in PSR Naming Conventions that interface class must be suffixed by Interface?


#3

This is only internal documentation, it only affects PHP-FIG packages.


(Alexander Makarov) #4

I confirm that PSR naming conventions is internal document to agree on styling on how PSR documents themselves are written. That is not a coding starndard that is meant to be applied to projects.


(Alexander Makarov) #5

Here’s an article describing rationale behind the experiment: https://mnapoli.fr/approaching-coding-style-rationally/


(Alexander Makarov) #6

OK. Based on voting here and at the Russian community forums

Note that it could be adjusted before release.