title: PHP const/static variables not usable in static context by parent class
body: <p>For some reason (which?), PHP const/static variables defined in a child class are not usable in a static context by the parent class. </p>
  
  <p>Why?</p>
  
  <p>Example 1:</p>
  
  <pre><code>class Model{
    function getAll(){
      $query = "SELECT * FROM " . self::DATABASE_TABLE_NAME;
      // ...
    }
  }
  
  class Post extends Model{
    const DATABASE_TABLE_NAME = 'post';
  }
  
  $p = Post::getAll();
  </code></pre>
  
  <p>When I run that I get:</p>
  
  <pre><code>Fatal error: Undefined class constant 'DATABASE_TABLE_NAME' on line 3 
  </code></pre>
  
  <p>(The row with $query = ...)</p>
  
  <p>Example 2:</p>
  
  <pre><code>class Model{
      function getAll(){
          $query = "SELECT * FROM " . self::$DATABASE_TABLE_NAME;
          // ...
      }
  }
  
  class Post extends Model{
      static $DATABASE_TABLE_NAME = 'post';
  }
  
  $p = Post::getAll();
  </code></pre>
  
  <p>Then I get:</p>
  
  <pre><code>Fatal error: Access to undeclared static property: Model::$DATABASE_TABLE_NAME on line 3
  </code></pre>
  
  <p>(Same row)</p>