@@ -439,4 +439,17 @@ class ResultSet implements Countable, Iterator, Serializable, JsonSerializable {
}
+/**
+ * Returns an array that can be used to describe the internal state of this
+ * object.
+ *
+ * @return array
+ */
+ public function __debugInfo() {
+ return [
+ 'query' => $this->_query,
+ 'items' => $this->toArray(),
+ ];
+ }
+
@@ -230,4 +230,19 @@ class ResultSetTest extends TestCase {
$this->assertEquals($expected, $results);
+ * Tests __debugInfo
+ * @return void
+ public function testDebugInfo() {
+ $query = $this->table->find('all');
+ $results = $query->all();
+ $expected = [
+ 'query' => $query,
+ 'items' => $results->toArray()
+ $this->assertSame($expected, $results->__debugInfo());