99use Laminas \Db \TableGateway \TableGateway ;
1010use Laminas \Db \TableGateway \TableGatewayInterface ;
1111use Laminas \Db \Sql \Select ;
12+ use Casbin \Model \Model ;
1213
1314/**
1415 * Laminas DB Adapter for Casbin.
@@ -92,7 +93,7 @@ public function savePolicyLine($ptype, array $rule)
9293 *
9394 * @param Model $model
9495 */
95- public function loadPolicy ($ model )
96+ public function loadPolicy ($ model ): void
9697 {
9798 $ rows = $ this ->tableGateway ->select (function (Select $ select ) {
9899 $ select ->columns (['ptype ' , 'v0 ' , 'v1 ' , 'v2 ' , 'v3 ' , 'v4 ' , 'v5 ' ]);
@@ -113,21 +114,19 @@ public function loadPolicy($model)
113114 *
114115 * @return bool
115116 */
116- public function savePolicy ($ model )
117+ public function savePolicy ($ model ): void
117118 {
118- foreach ($ model-> model ['p ' ] as $ ptype => $ ast ) {
119+ foreach ($ model ['p ' ] as $ ptype => $ ast ) {
119120 foreach ($ ast ->policy as $ rule ) {
120121 $ this ->savePolicyLine ($ ptype , $ rule );
121122 }
122123 }
123124
124- foreach ($ model-> model ['g ' ] as $ ptype => $ ast ) {
125+ foreach ($ model ['g ' ] as $ ptype => $ ast ) {
125126 foreach ($ ast ->policy as $ rule ) {
126127 $ this ->savePolicyLine ($ ptype , $ rule );
127128 }
128129 }
129-
130- return true ;
131130 }
132131
133132 /**
@@ -140,9 +139,9 @@ public function savePolicy($model)
140139 *
141140 * @return mixed
142141 */
143- public function addPolicy ($ sec , $ ptype , $ rule )
142+ public function addPolicy ($ sec , $ ptype , $ rule ): void
144143 {
145- return $ this ->savePolicyLine ($ ptype , $ rule );
144+ $ this ->savePolicyLine ($ ptype , $ rule );
146145 }
147146
148147 /**
@@ -152,7 +151,7 @@ public function addPolicy($sec, $ptype, $rule)
152151 * @param string $ptype
153152 * @param array $rule
154153 */
155- public function removePolicy ($ sec , $ ptype , $ rule )
154+ public function removePolicy ($ sec , $ ptype , $ rule ): void
156155 {
157156 $ where ['ptype ' ] = $ ptype ;
158157 foreach ($ rule as $ key => $ value ) {
@@ -171,7 +170,7 @@ public function removePolicy($sec, $ptype, $rule)
171170 * @param int $fieldIndex
172171 * @param mixed ...$fieldValues
173172 */
174- public function removeFilteredPolicy ($ sec , $ ptype , $ fieldIndex , ...$ fieldValues )
173+ public function removeFilteredPolicy ($ sec , $ ptype , $ fieldIndex , ...$ fieldValues ): void
175174 {
176175 $ where ['ptype ' ] = $ ptype ;
177176 foreach (range (0 , 5 ) as $ value ) {
0 commit comments