PHP 8.1 syntax updates

This commit is contained in:
Timothy Warren 2023-05-19 10:54:08 -04:00
parent 940ebd5176
commit c4d76dc86a
7 changed files with 10 additions and 10 deletions

View File

@ -52,7 +52,7 @@ final class Auth
->getSegment(SESSION_SEGMENT);
$this->model = $container->get('kitsu-model');
Event::on('::unauthorized::', [$this, 'reAuthenticate']);
Event::on('::unauthorized::', $this->reAuthenticate(...));
}
/**

View File

@ -567,7 +567,7 @@ final class Model
// this way is much faster...
foreach ($statuses as $status)
{
foreach ($this->getPages([$this, 'getThumbListPages'], strtoupper($type), $status) as $page)
foreach ($this->getPages($this->getThumbListPages(...), strtoupper($type), $status) as $page)
{
$pages[] = $page;
}
@ -597,7 +597,7 @@ final class Model
// this way is much faster...
foreach ($statuses as $status)
{
foreach ($this->getPages([$this, 'getSyncPages'], strtoupper($type), $status) as $page)
foreach ($this->getPages($this->getSyncPages(...), strtoupper($type), $status) as $page)
{
$pages[] = $page;
}
@ -627,7 +627,7 @@ final class Model
{
$pages = [];
foreach ($this->getPages([$this, 'getListPages'], strtoupper($type), strtoupper($status)) as $page)
foreach ($this->getPages($this->getListPages(...), strtoupper($type), strtoupper($status)) as $page)
{
$pages[] = $page;
}

View File

@ -56,7 +56,7 @@ final class ParallelAPIRequest
*/
public function addRequests(array $requests): self
{
array_walk($requests, [$this, 'addRequest']);
array_walk($requests, $this->addRequest(...));
return $this;
}

View File

@ -251,7 +251,7 @@ class Controller
public function notFound(
string $title = 'Sorry, page not found',
string $message = 'Page Not Found'
): void {
): never {
$this->outputHTML('404', [
'title' => $title,
'message' => $message,

View File

@ -71,7 +71,7 @@ final class User extends BaseController
$rawData = $this->kitsuModel->getUserData($username);
if ($rawData['data']['findProfileBySlug'] === NULL)
{
$this->notFound('Sorry, user not found', "The user '$username' does not seem to exist.");
$this->notFound('Sorry, user not found', "The user '{$username}' does not seem to exist.");
return;
}

View File

@ -19,8 +19,8 @@ use Attribute;
#[Attribute(Attribute::TARGET_FUNCTION | Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)]
class Route
{
public const GET = 'get';
public const POST = 'post';
final public const GET = 'get';
final public const POST = 'post';
public function __construct(
public string $name,

View File

@ -33,7 +33,7 @@ abstract class AbstractTransformer implements TransformerInterface
{
$list = (array) $collection;
return array_map([$this, 'transform'], $list);
return array_map($this->transform(...), $list);
}
/**