@@ -233,7 +233,8 @@ public function start()
233
233
$ this ->setSaveHandler ();
234
234
235
235
// Sanitize the cookie, because apparently PHP doesn't do that for userspace handlers
236
- if (isset ($ _COOKIE [$ this ->config ->cookieName ])
236
+ if (
237
+ isset ($ _COOKIE [$ this ->config ->cookieName ])
237
238
&& (! is_string ($ _COOKIE [$ this ->config ->cookieName ]) || preg_match ('#\A ' . $ this ->sidRegexp . '\z# ' , $ _COOKIE [$ this ->config ->cookieName ]) !== 1 )
238
239
) {
239
240
unset($ _COOKIE [$ this ->config ->cookieName ]);
@@ -267,8 +268,10 @@ public function start()
267
268
* Destroys the current session.
268
269
*
269
270
* @deprecated Use destroy() instead.
271
+ *
272
+ * @return void
270
273
*/
271
- public function stop (): void
274
+ public function stop ()
272
275
{
273
276
$ this ->destroy ();
274
277
}
@@ -277,8 +280,10 @@ public function stop(): void
277
280
* Configuration.
278
281
*
279
282
* Handle input binds and configuration defaults.
283
+ *
284
+ * @return void
280
285
*/
281
- protected function configure (): void
286
+ protected function configure ()
282
287
{
283
288
ini_set ('session.name ' , $ this ->config ->cookieName );
284
289
@@ -318,8 +323,10 @@ protected function configure(): void
318
323
*
319
324
* To make life easier, we force the PHP defaults. Because PHP9 forces them.
320
325
* See https://wiki.php.net/rfc/deprecations_php_8_4#sessionsid_length_and_sessionsid_bits_per_character
326
+ *
327
+ * @return void
321
328
*/
322
- protected function configureSidLength (): void
329
+ protected function configureSidLength ()
323
330
{
324
331
$ bitsPerCharacter = (int ) ini_get ('session.sid_bits_per_character ' );
325
332
$ sidLength = (int ) ini_get ('session.sid_length ' );
@@ -342,8 +349,10 @@ protected function configureSidLength(): void
342
349
*
343
350
* Clears old "flash" data, marks the new one for deletion and handles
344
351
* "temp" data deletion.
352
+ *
353
+ * @return void
345
354
*/
346
- protected function initVars (): void
355
+ protected function initVars ()
347
356
{
348
357
if (! isset ($ _SESSION ['__ci_vars ' ])) {
349
358
return ;
@@ -370,8 +379,10 @@ protected function initVars(): void
370
379
* Regenerates the session ID.
371
380
*
372
381
* @param bool $destroy Should old session data be destroyed?
382
+ *
383
+ * @return void
373
384
*/
374
- public function regenerate (bool $ destroy = false ): void
385
+ public function regenerate (bool $ destroy = false )
375
386
{
376
387
$ _SESSION ['__ci_last_regenerate ' ] = Time::now ()->getTimestamp ();
377
388
session_regenerate_id ($ destroy );
@@ -401,8 +412,10 @@ private function removeOldSessionCookie(): void
401
412
402
413
/**
403
414
* Destroys the current session.
415
+ *
416
+ * @return void
404
417
*/
405
- public function destroy (): void
418
+ public function destroy ()
406
419
{
407
420
if (ENVIRONMENT === 'testing ' ) {
408
421
return ;
@@ -436,8 +449,10 @@ public function close()
436
449
*
437
450
* @param array|string $data Property name or associative array of properties
438
451
* @param array|bool|float|int|object|string|null $value Property value if single key provided
452
+ *
453
+ * @return void
439
454
*/
440
- public function set ($ data , $ value = null ): void
455
+ public function set ($ data , $ value = null )
441
456
{
442
457
if (is_array ($ data )) {
443
458
foreach ($ data as $ key => &$ value ) {
@@ -510,8 +525,10 @@ public function has(string $key): bool
510
525
*
511
526
* @param string $key Identifier of the session property we are interested in.
512
527
* @param array $data value to be pushed to existing session key.
528
+ *
529
+ * @return void
513
530
*/
514
- public function push (string $ key , array $ data ): void
531
+ public function push (string $ key , array $ data )
515
532
{
516
533
if ($ this ->has ($ key ) && is_array ($ value = $ this ->get ($ key ))) {
517
534
$ this ->set ($ key , array_merge ($ value , $ data ));
@@ -526,8 +543,10 @@ public function push(string $key, array $data): void
526
543
* of a specific session property to remove.
527
544
*
528
545
* @param array|string $key Identifier of the session property or properties to remove.
546
+ *
547
+ * @return void
529
548
*/
530
- public function remove ($ key ): void
549
+ public function remove ($ key )
531
550
{
532
551
if (is_array ($ key )) {
533
552
foreach ($ key as $ k ) {
@@ -598,8 +617,10 @@ public function __isset(string $key): bool
598
617
*
599
618
* @param array|string $data Property identifier or associative array of properties
600
619
* @param array|bool|float|int|object|string|null $value Property value if $data is a scalar
620
+ *
621
+ * @return void
601
622
*/
602
- public function setFlashdata ($ data , $ value = null ): void
623
+ public function setFlashdata ($ data , $ value = null )
603
624
{
604
625
$ this ->set ($ data , $ value );
605
626
$ this ->markAsFlashdata (is_array ($ data ) ? array_keys ($ data ) : $ data );
@@ -638,8 +659,10 @@ public function getFlashdata(?string $key = null)
638
659
* Keeps a single piece of flash data alive for one more request.
639
660
*
640
661
* @param array|string $key Property identifier or array of them
662
+ *
663
+ * @return void
641
664
*/
642
- public function keepFlashdata ($ key ): void
665
+ public function keepFlashdata ($ key )
643
666
{
644
667
$ this ->markAsFlashdata ($ key );
645
668
}
@@ -680,8 +703,10 @@ public function markAsFlashdata($key): bool
680
703
* Unmark data in the session as flashdata.
681
704
*
682
705
* @param array|string $key Property identifier or array of them
706
+ *
707
+ * @return void
683
708
*/
684
- public function unmarkFlashdata ($ key ): void
709
+ public function unmarkFlashdata ($ key )
685
710
{
686
711
if (! isset ($ _SESSION ['__ci_vars ' ])) {
687
712
return ;
@@ -731,8 +756,10 @@ public function getFlashKeys(): array
731
756
* @param array|string $data Session data key or associative array of items
732
757
* @param array|bool|float|int|object|string|null $value Value to store
733
758
* @param int $ttl Time-to-live in seconds
759
+ *
760
+ * @return void
734
761
*/
735
- public function setTempdata ($ data , $ value = null , int $ ttl = 300 ): void
762
+ public function setTempdata ($ data , $ value = null , int $ ttl = 300 )
736
763
{
737
764
$ this ->set ($ data , $ value );
738
765
$ this ->markAsTempdata ($ data , $ ttl );
@@ -750,7 +777,7 @@ public function getTempdata(?string $key = null)
750
777
{
751
778
if (isset ($ key )) {
752
779
return (isset ($ _SESSION ['__ci_vars ' ], $ _SESSION ['__ci_vars ' ][$ key ], $ _SESSION [$ key ])
753
- && is_int ($ _SESSION ['__ci_vars ' ][$ key ])) ? $ _SESSION [$ key ] : null ;
780
+ && is_int ($ _SESSION ['__ci_vars ' ][$ key ])) ? $ _SESSION [$ key ] : null ;
754
781
}
755
782
756
783
$ tempdata = [];
@@ -770,8 +797,10 @@ public function getTempdata(?string $key = null)
770
797
* Removes a single piece of temporary data from the session.
771
798
*
772
799
* @param string $key Session data key
800
+ *
801
+ * @return void
773
802
*/
774
- public function removeTempdata (string $ key ): void
803
+ public function removeTempdata (string $ key )
775
804
{
776
805
$ this ->unmarkTempdata ($ key );
777
806
unset($ _SESSION [$ key ]);
@@ -830,8 +859,10 @@ public function markAsTempdata($key, int $ttl = 300): bool
830
859
* lifespan and allowing it to live as long as the session does.
831
860
*
832
861
* @param array|string $key Property identifier or array of them
862
+ *
863
+ * @return void
833
864
*/
834
- public function unmarkTempdata ($ key ): void
865
+ public function unmarkTempdata ($ key )
835
866
{
836
867
if (! isset ($ _SESSION ['__ci_vars ' ])) {
837
868
return ;
@@ -875,17 +906,21 @@ public function getTempKeys(): array
875
906
/**
876
907
* Sets the driver as the session handler in PHP.
877
908
* Extracted for easier testing.
909
+ *
910
+ * @return void
878
911
*/
879
- protected function setSaveHandler (): void
912
+ protected function setSaveHandler ()
880
913
{
881
914
session_set_save_handler ($ this ->driver , true );
882
915
}
883
916
884
917
/**
885
918
* Starts the session.
886
919
* Extracted for testing reasons.
920
+ *
921
+ * @return void
887
922
*/
888
- protected function startSession (): void
923
+ protected function startSession ()
889
924
{
890
925
if (ENVIRONMENT === 'testing ' ) {
891
926
$ _SESSION = [];
@@ -900,8 +935,10 @@ protected function startSession(): void
900
935
* Takes care of setting the cookie on the client side.
901
936
*
902
937
* @codeCoverageIgnore
938
+ *
939
+ * @return void
903
940
*/
904
- protected function setCookie (): void
941
+ protected function setCookie ()
905
942
{
906
943
$ expiration = $ this ->config ->expiration === 0 ? 0 : Time::now ()->getTimestamp () + $ this ->config ->expiration ;
907
944
$ this ->cookie = $ this ->cookie ->withValue (session_id ())->withExpires ($ expiration );
0 commit comments