0

How would you share constants between two bases classes?

Traits don't allow constants and that was my first instinct. I don't want to define them on the config files because they're not meant to be shared by the whole application.

Bernardo
  • 475
  • 1
  • 5
  • 19

1 Answers1

1

For this particular solution I ended up creating an Interface with the constants and implementing it on the base classes that needed them.

Look at this question for a reference:

PHP Traits - defining generic constants

Community
  • 1
  • 1
Bernardo
  • 475
  • 1
  • 5
  • 19