@@ -19,10 +19,12 @@ class ORM
1919
2020 private static int | string | null $ currentInstance = null ;
2121
22+ /** @var array<\PHPFUI\ORM\PDOInstance> */
2223 private static array $ instances = [];
2324
2425 private static ?\Psr \Log \AbstractLogger $ logger = null ;
2526
27+ /** @var ?callable */
2628 private static $ translationCallback = null ;
2729
2830 /**
@@ -60,6 +62,9 @@ public static function commit() : bool
6062 return self ::getInstance ()->commit ();
6163 }
6264
65+ /**
66+ * @return array<\PHPFUI\ORM\Schema\Field>
67+ */
6368 public static function describeTable (string $ table ) : array
6469 {
6570 return self ::getInstance ()->describeTable ($ table );
@@ -68,6 +73,8 @@ public static function describeTable(string $table) : array
6873 /**
6974 * Executes the SQL string using the matching $input array
7075 *
76+ * @param array<mixed> $input
77+ *
7178 * @return bool status of command run
7279 */
7380 public static function execute (string $ sql , array $ input = []) : bool
@@ -77,13 +84,17 @@ public static function execute(string $sql, array $input = []) : bool
7784
7885 /**
7986 * Executes the query and catches any errors
87+ *
88+ * @param array<mixed> $input
8089 */
8190 public static function executeStatement (\PDOStatement $ statement , array $ input = []) : ?\PDOStatement
8291 {
8392 return self ::getInstance ()->executeStatement ($ statement , $ input );
8493 }
8594
8695 /**
96+ * @param array<mixed> $input
97+ *
8798 * @return \PHPFUI\ORM\ArrayCursor tracking the sql and input passed
8899 */
89100 public static function getArrayCursor (string $ sql = 'select 0 limit 0 ' , array $ input = []) : \PHPFUI \ORM \ArrayCursor
@@ -115,13 +126,18 @@ public static function getConnection() : int | string | null
115126 }
116127
117128 /**
129+ * @param array<mixed> $input
130+ *
118131 * @return \PHPFUI\ORM\DataObjectCursor tracking the sql and input passed
119132 */
120133 public static function getDataObjectCursor (string $ sql = 'select 0 limit 0 ' , array $ input = []) : \PHPFUI \ORM \DataObjectCursor
121134 {
122135 return self ::getInstance ()->getDataObjectCursor ($ sql , $ input );
123136 }
124137
138+ /**
139+ * @return array<\PHPFUI\ORM\Schema\Index>
140+ */
125141 public static function getIndexes (string $ table ) : array
126142 {
127143 return self ::getInstance ()->getIndexes ($ table );
@@ -154,15 +170,15 @@ public static function getLastErrorCode() : int
154170 }
155171
156172 /**
157- * @return array of all errors since the last transaction or last time cleared
173+ * @return array<array<string,string>> of all errors since the last transaction or last time cleared
158174 */
159175 public static function getLastErrors () : array
160176 {
161177 return self ::getInstance ()->getLastErrors ();
162178 }
163179
164180 /**
165- * @return array of parameters from the last operation
181+ * @return array<mixed> of parameters from the last operation
166182 */
167183 public static function getLastParameters () : array
168184 {
@@ -183,7 +199,9 @@ public static function getMigrationNamespacePath() : string
183199 }
184200
185201 /**
186- * @return \PHPFUI\ORM\RecordCursor tracking the sql and input passed
202+ * @param array<mixed> $input
203+ *
204+ * @return \PHPFUI\ORM\RecordCursor tracking the sql and input passed
187205 */
188206 public static function getRecordCursor (\PHPFUI \ORM \Record $ crud , string $ sql = 'select 0 limit 0 ' , array $ input = []) : \PHPFUI \ORM \RecordCursor
189207 {
@@ -196,6 +214,8 @@ public static function getRecordNamespacePath() : string
196214 }
197215
198216 /**
217+ * @param array<mixed> $input
218+ *
199219 * @return array<string, string> a single row of the first matching record or an empty array if an error
200220 */
201221 public static function getRow (string $ sql , array $ input = []) : array
@@ -207,6 +227,10 @@ public static function getRow(string $sql, array $input = []) : array
207227 * Similar to getArrayCursor except returns a fully populated array
208228 *
209229 * It is recommended to use getArrayCursor if you don't need array functionality
230+ *
231+ * @param array<mixed> $input
232+ *
233+ * @return array<array<string, string>>
210234 */
211235 public static function getRows (string $ sql , array $ input = [], int $ fetchType = \PDO ::FETCH_ASSOC ) : array
212236 {
@@ -218,12 +242,17 @@ public static function getTableNamespacePath() : string
218242 return self ::filePath (self ::$ namespaceRoot . '/ ' . self ::$ tableNamespace );
219243 }
220244
245+ /**
246+ * @return array<string>
247+ */
221248 public static function getTables () : array
222249 {
223250 return self ::getInstance ()->getTables ();
224251 }
225252
226253 /**
254+ * @param array<mixed> $input
255+ *
227256 * @return string value returned from the first field in the first row returned by the querry, or blank if error
228257 */
229258 public static function getValue (string $ sql , array $ input = []) : string
@@ -232,6 +261,8 @@ public static function getValue(string $sql, array $input = []) : string
232261 }
233262
234263 /**
264+ * @param array<mixed> $input
265+ *
235266 * @return array<mixed> of the first value in each row from the query
236267 */
237268 public static function getValueArray (string $ sql , array $ input = []) : array
@@ -249,6 +280,8 @@ public static function lastInsertId(string $name = '') : string
249280
250281 /**
251282 * Logs array of errors via error_log
283+ *
284+ * @param array<mixed> $context
252285 */
253286 public static function log (string $ type , string $ message , array $ context = []) : void
254287 {
@@ -287,6 +320,9 @@ public static function setLogger(\Psr\Log\AbstractLogger $logger) : void
287320 self ::$ logger = $ logger ;
288321 }
289322
323+ /**
324+ * @param callable $callback
325+ */
290326 public static function setTranslationCallback ($ callback ) : void
291327 {
292328 self ::$ translationCallback = $ callback ;
0 commit comments