File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change 11parameters :
22 level : 9
3+ checkGenericClassInNonGenericObjectType : false
34 paths :
45 - src
56 - tests
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ class Session implements ArrayAccess, Countable
1515 protected string $ id ;
1616
1717 /**
18- * @var array<string, mixed>
18+ * @var mixed[]|null
1919 */
2020 protected ?array $ contents = null ;
2121
@@ -29,7 +29,7 @@ class Session implements ArrayAccess, Countable
2929 protected bool $ modified = false ;
3030
3131 /**
32- * @param ?array<string, mixed> $contents
32+ * @param mixed[]|null $contents
3333 */
3434 public function __construct (string $ name , ?string $ id = null , array $ contents = null )
3535 {
@@ -134,6 +134,11 @@ public function offsetUnset($name): void
134134
135135 public function offsetGet ($ name ): mixed
136136 {
137+ if (!$ this ->isInitialized ()) {
138+ throw new RuntimeException ('Session not initialized ' );
139+ }
140+
141+ // @phpstan-ignore-next-line
137142 return $ this ->contents [$ name ];
138143 }
139144
You can’t perform that action at this time.
0 commit comments