Skip to content

Commit eff12b0

Browse files
committed
Add static return type to verify
1 parent 79703a0 commit eff12b0

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

system/Security/Security.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public function __construct(SecurityConfig $config)
110110
}
111111
}
112112

113-
public function verify(RequestInterface $request)
113+
public function verify(RequestInterface $request): static
114114
{
115115
$method = $request->getMethod();
116116

system/Security/SecurityInterface.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,17 @@
1717
use CodeIgniter\Security\Exceptions\SecurityException;
1818

1919
/**
20-
* Expected behavior of a Security.
20+
* Expected behavior of a Security object providing
21+
* protection against CSRF attacks.
2122
*/
2223
interface SecurityInterface
2324
{
2425
/**
2526
* Verify CSRF token sent with the request.
2627
*
27-
* @return $this
28-
*
2928
* @throws SecurityException
3029
*/
31-
public function verify(RequestInterface $request);
30+
public function verify(RequestInterface $request): static;
3231

3332
/**
3433
* Returns the CSRF Hash.

user_guide_src/source/changelogs/v4.8.0.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ Behavior Changes
2626
Interface Changes
2727
=================
2828

29+
**NOTE:** If you've implemented your own classes that implement these interfaces from scratch, you will need to update your implementations to include the new methods to ensure compatibility.
30+
31+
- **Security:** The ``SecurityInterface``'s ``verify()`` method now has a native return type of ``static``.
32+
2933
Method Signature Changes
3034
========================
3135

0 commit comments

Comments
 (0)