I noticed that you can’t have abstract constants in PHP.
Is there a way I can force a child class to define a constant (which I need to use in one of the abstract class internal methods) ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
A
constantis aconstant; there is noabstractorprivateconstants in PHP as far as I know, but you can have a work around:Sample Abstract Class
This would run fine
Bar would return Error
Songo would return Error
Enforcer Class