title: PhpStorm Referenced method is not found in subject class
body: <p>I am new to PHP OOP and trying to learn it. I know that this question is asked many times and i made a lot of search but i can't managed to fix of this warning.</p>
  
  <p>I am using only one class file for query and and assigning. Theese four methods <strong>query(), fetch_assoc(), free()</strong> and <strong>escape_string()</strong> are giving warning. I tired to use PHPDoc comments but warning is still here. What i am doing wrong?</p>
  
  <p><strong>1. method:</strong></p>
  
  <pre><code>$result = self::$database-&gt;query($sql);
  </code></pre>
  
  <p><strong>2. method:</strong></p>
  
  <pre><code>while ($record = $result-&gt;fetch_assoc()) {
  </code></pre>
  
  <p><strong>3. method:</strong></p>
  
  <pre><code>$result-&gt;free();
  </code></pre>
  
  <p><strong>4. method:</strong></p>
  
  <pre><code>$sql .= "WHERE id='" . self::$database-&gt;escape_string($id) . "'";
  </code></pre>
  
  <p>This sample code is modified from Linkedin(Lynda) training video.</p>
  
  <p>Class file:</p>
  
  <pre><code>&lt;?php
  
  /**
   * Class User
   */
  class User {
  
      // ------ START OF ACTIVE RECORD CODE ------
      /**
       * @var $database
       */
      static protected $database;
  
      /**
       * @param $database
       */
      public static function set_database($database): void {
          self::$database = $database;
      }
  
      /**
       * @param $sql
       * @return array
       */
      public static function find_by_sql($sql):array {
          $result = self::$database-&gt;query($sql);
          if (!$result) {
              exit("Database query failed.");
          }
  
          // result into objects
          $object_array = [];
  
          while ($record = $result-&gt;fetch_assoc()) {
              $object_array[] = self::instantiate($record);
          }
  
          $result-&gt;free();
  
          return $object_array;
      }
  
      /**
       * @return array
       */
      public static function find_all():array {
          $sql = "SELECT * FROM users";
          return self::find_by_sql($sql);
      }
  
      /**
       * @param $id
       * @return mixed
       */
      public static function find_by_id($id) {
          $sql = "SELECT * FROM users ";
          $sql .= "WHERE id='" . self::$database-&gt;escape_string($id) . "'";
          $obj_array = self::find_by_sql($sql);
          if (!empty($obj_array)) {
              return array_shift($obj_array);
          }
      }
  
      /**
       * @param $record
       * @return User
       */
      protected static function instantiate($record):User {
          // new self() creates a new User class
          $object = new self();
          // auto assign values from database to class properties
          foreach ($record as $property =&gt; $value) {
              if (property_exists($object, $property)) {
                  $object-&gt;$property = $value;
              }
          }
          return $object;
      }
      // ------ END OF ACTIVE RECORD CODE ------
  
      public $id;
      public $email;
      public $name;
      public $gender;
      public $member_date;
      public $last_login_date;
      public $last_login_ip;
      public $birthdate;
      public $profile_pic;
      public $facebook;
      public $twitter;
  }
  ?&gt;
  </code></pre>
  
  <p>initialization file for setting database:</p>
  
  <pre><code>&lt;?php
  require_once "config.php";
  require_once "db_functions.php";
  
  // TODO: change with spl_autoload
  require_once "classes/User.php";
  
  $database = db_connect();
  User::set_database($database);
  ?&gt;
  </code></pre>
  
  <p>functions file:</p>
  
  <pre><code>&lt;?php
  /*
   * DB Functions File
   */
  
  function db_connect() {
      $connection = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME);
      $connection-&gt;query("SET NAMES 'UTF8'");
      check_db_connection($connection);
      return $connection;
  }
  
  function check_db_connection($connection) {
      if ($connection-&gt;connect_errno) {
          $message = "Database connection failed!";
          $message .= "&lt;br /&gt;";
          $message .= $connection-&gt;connect_errno;
          $message .= ": ";
          $message .= $connection-&gt;connect_error;
          exit($message);
      }
  }
  
  function db_disconnect($connection) {
      if ($connection !== null) {
          $connection-&gt;close();
      }
  }
  
  ?&gt;
  </code></pre>