@@ -268,7 +268,7 @@ public function start()
268268 *
269269 * @deprecated Use destroy() instead.
270270 */
271- public function stop ()
271+ public function stop (): void
272272 {
273273 $ this ->destroy ();
274274 }
@@ -278,7 +278,7 @@ public function stop()
278278 *
279279 * Handle input binds and configuration defaults.
280280 */
281- protected function configure ()
281+ protected function configure (): void
282282 {
283283 ini_set ('session.name ' , $ this ->config ->cookieName );
284284
@@ -319,7 +319,7 @@ protected function configure()
319319 * To make life easier, we force the PHP defaults. Because PHP9 forces them.
320320 * See https://wiki.php.net/rfc/deprecations_php_8_4#sessionsid_length_and_sessionsid_bits_per_character
321321 */
322- protected function configureSidLength ()
322+ protected function configureSidLength (): void
323323 {
324324 $ bitsPerCharacter = (int ) ini_get ('session.sid_bits_per_character ' );
325325 $ sidLength = (int ) ini_get ('session.sid_length ' );
@@ -343,7 +343,7 @@ protected function configureSidLength()
343343 * Clears old "flash" data, marks the new one for deletion and handles
344344 * "temp" data deletion.
345345 */
346- protected function initVars ()
346+ protected function initVars (): void
347347 {
348348 if (! isset ($ _SESSION ['__ci_vars ' ])) {
349349 return ;
@@ -371,7 +371,7 @@ protected function initVars()
371371 *
372372 * @param bool $destroy Should old session data be destroyed?
373373 */
374- public function regenerate (bool $ destroy = false )
374+ public function regenerate (bool $ destroy = false ): void
375375 {
376376 $ _SESSION ['__ci_last_regenerate ' ] = Time::now ()->getTimestamp ();
377377 session_regenerate_id ($ destroy );
@@ -402,7 +402,7 @@ private function removeOldSessionCookie(): void
402402 /**
403403 * Destroys the current session.
404404 */
405- public function destroy ()
405+ public function destroy (): void
406406 {
407407 if (ENVIRONMENT === 'testing ' ) {
408408 return ;
@@ -437,7 +437,7 @@ public function close()
437437 * @param array|string $data Property name or associative array of properties
438438 * @param array|bool|float|int|object|string|null $value Property value if single key provided
439439 */
440- public function set ($ data , $ value = null )
440+ public function set ($ data , $ value = null ): void
441441 {
442442 if (is_array ($ data )) {
443443 foreach ($ data as $ key => &$ value ) {
@@ -511,7 +511,7 @@ public function has(string $key): bool
511511 * @param string $key Identifier of the session property we are interested in.
512512 * @param array $data value to be pushed to existing session key.
513513 */
514- public function push (string $ key , array $ data )
514+ public function push (string $ key , array $ data ): void
515515 {
516516 if ($ this ->has ($ key ) && is_array ($ value = $ this ->get ($ key ))) {
517517 $ this ->set ($ key , array_merge ($ value , $ data ));
@@ -527,7 +527,7 @@ public function push(string $key, array $data)
527527 *
528528 * @param array|string $key Identifier of the session property or properties to remove.
529529 */
530- public function remove ($ key )
530+ public function remove ($ key ): void
531531 {
532532 if (is_array ($ key )) {
533533 foreach ($ key as $ k ) {
@@ -599,7 +599,7 @@ public function __isset(string $key): bool
599599 * @param array|string $data Property identifier or associative array of properties
600600 * @param array|bool|float|int|object|string|null $value Property value if $data is a scalar
601601 */
602- public function setFlashdata ($ data , $ value = null )
602+ public function setFlashdata ($ data , $ value = null ): void
603603 {
604604 $ this ->set ($ data , $ value );
605605 $ this ->markAsFlashdata (is_array ($ data ) ? array_keys ($ data ) : $ data );
@@ -639,7 +639,7 @@ public function getFlashdata(?string $key = null)
639639 *
640640 * @param array|string $key Property identifier or array of them
641641 */
642- public function keepFlashdata ($ key )
642+ public function keepFlashdata ($ key ): void
643643 {
644644 $ this ->markAsFlashdata ($ key );
645645 }
@@ -681,7 +681,7 @@ public function markAsFlashdata($key): bool
681681 *
682682 * @param array|string $key Property identifier or array of them
683683 */
684- public function unmarkFlashdata ($ key )
684+ public function unmarkFlashdata ($ key ): void
685685 {
686686 if (! isset ($ _SESSION ['__ci_vars ' ])) {
687687 return ;
@@ -732,7 +732,7 @@ public function getFlashKeys(): array
732732 * @param array|bool|float|int|object|string|null $value Value to store
733733 * @param int $ttl Time-to-live in seconds
734734 */
735- public function setTempdata ($ data , $ value = null , int $ ttl = 300 )
735+ public function setTempdata ($ data , $ value = null , int $ ttl = 300 ): void
736736 {
737737 $ this ->set ($ data , $ value );
738738 $ this ->markAsTempdata ($ data , $ ttl );
@@ -771,7 +771,7 @@ public function getTempdata(?string $key = null)
771771 *
772772 * @param string $key Session data key
773773 */
774- public function removeTempdata (string $ key )
774+ public function removeTempdata (string $ key ): void
775775 {
776776 $ this ->unmarkTempdata ($ key );
777777 unset($ _SESSION [$ key ]);
@@ -831,7 +831,7 @@ public function markAsTempdata($key, int $ttl = 300): bool
831831 *
832832 * @param array|string $key Property identifier or array of them
833833 */
834- public function unmarkTempdata ($ key )
834+ public function unmarkTempdata ($ key ): void
835835 {
836836 if (! isset ($ _SESSION ['__ci_vars ' ])) {
837837 return ;
@@ -876,7 +876,7 @@ public function getTempKeys(): array
876876 * Sets the driver as the session handler in PHP.
877877 * Extracted for easier testing.
878878 */
879- protected function setSaveHandler ()
879+ protected function setSaveHandler (): void
880880 {
881881 session_set_save_handler ($ this ->driver , true );
882882 }
@@ -885,7 +885,7 @@ protected function setSaveHandler()
885885 * Starts the session.
886886 * Extracted for testing reasons.
887887 */
888- protected function startSession ()
888+ protected function startSession (): void
889889 {
890890 if (ENVIRONMENT === 'testing ' ) {
891891 $ _SESSION = [];
@@ -901,7 +901,7 @@ protected function startSession()
901901 *
902902 * @codeCoverageIgnore
903903 */
904- protected function setCookie ()
904+ protected function setCookie (): void
905905 {
906906 $ expiration = $ this ->config ->expiration === 0 ? 0 : Time::now ()->getTimestamp () + $ this ->config ->expiration ;
907907 $ this ->cookie = $ this ->cookie ->withValue (session_id ())->withExpires ($ expiration );
0 commit comments