1
0
mirror of https://github.com/flarum/core.git synced 2025-08-12 03:14:33 +02:00

chore: update codebase to php8.1 (#3827)

* chore: set minimum php version to 8.1

Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>

* chore: update codebase to php8.1

Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>

* Apply fixes from StyleCI

* chore: update workflow php version

Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>

* fix: caught errors

Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>

* fix: more caught errors

Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>

* fix: phpstan caught errors

Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>

* Apply fixes from StyleCI

* fix: test-caught errors

Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>

* fix: test-caught errors

Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>

* fix: test-caught errors

Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>

* fix: introduce `Flarum\Locale\TranslatorInterface`

Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>

* Apply fixes from StyleCI

* chore: remove mixin

Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>

* fix: test-caught errors

Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>

* fix: one last error

Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>

---------

Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
Co-authored-by: StyleCI Bot <bot@styleci.io>
This commit is contained in:
Sami Mazouz
2023-05-30 11:36:12 +01:00
committed by GitHub
parent 34a04b0746
commit 6f11e044a7
703 changed files with 4329 additions and 12772 deletions

View File

@@ -21,23 +21,11 @@ use Pusher;
class AuthController implements RequestHandlerInterface
{
/**
* @var SettingsRepositoryInterface
*/
protected $settings;
/**
* @param SettingsRepositoryInterface $settings
*/
public function __construct(SettingsRepositoryInterface $settings)
{
$this->settings = $settings;
public function __construct(
protected SettingsRepositoryInterface $settings
) {
}
/**
* @param ServerRequestInterface $request
* @return ResponseInterface
*/
public function handle(ServerRequestInterface $request): ResponseInterface
{
$userChannel = 'private-user'.RequestUtil::getActor($request)->id;

View File

@@ -18,23 +18,13 @@ use Pusher;
class PushNewPost
{
/**
* @var Pusher
*/
protected $pusher;
/**
* @var ExtensionManager
*/
protected $extensions;
public function __construct(Pusher $pusher, ExtensionManager $extensions)
{
$this->pusher = $pusher;
$this->extensions = $extensions;
public function __construct(
protected Pusher $pusher,
protected ExtensionManager $extensions
) {
}
public function handle(Posted $event)
public function handle(Posted $event): void
{
$channels = [];

View File

@@ -11,13 +11,14 @@ namespace Flarum\Pusher\Provider;
use Flarum\Foundation\AbstractServiceProvider;
use Flarum\Settings\SettingsRepositoryInterface;
use Pusher;
class PusherProvider extends AbstractServiceProvider
{
public function register()
public function register(): void
{
$this->app->bind(\Pusher::class, function () {
$settings = $this->app->make(SettingsRepositoryInterface::class);
$this->container->bind(Pusher::class, function () {
$settings = $this->container->make(SettingsRepositoryInterface::class);
$options = [];
@@ -25,7 +26,7 @@ class PusherProvider extends AbstractServiceProvider
$options['cluster'] = $cluster;
}
return new \Pusher(
return new Pusher(
$settings->get('flarum-pusher.app_key'),
$settings->get('flarum-pusher.app_secret'),
$settings->get('flarum-pusher.app_id'),

View File

@@ -15,19 +15,11 @@ use Illuminate\Contracts\Queue\Queue;
class PusherNotificationDriver implements NotificationDriverInterface
{
/**
* @var Queue
*/
protected $queue;
public function __construct(Queue $queue)
{
$this->queue = $queue;
public function __construct(
protected Queue $queue
) {
}
/**
* {@inheritDoc}
*/
public function send(BlueprintInterface $blueprint, array $users): void
{
if (count($users)) {
@@ -35,9 +27,6 @@ class PusherNotificationDriver implements NotificationDriverInterface
}
}
/**
* {@inheritDoc}
*/
public function registerType(string $blueprintClass, array $driversEnabledByDefault): void
{
// ...

View File

@@ -16,23 +16,14 @@ use Pusher;
class SendPusherNotificationsJob extends AbstractJob
{
/**
* @var BlueprintInterface
*/
private $blueprint;
/**
* @var User[]
*/
private $recipients;
public function __construct(BlueprintInterface $blueprint, array $recipients)
{
$this->blueprint = $blueprint;
$this->recipients = $recipients;
public function __construct(
private readonly BlueprintInterface $blueprint,
/** @var User[] */
private readonly array $recipients
) {
}
public function handle(Pusher $pusher)
public function handle(Pusher $pusher): void
{
foreach ($this->recipients as $user) {
if ($user->shouldAlert($this->blueprint::getType())) {