Skip to content

Commit

Permalink
minor #47401 Replace get_class() calls by ::class (deguif)
Browse files Browse the repository at this point in the history
This PR was squashed before being merged into the 6.2 branch.

Discussion
----------

Replace get_class() calls by ::class

| Q             | A
| ------------- | ---
| Branch?       | 6.2
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       |
| License       | MIT
| Doc PR        |

Replace `get_class()` by `::class`

Commits
-------

675601b8f7 Replace get_class() calls by ::class
  • Loading branch information
fabpot committed Sep 1, 2022
2 parents 0de8afb + 85d8361 commit e78f1bd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion JsonResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public function setData(mixed $data = []): static
try {
$data = json_encode($data, $this->encodingOptions);
} catch (\Exception $e) {
if ('Exception' === \get_class($e) && str_starts_with($e->getMessage(), 'Failed calling ')) {
if ('Exception' === $e::class && str_starts_with($e->getMessage(), 'Failed calling ')) {
throw $e->getPrevious() ?: $e;
}
throw $e;
Expand Down
2 changes: 1 addition & 1 deletion Session/Storage/NativeSessionStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ public function save()
$previousHandler = set_error_handler(function ($type, $msg, $file, $line) use (&$previousHandler) {
if (\E_WARNING === $type && str_starts_with($msg, 'session_write_close():')) {
$handler = $this->saveHandler instanceof SessionHandlerProxy ? $this->saveHandler->getHandler() : $this->saveHandler;
$msg = sprintf('session_write_close(): Failed to write session data with "%s" handler', \get_class($handler));
$msg = sprintf('session_write_close(): Failed to write session data with "%s" handler', $handler::class);
}

return $previousHandler ? $previousHandler($type, $msg, $file, $line) : false;
Expand Down

0 comments on commit e78f1bd

Please sign in to comment.