Skip to content

Commit

Permalink
CI: Inline phpstan type aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
pprkut committed May 27, 2024
1 parent f60948e commit c864db7
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 15 deletions.
52 changes: 52 additions & 0 deletions src/Lunr/Vortex/FCM/FCMAndroidPayload.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,58 @@

/**
* Firebase Cloud Messaging Push Notification Android Payload Generator.
*
* @phpstan-type FcmColor array{
* red: int|float,
* green: int|float,
* blue: int|float,
* alpha: int|float
* }
* @phpstan-type FcmLightSettings array{
* color?: FcmColor,
* light_on_duration?: string,
* light_off_duration?: string
* }
* @phpstan-type FcmAndroidNotification array{
* title?: string,
* body?: string,
* icon?: string,
* color?: string,
* sound?: string,
* tag?: string,
* click_action?: string,
* body_loc_key?: string,
* body_loc_args?: string[],
* title_loc_key?: string,
* title_loc_args?: string[],
* channel_id?: string,
* ticker?: string,
* sticky?: bool,
* event_time?: string,
* local_only?: bool,
* notification_priority?: value-of<FCMNotificationPriority>,
* default_sound?: bool,
* default_vibrate_timings?: bool,
* default_light_settings?: bool,
* vibrate_timings?: string[],
* visibility?: value-of<FCMVisibility>,
* notification_count?: int,
* light_settings?: FcmLightSettings[],
* image?: string
* }
* @phpstan-type FcmAndroidOptions array{
* analytics_label?: string
* }
* @phpstan-type FcmAndroidConfig array{
* collapse_key?: string,
* priority?: value-of<FCMAndroidPriority>,
* ttl?: string,
* restricted_package_name?: string,
* data?: array<string, string>,
* notification?: FcmAndroidNotification,
* fcm_options?: FcmAndroidOptions,
* direct_boot_ok?: bool
* }
*/
class FCMAndroidPayload
{
Expand Down
10 changes: 10 additions & 0 deletions src/Lunr/Vortex/FCM/FCMApnsPayload.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@

/**
* Firebase Cloud Messaging Push Notification APNS Payload Generator.
*
* @phpstan-type FcmApnsOptions array{
* analytics_label?: string,
* image?: string
* }
* @phpstan-type FcmApnsConfig array{
* headers?: array<string,string>,
* payload?: array<string, mixed>,
* fcm_options?: FcmApnsOptions
* }
*/
class FCMApnsPayload
{
Expand Down
23 changes: 23 additions & 0 deletions src/Lunr/Vortex/FCM/FCMPayload.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,29 @@

/**
* Firebase Cloud Messaging Push Notification Payload Generator.
*
* @phpstan-import-type FcmAndroidConfig from FCMAndroidPayload
* @phpstan-import-type FcmApnsConfig from FCMApnsPayload
* @phpstan-type FcmNotification array{
* title?: string,
* body?: string,
* image?: string
* }
* @phpstan-type FcmOptions array{
* analytics_label?: string
* }
* @phpstan-type FcmPayloadData array{
* name?: string,
* data?: array<string,string>,
* notification?: FcmNotification,
* android?: FcmAndroidConfig,
* apns?: FcmApnsConfig,
* fcm_options?: FcmOptions,
* token?: string,
* topic?: string,
* condition?: string
* }
* @phpstan-type FcmOptionKeys "analytics_label"
*/
class FCMPayload
{
Expand Down
15 changes: 0 additions & 15 deletions tests/phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,3 @@ parameters:
- phpstan.autoload.inc.php
excludePaths:
- ../src/*/Tests/*
typeAliases:
FcmNotification: 'array{title?: string, body?: string, image?: string}'
FcmOptions: 'array{analytics_label?: string}'
FcmOptionKeys: '"analytics_label"'
FcmAndroidMessagePriority: '"NORMAL"|"HIGH"'
FcmNotificationPriority: '"PRIORITY_UNSPECIFIED"|"PRIORITY_MIN"|"PRIORITY_LOW"|"PRIORITY_DEFAULT"|"PRIORITY_HIGH"|"PRIORITY_MAX"'
FcmVisibility: '"VISIBILITY_UNSPECIFIED"|"PRIVATE"|"PUBLIC"|"SECRET"'
FcmColor: 'array{red: int|float, green: int|float, blue: int|float, alpha: int|float}'
FcmLightSettings: 'array{color?: FcmColor, light_on_duration?: string, light_off_duration?: string}'
FcmAndroidNotification: 'array{title?: string, body?: string, icon?: string, color?: string, sound?: string, tag?: string, click_action?: string, body_loc_key?: string, body_loc_args?: string[], title_loc_key?: string, title_loc_args?: string[], channel_id?: string, ticker?: string, sticky?: bool, event_time?: string, local_only?: bool, notification_priority?: FcmNotificationPriority, default_sound?: bool, default_vibrate_timings?: bool, default_light_settings?: bool, vibrate_timings?: string[], visibility?: FcmVisibility, notification_count?: int, light_settings?: FcmLightSettings[], image?: string}'
FcmAndroidOptions: 'array{analytics_label?: string}'
FcmAndroidConfig: 'array{collapse_key?: string, priority?: FcmAndroidMessagePriority, ttl?: string, restricted_package_name?: string, data?: array<string, string>, notification?: FcmAndroidNotification, fcm_options?: FcmAndroidOptions, direct_boot_ok?: bool}'
FcmApnsOptions: 'array{analytics_label?: string, image?: string}'
FcmApnsConfig: 'array{headers?: array<string,string>, payload?: array<string, mixed>, fcm_options?: FcmApnsOptions}'
FcmPayloadData: 'array{name?: string, data?: array<string,string>, notification?: FcmNotification, android?: FcmAndroidConfig, apns?: FcmApnsConfig, fcm_options?: FcmOptions, token?: string, topic?: string, condition?: string}'

0 comments on commit c864db7

Please sign in to comment.