Add PHP 7.4+ type hints to helpers, models, and middleware
Added strict typing with parameter types, return types, and property types across all core classes: - helpers: Database, ErrorHandler, CacheHelper - models: TicketModel, UserModel, WorkflowModel, TemplateModel, UserPreferencesModel - middleware: RateLimitMiddleware, CsrfMiddleware, SecurityHeadersMiddleware Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -5,14 +5,14 @@
|
||||
* Applies security-related HTTP headers to all responses.
|
||||
*/
|
||||
class SecurityHeadersMiddleware {
|
||||
private static $nonce = null;
|
||||
private static ?string $nonce = null;
|
||||
|
||||
/**
|
||||
* Generate or retrieve the CSP nonce for this request
|
||||
*
|
||||
* @return string The nonce value
|
||||
*/
|
||||
public static function getNonce() {
|
||||
public static function getNonce(): string {
|
||||
if (self::$nonce === null) {
|
||||
self::$nonce = base64_encode(random_bytes(16));
|
||||
}
|
||||
@@ -22,7 +22,7 @@ class SecurityHeadersMiddleware {
|
||||
/**
|
||||
* Apply security headers to the response
|
||||
*/
|
||||
public static function apply() {
|
||||
public static function apply(): void {
|
||||
$nonce = self::getNonce();
|
||||
|
||||
// Content Security Policy - restricts where resources can be loaded from
|
||||
|
||||
Reference in New Issue
Block a user