K
K
knowledge2018-06-30 12:54:00
PHP
knowledge, 2018-06-30 12:54:00

Does it make sense to create a root class with a description of magic properties in PHP?

I will have many classes, inheritance, etc.
How much does it make sense to create a Core or Base class, in which such properties as
__set
__get
__wakeup, etc., etc. would be described,
this class will already inherit all the rest
, the point is to make the description of all these methods once in the project

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
BoShurik, 2018-06-30
@knowledge

If the project uses magic methods, then, IMHO, something is wrong with the architecture
Well, about inheritance: you most likely do not need it https://en.wikipedia.org/wiki/Composition_over_inh...
The problem of the approach is that when you really have to inherit from some class, you will not be able to, because there will already be inheritance from the base class, and multiple inheritance in php has not been delivered

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question