jasny / jasny/session-middleware

Make code PHP 8.1 compatible

Open
#2 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
1
Forks
2
PR merge metrics
No merged PRs in 30d

Description

When using the library with PHP 8.1, I'm getting a deprecation error for the `ArrayAccess` implementations of `GlobalSession`:

`Return type of Jasny\Session\GlobalSession::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/gbirke/src/mealplan/vendor/jasny/session-middleware/src/GlobalSession.php on line 149
`

Depending on how compatible you want this library to be, you could either add a `mixed` return type (min. PHP version 8.0) or a `#[\ReturnTypeWillChange]` (backwards compatible for PHP 7.x) to the methods of the `ArrayAccess` implementation. The `MockSession` is probably affected too

Contributor guide

No contributing guide indexed for this repository

Research direction

Inspect the ArrayAccess implementations in GlobalSession and MockSession, starting with the offsetGet method and the PHP versions supported by the library. Apply the chosen compatibility approach to the affected methods, then run the test suite and verify that PHP 8.1 no longer reports the deprecation while supported older versions remain compatible.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.