title: Passing array of Objects in php 7.3
body: <p>Hi there still new to PHP and struggling with something really basic and it's frustrating me cause I can't see the error. I have read the PHP manual on passing array of objects.</p>
  
  <pre><code>class Customer{
      public $companyId;
      public $customerId;
      public $name;
  
      public function __construct($companyId,$customerId,$name)
      {
         $this-&gt;companyId = $companyId;
         $this-&gt;customerId = $customerId; 
         $this-&gt;name = $name;
      }
  }
  
  class CustomersDB
  {
  ...
      /**
       * @return Customer[]
       */
      public function getCustomers($search_str): array {
          $resultObj = array();
          $result = NULL;
          try {
              if (! $this-&gt;db) {
                  die('Database handle not defined') ;
              } 
  
              if ($search_str &amp;&amp; ! empty($search_str)) {
                  $result = $this-&gt;ListCustomers(Utils::COMPANY_ID, $search_str, $this-&gt;db);
                   while ($row = $result-&gt;fetch(PDO::FETCH_ASSOC)) {
                      $_tmp = new Customer($row['CompanyID'], 
                                           $row['CustomerID'], 
                                           $row['CustomerName']);
                      // $resultObj.push($_tmp);
                      $resultObj[] = $_tmp;
                  }
              }
          } catch (Exception $e) {
              // echo Utils::logMsgtoWeb($e-&gt;getTraceAsString());
          } finally {
              $result = NULL;
          }        
          return $resultObj;
      }
  }
  
  use Respect\Rest\Routable;
  class Customers implements Routable {
      /**
       * 
       * Can pass in a partial string to search for a customer
       * or pass in an ID for a specific match.
       */
      public function get($searchStr){
          // header('Content-type: application/json');
          $result  = $this-&gt;custdb.getCustomers($searchStr); // ERRORS HERE
  
          if ($result &amp;&amp; ! empty($result)) {
              return  json_encode( $result);
          } else {
              return NULL;
          }
      }
  }
  
  </code></pre>
  
  <p>I get this error: PHP Recoverable fatal error:  Object of class Scheduler\db\CustomersDB could not be converted to string in Customers.php. 
  Any help would be appreciated.</p>