feat: #3579691 Modernize codebase: OOP hooks, PHP attributes, stricter types, security fix, and expanded tests