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

Constructors in interfaces #11410

Closed
Jurigag opened this issue Feb 15, 2016 · 2 comments
Closed

Constructors in interfaces #11410

Jurigag opened this issue Feb 15, 2016 · 2 comments

Comments

@Jurigag
Copy link
Contributor

Jurigag commented Feb 15, 2016

Any logical reason for some interfaces have __construct methods ? We cant create objects from interfaces, it's just a contract.

I think we should split constructors from interfaces and create maybe abstract classes with __onconstruct definition which implement those interfaces.

For example - thats why i needed to create so simple interfaces RoleAware and ResourceAware beacause RoleInterface and ResourceInterface have __construct methods, and then you cant have for example class extending Model and RoleInterface.

I know its php, but i think there shouldn't be constructors in interfaces, well i think even magic methods should go away.

Well i know its not thing for change for any minor version. But it's thing to consider in next major version(3.x).

@valVk
Copy link

valVk commented Feb 23, 2016

Just for reference.

roleinterface.zep

resourceinterface.zep

Interfaces do not must have constructors.

@sergeyklay
Copy link
Contributor

Fixed in 2.1.x branch

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

3 participants