Upgrade to 3.8.0

This commit is contained in:
Bastian Allgeier
2022-10-06 10:11:54 +02:00
parent a9ed4e45ca
commit 7d168aae58
332 changed files with 26337 additions and 21977 deletions

View File

@@ -48,7 +48,7 @@ trait AppUsers
* if called with callback: Return value from the callback
* @throws \Throwable
*/
public function impersonate(?string $who = null, ?Closure $callback = null)
public function impersonate(string|null $who = null, Closure|null $callback = null)
{
$auth = $this->auth();
@@ -60,8 +60,10 @@ trait AppUsers
}
try {
// bind the App object to the callback
return $callback->call($this, $userAfter);
// TODO: switch over in 3.9.0 to
// return $callback($userAfter);
$proxy = new AppUsersImpersonateProxy($this);
return $callback->call($proxy, $userAfter);
} catch (Throwable $e) {
throw $e;
} finally {
@@ -110,7 +112,7 @@ trait AppUsers
* (when `$id` is passed as `null`)
* @return \Kirby\Cms\User|null
*/
public function user(?string $id = null, bool $allowImpersonation = true)
public function user(string|null $id = null, bool $allowImpersonation = true)
{
if ($id !== null) {
return $this->users()->find($id);
@@ -121,7 +123,7 @@ trait AppUsers
} else {
try {
return $this->auth()->user(null, $allowImpersonation);
} catch (Throwable $e) {
} catch (Throwable) {
return null;
}
}
@@ -134,7 +136,7 @@ trait AppUsers
*/
public function users()
{
if (is_a($this->users, 'Kirby\Cms\Users') === true) {
if ($this->users instanceof Users) {
return $this->users;
}