diff options
| author | 2024-11-28 17:11:04 +0100 | |
|---|---|---|
| committer | 2024-11-28 17:11:04 +0100 | |
| commit | 15745d42b779ad14efde2932ab116f45eee39246 (patch) | |
| tree | 2528a36184d8152d4f2d90dc73df680f84bbe1d1 /app/Models/Share.php | |
| parent | 604b186638276203c8495a3ee86da0cc240ab4d0 (diff) | |
Upgrade code to php 8.1 (#6748)
* revert
Fix code indentation
Fix code
Upgrade code to php 8.1
* fix remarques
* code review
* code review
* code review
* Apply suggestions from code review
* code review
* Fixes
* Many remainging updates of array syntax
* Lost case 'reading-list'
* Uneeded PHPDoc
---------
Co-authored-by: Luc Sanchez <l.sanchez-prestataire@alptis.fr>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
Diffstat (limited to 'app/Models/Share.php')
| -rw-r--r-- | app/Models/Share.php | 39 |
1 files changed, 14 insertions, 25 deletions
diff --git a/app/Models/Share.php b/app/Models/Share.php index 2df9dd4d9..847127466 100644 --- a/app/Models/Share.php +++ b/app/Models/Share.php @@ -68,33 +68,20 @@ class FreshRSS_Share { public static function get(string $type): ?FreshRSS_Share { return self::$list_sharing[$type] ?? null; } - - - private string $type; - private string $name; - private string $url_transform; - /** @var array<callable>|array<string,array<callable>> */ - private array $transforms; + private readonly string $name; /** * @phpstan-var 'simple'|'advanced' */ - private string $form_type; - private string $help_url; + private readonly string $form_type; private ?string $custom_name = null; private ?string $base_url = null; private ?string $id = null; private ?string $title = null; private ?string $link = null; - private bool $isDeprecated; /** * @phpstan-var 'GET'|'POST' */ private string $method; - private ?string $field; - /** - * @phpstan-var 'button'|null - */ - private ?string $HTMLtag; /** * Create a FreshRSS_Share object. @@ -108,15 +95,18 @@ class FreshRSS_Share { * @param 'GET'|'POST' $method defines the sharing method (GET or POST) * @param 'button'|null $HTMLtag */ - private function __construct(string $type, string $url_transform, array $transforms, string $form_type, - string $help_url, string $method, ?string $field, ?string $HTMLtag, bool $isDeprecated = false) { - $this->type = $type; - $this->name = _t('gen.share.' . $type); - $this->url_transform = $url_transform; - $this->help_url = $help_url; - $this->HTMLtag = $HTMLtag; - $this->isDeprecated = $isDeprecated; - $this->transforms = $transforms; + private function __construct( + private readonly string $type, + private readonly string $url_transform, + private array $transforms, + string $form_type, + private readonly string $help_url, + string $method, + private ?string $field, + private readonly ?string $HTMLtag, + private readonly bool $isDeprecated = false + ) { + $this->name = _t('gen.share.' . $this->type); if (!in_array($form_type, ['simple', 'advanced'], true)) { $form_type = 'simple'; @@ -126,7 +116,6 @@ class FreshRSS_Share { $method = 'GET'; } $this->method = $method; - $this->field = $field; } /** |
