title: global namespace function not available in namespaced class constructor
body: <p>WordPress has global functions such as wp_get_current_user(), which <strong>I can call in class methods</strong> that are under different namespaces with <code>\wp_get_current_user</code>. However <strong>I'm not able to do so either in the class constructor or setting it to a variable</strong> (class attributes such as <code>$user = \wp_get_current_user</code>). I'm guessing there's a PHP rule that I'm not aware of here?</p>
  
  <p>For example, </p>
  
  <pre><code>namespace App;
  class User{
  
      //this doesn't work **I found that this is because we have to initialize the variables with constants (expressions aren't allowed**
      $user = \wp_get_current_user(); 
  
      function __construct(){
          //this also doesn't work
          $this-&gt;user = \wp_get_current_user();
  
          $this-&gt;init();
      }
  
      function init(){
          //this works
          $this-&gt;user = \wp_get_current_user();
      }
  }
  </code></pre>