Skip to content

Commit bcba7f0

Browse files
authored
Merge pull request #125 from mrcnpdlk/issue-123
issue 123: Better phpdoc for fire methods
2 parents a61bfa0 + ed30c7b commit bcba7f0

2 files changed

Lines changed: 175 additions & 30 deletions

File tree

src/Pecee/Pixie/QueryBuilder/QueryBuilderHandler.php

Lines changed: 169 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,15 @@ public function setFetchMode($parameters = null): self
144144
*
145145
* @param string $field
146146
*
147-
* @throws Exception
147+
* @throws \Pecee\Pixie\Exception
148+
* @throws \Pecee\Pixie\Exceptions\ColumnNotFoundException
149+
* @throws \Pecee\Pixie\Exceptions\ConnectionException
150+
* @throws \Pecee\Pixie\Exceptions\DuplicateColumnException
151+
* @throws \Pecee\Pixie\Exceptions\DuplicateEntryException
152+
* @throws \Pecee\Pixie\Exceptions\DuplicateKeyException
153+
* @throws \Pecee\Pixie\Exceptions\ForeignKeyException
154+
* @throws \Pecee\Pixie\Exceptions\NotNullException
155+
* @throws \Pecee\Pixie\Exceptions\TableNotFoundException
148156
* @return integer
149157
*/
150158
public function count(string $field = '*'): int
@@ -157,7 +165,16 @@ public function count(string $field = '*'): int
157165
*
158166
* @param string $type
159167
* @param string $field
160-
* @throws Exception
168+
*
169+
* @throws \Pecee\Pixie\Exception
170+
* @throws \Pecee\Pixie\Exceptions\ColumnNotFoundException
171+
* @throws \Pecee\Pixie\Exceptions\ConnectionException
172+
* @throws \Pecee\Pixie\Exceptions\DuplicateColumnException
173+
* @throws \Pecee\Pixie\Exceptions\DuplicateEntryException
174+
* @throws \Pecee\Pixie\Exceptions\DuplicateKeyException
175+
* @throws \Pecee\Pixie\Exceptions\ForeignKeyException
176+
* @throws \Pecee\Pixie\Exceptions\NotNullException
177+
* @throws \Pecee\Pixie\Exceptions\TableNotFoundException
161178
* @return float
162179
*/
163180
protected function aggregate(string $type, string $field = '*'): float
@@ -209,7 +226,15 @@ public function getTable(): ?string
209226
/**
210227
* Returns the first row
211228
*
212-
* @throws Exception
229+
* @throws \Pecee\Pixie\Exception
230+
* @throws \Pecee\Pixie\Exceptions\ColumnNotFoundException
231+
* @throws \Pecee\Pixie\Exceptions\ConnectionException
232+
* @throws \Pecee\Pixie\Exceptions\DuplicateColumnException
233+
* @throws \Pecee\Pixie\Exceptions\DuplicateEntryException
234+
* @throws \Pecee\Pixie\Exceptions\DuplicateKeyException
235+
* @throws \Pecee\Pixie\Exceptions\ForeignKeyException
236+
* @throws \Pecee\Pixie\Exceptions\NotNullException
237+
* @throws \Pecee\Pixie\Exceptions\TableNotFoundException
213238
* @return \stdClass|string|null
214239
*/
215240
public function first()
@@ -222,7 +247,15 @@ public function first()
222247
/**
223248
* Get all rows
224249
*
225-
* @throws Exception
250+
* @throws \Pecee\Pixie\Exception
251+
* @throws \Pecee\Pixie\Exceptions\ColumnNotFoundException
252+
* @throws \Pecee\Pixie\Exceptions\ConnectionException
253+
* @throws \Pecee\Pixie\Exceptions\DuplicateColumnException
254+
* @throws \Pecee\Pixie\Exceptions\DuplicateEntryException
255+
* @throws \Pecee\Pixie\Exceptions\DuplicateKeyException
256+
* @throws \Pecee\Pixie\Exceptions\ForeignKeyException
257+
* @throws \Pecee\Pixie\Exceptions\NotNullException
258+
* @throws \Pecee\Pixie\Exceptions\TableNotFoundException
226259
* @return array
227260
*/
228261
public function get(): array
@@ -694,7 +727,15 @@ public function raw(string $value, $bindings = null): Raw
694727
*
695728
* @param string $field
696729
*
697-
* @throws Exception
730+
* @throws \Pecee\Pixie\Exception
731+
* @throws \Pecee\Pixie\Exceptions\ColumnNotFoundException
732+
* @throws \Pecee\Pixie\Exceptions\ConnectionException
733+
* @throws \Pecee\Pixie\Exceptions\DuplicateColumnException
734+
* @throws \Pecee\Pixie\Exceptions\DuplicateEntryException
735+
* @throws \Pecee\Pixie\Exceptions\DuplicateKeyException
736+
* @throws \Pecee\Pixie\Exceptions\ForeignKeyException
737+
* @throws \Pecee\Pixie\Exceptions\NotNullException
738+
* @throws \Pecee\Pixie\Exceptions\TableNotFoundException
698739
* @return float
699740
*/
700741
public function sum(string $field): float
@@ -707,7 +748,15 @@ public function sum(string $field): float
707748
*
708749
* @param string $field
709750
*
710-
* @throws Exception
751+
* @throws \Pecee\Pixie\Exception
752+
* @throws \Pecee\Pixie\Exceptions\ColumnNotFoundException
753+
* @throws \Pecee\Pixie\Exceptions\ConnectionException
754+
* @throws \Pecee\Pixie\Exceptions\DuplicateColumnException
755+
* @throws \Pecee\Pixie\Exceptions\DuplicateEntryException
756+
* @throws \Pecee\Pixie\Exceptions\DuplicateKeyException
757+
* @throws \Pecee\Pixie\Exceptions\ForeignKeyException
758+
* @throws \Pecee\Pixie\Exceptions\NotNullException
759+
* @throws \Pecee\Pixie\Exceptions\TableNotFoundException
711760
* @return float
712761
*/
713762
public function average(string $field): float
@@ -720,7 +769,15 @@ public function average(string $field): float
720769
*
721770
* @param string $field
722771
*
723-
* @throws Exception
772+
* @throws \Pecee\Pixie\Exception
773+
* @throws \Pecee\Pixie\Exceptions\ColumnNotFoundException
774+
* @throws \Pecee\Pixie\Exceptions\ConnectionException
775+
* @throws \Pecee\Pixie\Exceptions\DuplicateColumnException
776+
* @throws \Pecee\Pixie\Exceptions\DuplicateEntryException
777+
* @throws \Pecee\Pixie\Exceptions\DuplicateKeyException
778+
* @throws \Pecee\Pixie\Exceptions\ForeignKeyException
779+
* @throws \Pecee\Pixie\Exceptions\NotNullException
780+
* @throws \Pecee\Pixie\Exceptions\TableNotFoundException
724781
* @return float
725782
*/
726783
public function min(string $field): float
@@ -733,7 +790,15 @@ public function min(string $field): float
733790
*
734791
* @param string $field
735792
*
736-
* @throws Exception
793+
* @throws \Pecee\Pixie\Exception
794+
* @throws \Pecee\Pixie\Exceptions\ColumnNotFoundException
795+
* @throws \Pecee\Pixie\Exceptions\ConnectionException
796+
* @throws \Pecee\Pixie\Exceptions\DuplicateColumnException
797+
* @throws \Pecee\Pixie\Exceptions\DuplicateEntryException
798+
* @throws \Pecee\Pixie\Exceptions\DuplicateKeyException
799+
* @throws \Pecee\Pixie\Exceptions\ForeignKeyException
800+
* @throws \Pecee\Pixie\Exceptions\NotNullException
801+
* @throws \Pecee\Pixie\Exceptions\TableNotFoundException
737802
* @return float
738803
*/
739804
public function max(string $field): float
@@ -745,8 +810,17 @@ public function max(string $field): float
745810
* Forms delete on the current query.
746811
*
747812
* @var array|null $columns
813+
*
814+
* @throws \Pecee\Pixie\Exception
815+
* @throws \Pecee\Pixie\Exceptions\ColumnNotFoundException
816+
* @throws \Pecee\Pixie\Exceptions\ConnectionException
817+
* @throws \Pecee\Pixie\Exceptions\DuplicateColumnException
818+
* @throws \Pecee\Pixie\Exceptions\DuplicateEntryException
819+
* @throws \Pecee\Pixie\Exceptions\DuplicateKeyException
820+
* @throws \Pecee\Pixie\Exceptions\ForeignKeyException
821+
* @throws \Pecee\Pixie\Exceptions\NotNullException
822+
* @throws \Pecee\Pixie\Exceptions\TableNotFoundException
748823
* @return \PDOStatement
749-
* @throws Exception
750824
*/
751825
public function delete(array $columns = null): \PDOStatement
752826
{
@@ -769,9 +843,17 @@ public function delete(array $columns = null): \PDOStatement
769843
* Find by value and field name.
770844
*
771845
* @param string|int|float $value
772-
* @param string $fieldName
846+
* @param string $fieldName
773847
*
774-
* @throws Exception
848+
* @throws \Pecee\Pixie\Exception
849+
* @throws \Pecee\Pixie\Exceptions\ColumnNotFoundException
850+
* @throws \Pecee\Pixie\Exceptions\ConnectionException
851+
* @throws \Pecee\Pixie\Exceptions\DuplicateColumnException
852+
* @throws \Pecee\Pixie\Exceptions\DuplicateEntryException
853+
* @throws \Pecee\Pixie\Exceptions\DuplicateKeyException
854+
* @throws \Pecee\Pixie\Exceptions\ForeignKeyException
855+
* @throws \Pecee\Pixie\Exceptions\NotNullException
856+
* @throws \Pecee\Pixie\Exceptions\TableNotFoundException
775857
* @return \stdClass|string|null
776858
*/
777859
public function find($value, string $fieldName = 'id')
@@ -824,10 +906,18 @@ protected function whereHandler($key, ?string $operator = null, $value = null, $
824906
/**
825907
* Find all by field name and value
826908
*
827-
* @param string $fieldName
909+
* @param string $fieldName
828910
* @param string|int|float $value
829911
*
830-
* @throws Exception
912+
* @throws \Pecee\Pixie\Exception
913+
* @throws \Pecee\Pixie\Exceptions\ColumnNotFoundException
914+
* @throws \Pecee\Pixie\Exceptions\ConnectionException
915+
* @throws \Pecee\Pixie\Exceptions\DuplicateColumnException
916+
* @throws \Pecee\Pixie\Exceptions\DuplicateEntryException
917+
* @throws \Pecee\Pixie\Exceptions\DuplicateKeyException
918+
* @throws \Pecee\Pixie\Exceptions\ForeignKeyException
919+
* @throws \Pecee\Pixie\Exceptions\NotNullException
920+
* @throws \Pecee\Pixie\Exceptions\TableNotFoundException
831921
* @return array
832922
*/
833923
public function findAll(string $fieldName, $value): array
@@ -953,7 +1043,15 @@ public function join($table, $key = null, $operator = null, $value = null, $type
9531043
*
9541044
* @param array $data
9551045
*
956-
* @throws Exception
1046+
* @throws \Pecee\Pixie\Exception
1047+
* @throws \Pecee\Pixie\Exceptions\ColumnNotFoundException
1048+
* @throws \Pecee\Pixie\Exceptions\ConnectionException
1049+
* @throws \Pecee\Pixie\Exceptions\DuplicateColumnException
1050+
* @throws \Pecee\Pixie\Exceptions\DuplicateEntryException
1051+
* @throws \Pecee\Pixie\Exceptions\DuplicateKeyException
1052+
* @throws \Pecee\Pixie\Exceptions\ForeignKeyException
1053+
* @throws \Pecee\Pixie\Exceptions\NotNullException
1054+
* @throws \Pecee\Pixie\Exceptions\TableNotFoundException
9571055
* @return array|string
9581056
*/
9591057
public function insertIgnore(array $data)
@@ -964,10 +1062,18 @@ public function insertIgnore(array $data)
9641062
/**
9651063
* Performs insert
9661064
*
967-
* @param array $data
1065+
* @param array $data
9681066
* @param string $type
9691067
*
970-
* @throws Exception
1068+
* @throws \Pecee\Pixie\Exception
1069+
* @throws \Pecee\Pixie\Exceptions\ColumnNotFoundException
1070+
* @throws \Pecee\Pixie\Exceptions\ConnectionException
1071+
* @throws \Pecee\Pixie\Exceptions\DuplicateColumnException
1072+
* @throws \Pecee\Pixie\Exceptions\DuplicateEntryException
1073+
* @throws \Pecee\Pixie\Exceptions\DuplicateKeyException
1074+
* @throws \Pecee\Pixie\Exceptions\ForeignKeyException
1075+
* @throws \Pecee\Pixie\Exceptions\NotNullException
1076+
* @throws \Pecee\Pixie\Exceptions\TableNotFoundException
9711077
* @return array|string|null
9721078
*/
9731079
private function doInsert(array $data, string $type)
@@ -1322,10 +1428,18 @@ public function orderBy($fields, string $direction = 'ASC'): self
13221428
* Performs query.
13231429
*
13241430
* @param string $sql
1325-
* @param array $bindings
1431+
* @param array $bindings
13261432
*
1433+
* @throws \Pecee\Pixie\Exception
1434+
* @throws \Pecee\Pixie\Exceptions\ColumnNotFoundException
1435+
* @throws \Pecee\Pixie\Exceptions\ConnectionException
1436+
* @throws \Pecee\Pixie\Exceptions\DuplicateColumnException
1437+
* @throws \Pecee\Pixie\Exceptions\DuplicateEntryException
1438+
* @throws \Pecee\Pixie\Exceptions\DuplicateKeyException
1439+
* @throws \Pecee\Pixie\Exceptions\ForeignKeyException
1440+
* @throws \Pecee\Pixie\Exceptions\NotNullException
1441+
* @throws \Pecee\Pixie\Exceptions\TableNotFoundException
13271442
* @return static
1328-
* @throws Exception
13291443
*/
13301444
public function query(string $sql, array $bindings = []): self
13311445
{
@@ -1377,7 +1491,15 @@ public function removeEvent(string $name, ?string $table = null): void
13771491
*
13781492
* @param array $data
13791493
*
1380-
* @throws Exception
1494+
* @throws \Pecee\Pixie\Exception
1495+
* @throws \Pecee\Pixie\Exceptions\ColumnNotFoundException
1496+
* @throws \Pecee\Pixie\Exceptions\ConnectionException
1497+
* @throws \Pecee\Pixie\Exceptions\DuplicateColumnException
1498+
* @throws \Pecee\Pixie\Exceptions\DuplicateEntryException
1499+
* @throws \Pecee\Pixie\Exceptions\DuplicateKeyException
1500+
* @throws \Pecee\Pixie\Exceptions\ForeignKeyException
1501+
* @throws \Pecee\Pixie\Exceptions\NotNullException
1502+
* @throws \Pecee\Pixie\Exceptions\TableNotFoundException
13811503
* @return array|string
13821504
*/
13831505
public function replace(array $data)
@@ -1472,8 +1594,16 @@ public function setStatements(array $statements): self
14721594
*
14731595
* @param array $data
14741596
*
1597+
* @throws \Pecee\Pixie\Exception
1598+
* @throws \Pecee\Pixie\Exceptions\ColumnNotFoundException
1599+
* @throws \Pecee\Pixie\Exceptions\ConnectionException
1600+
* @throws \Pecee\Pixie\Exceptions\DuplicateColumnException
1601+
* @throws \Pecee\Pixie\Exceptions\DuplicateEntryException
1602+
* @throws \Pecee\Pixie\Exceptions\DuplicateKeyException
1603+
* @throws \Pecee\Pixie\Exceptions\ForeignKeyException
1604+
* @throws \Pecee\Pixie\Exceptions\NotNullException
1605+
* @throws \Pecee\Pixie\Exceptions\TableNotFoundException
14751606
* @return array|\PDOStatement|string
1476-
* @throws Exception
14771607
*/
14781608
public function updateOrInsert(array $data)
14791609
{
@@ -1489,7 +1619,15 @@ public function updateOrInsert(array $data)
14891619
*
14901620
* @param array $data
14911621
*
1492-
* @throws Exception
1622+
* @throws \Pecee\Pixie\Exception
1623+
* @throws \Pecee\Pixie\Exceptions\ColumnNotFoundException
1624+
* @throws \Pecee\Pixie\Exceptions\ConnectionException
1625+
* @throws \Pecee\Pixie\Exceptions\DuplicateColumnException
1626+
* @throws \Pecee\Pixie\Exceptions\DuplicateEntryException
1627+
* @throws \Pecee\Pixie\Exceptions\DuplicateKeyException
1628+
* @throws \Pecee\Pixie\Exceptions\ForeignKeyException
1629+
* @throws \Pecee\Pixie\Exceptions\NotNullException
1630+
* @throws \Pecee\Pixie\Exceptions\TableNotFoundException
14931631
* @return \PDOStatement
14941632
*/
14951633
public function update(array $data): \PDOStatement
@@ -1517,7 +1655,15 @@ public function update(array $data): \PDOStatement
15171655
*
15181656
* @param array $data
15191657
*
1520-
* @throws Exception
1658+
* @throws \Pecee\Pixie\Exception
1659+
* @throws \Pecee\Pixie\Exceptions\ColumnNotFoundException
1660+
* @throws \Pecee\Pixie\Exceptions\ConnectionException
1661+
* @throws \Pecee\Pixie\Exceptions\DuplicateColumnException
1662+
* @throws \Pecee\Pixie\Exceptions\DuplicateEntryException
1663+
* @throws \Pecee\Pixie\Exceptions\DuplicateKeyException
1664+
* @throws \Pecee\Pixie\Exceptions\ForeignKeyException
1665+
* @throws \Pecee\Pixie\Exceptions\NotNullException
1666+
* @throws \Pecee\Pixie\Exceptions\TableNotFoundException
15211667
* @return array|string
15221668
*/
15231669
public function insert(array $data)
@@ -1681,4 +1827,4 @@ public function close(): void
16811827
$this->connection = null;
16821828
}
16831829

1684-
}
1830+
}

src/Pecee/Pixie/QueryBuilder/Transaction.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,19 +81,18 @@ public function rollBack() : void
8181
* Execute statement
8282
*
8383
* @param string $sql
84-
* @param array $bindings
84+
* @param array $bindings
8585
*
86-
* @return array PDOStatement and execution time as float
87-
* @throws \Pecee\Pixie\Exceptions\TableNotFoundException
88-
* @throws \Pecee\Pixie\Exceptions\ConnectionException
89-
* @throws \Pecee\Pixie\Exceptions\ColumnNotFoundException
9086
* @throws \Pecee\Pixie\Exception
87+
* @throws \Pecee\Pixie\Exceptions\ColumnNotFoundException
88+
* @throws \Pecee\Pixie\Exceptions\ConnectionException
9189
* @throws \Pecee\Pixie\Exceptions\DuplicateColumnException
9290
* @throws \Pecee\Pixie\Exceptions\DuplicateEntryException
9391
* @throws \Pecee\Pixie\Exceptions\DuplicateKeyException
9492
* @throws \Pecee\Pixie\Exceptions\ForeignKeyException
9593
* @throws \Pecee\Pixie\Exceptions\NotNullException
96-
* @throws Exception
94+
* @throws \Pecee\Pixie\Exceptions\TableNotFoundException
95+
* @return array PDOStatement and execution time as float
9796
*/
9897
public function statement(string $sql, array $bindings = []): array
9998
{
@@ -108,4 +107,4 @@ public function statement(string $sql, array $bindings = []): array
108107
return parent::statement($sql, $bindings);
109108
}
110109

111-
}
110+
}

0 commit comments

Comments
 (0)