title: Enforcing call to parent method
body: <p>Is there anyway (or a pattern) to enforce a call to a parent method?</p>
  
  <p>I have an abstract class like so:</p>
  
  <pre><code>abstract class APrimitive{
     public function validate(){
        //Do some stuff that applies all classes that extend APrimitive
     }
  }
  </code></pre>
  
  <p>Then I have classes that extend upon the APrimitive "base":</p>
  
  <pre><code>class CSophisticated extends APrimitive{
  
     public function validate(){
         //First call the parent version:
         parent::validate();
  
         //Then do something more sophisticated here.
     }
  }
  </code></pre>
  
  <p>The problem is that if we come back to the code in a few months time, and create a few more classes like CSophisticated with a <code>validate()</code> method, there is a possibility that we might forget to make a call to <code>parent::validate()</code> in that method.</p>
  
  <p>Note that some CSophisticated classes may not have the <code>validate()</code> method, so the parent version will be called.</p>
  
  <p>I understand that it is possible to just put in a comment somewhere, to remind the programmer to call <code>parent::validate()</code>, but is there a better way? Perhaps an automated way to throw an exception if the call to <code>parent::validate()</code> was not made in the <code>validate()</code> method would be nice.</p>