Skip to content

Conversation

@QDenka
Copy link

@QDenka QDenka commented Feb 8, 2026

Since Slim 5.x requires PHP 8.2+, we can use the $object::class syntax (available since PHP 8.0) instead of get_class($object).

Changes

Replaced get_class($exception) with $exception::class in 4 exception middleware files:

  • HtmlExceptionMiddleware
  • JsonExceptionMiddleware
  • PlainTextExceptionMiddleware
  • XmlExceptionMiddleware

Why

  • More concise and idiomatic for modern PHP
  • Consistent with static ClassName::class usage
  • Avoids unnecessary function call overhead
  • get_class() without arguments is deprecated since PHP 8.3

Since Slim 5.x requires PHP 8.2+, we can use the $object::class syntax
(available since PHP 8.0) instead of get_class($object). This is more
concise, consistent with static ::class usage, and avoids a function call.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant