title: Is it possible to overuse late static binding in PHP?
body: <p>Starting with version 5.3, PHP supports <a href="http://en.wikipedia.org/wiki/Name_binding#Late_static" rel="nofollow noreferrer">late binding</a> for static methods. While it's an undoubtedly useful feature, there are only several cases where its use is really necessary (e.g. the Active Record pattern).  </p>
  
  <p>Consider these examples:</p>
  
  <p><strong>1. Convenience constructors (<code>::create()</code>)</strong></p>
  
  <pre><code>class SimpleObject
  {
      public function __construct() { /* ... */ }
  
      public static function create()
      {
          return new static; // or: return new self;
      }
  }
  </code></pre>
  
  <p>If this class may be extended (however, it's not extended by any class in the same package), should late static binding be used just to make extending it easier (without having to rewrite the <code>::create()</code> method, and, more importantly, without having to remember to do that)?</p>
  
  <p><em>Note: this idiom is used to work around the impossibility to call methods on just constructed objects: <code>new SimpleObject()-&gt;doStuff()</code> is invalid in PHP.</em> </p>
  
  <hr>
  
  <p><strong>2. Class constants</strong></p>
  
  <pre><code>class TagMatcher
  {
      const TAG_PATTERN = '/\&lt;([a-z\-]+?)\&gt;/i';
  
      private $subject;
  
      public function construct($subject) { $this-&gt;subject = $subject; }
  
      public function getAllTags()
      {
          $pattern = static::TAG_PATTERN;
          preg_match_all($pattern, $this-&gt;subject);
          return $pattern[1];
      }
  }
  </code></pre>
  
  <p>The reason to use <code>static::</code> in this example is similar to the previous one. It's used just because this class can be made to match differently formed tags just by extending it and overriding the constant.</p>
  
  <hr>
  
  <p>So, to wrap it all up, are these uses (and similar ones) of late static binding are an overkill? Is there any noticeable performance hit? Also, does frequent use of late binding reduce the overall performance boost given by opcode caches?</p>