Skip to content

Commit

Permalink
Application API type hints
Browse files Browse the repository at this point in the history
  • Loading branch information
SecondeJK committed Sep 24, 2024
1 parent 842fad3 commit 6cafd52
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 50 deletions.
27 changes: 6 additions & 21 deletions src/Application/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,32 +22,17 @@ class Application implements EntityInterface, JsonSerializable, ArrayHydrateInte
use Psr7Trait;
use JsonResponseTrait;

/**
* @var VoiceConfig
*/
protected $voiceConfig;
protected VoiceConfig $voiceConfig;

/**
* @var MessagesConfig
*/
protected $messagesConfig;
protected MessagesConfig $messagesConfig;

/**
* @var RtcConfig
*/
protected $rtcConfig;
protected RtcConfig $rtcConfig;

/**
* @var VbcConfig
*/
protected $vbcConfig;
protected VbcConfig $vbcConfig;

protected $name;
protected ?string $name = null;

/**
* @var array
*/
protected $keys = [];
protected array $keys = [];

public function __construct(protected ?string $id = null)
{
Expand Down
5 changes: 1 addition & 4 deletions src/Application/MessagesConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ class MessagesConfig
public const INBOUND = 'inbound_url';
public const STATUS = 'status_url';

/**
* @var array
*/
protected $webhooks = [];
protected array $webhooks = [];

public function setWebhook($type, $url, $method = null): self
{
Expand Down
5 changes: 1 addition & 4 deletions src/Application/RtcConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ class RtcConfig
{
public const EVENT = 'event_url';

/**
* @var array
*/
protected $webhooks = [];
protected array $webhooks = [];

public function setWebhook($type, $url, $method = null): self
{
Expand Down
5 changes: 1 addition & 4 deletions src/Application/VbcConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@

class VbcConfig
{
/**
* @var bool
*/
protected $enabled = false;
protected bool $enabled = false;

public function enable(): void
{
Expand Down
5 changes: 1 addition & 4 deletions src/Application/VoiceConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@ class VoiceConfig
'apac-australia'
];

/**
* @var array
*/
protected $webhooks = [];
protected array $webhooks = [];

public function setWebhook($type, $url, $method = null): self
{
Expand Down
15 changes: 3 additions & 12 deletions src/Client/Callback/Callback.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,9 @@ class Callback implements CallbackInterface
public const ENV_POST = 'post';
public const ENV_GET = 'get';

/**
* @var array
*/
protected $expected = [];
protected array $expected = [];

/**
* @var array
*/
protected $data;
protected array $data;

public function __construct(array $data)
{
Expand All @@ -46,10 +40,7 @@ public function getData(): array
return $this->data;
}

/**
* @return Callback|callable
*/
public static function fromEnv(string $source = self::ENV_ALL)
public static function fromEnv(string $source = self::ENV_ALL): callable|Callback
{
$data = match (strtolower($source)) {
'post' => $_POST,
Expand Down
2 changes: 1 addition & 1 deletion src/Network/Number/Callback.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
*/
class Callback extends BaseCallback
{
protected $expected = ['request_id', 'callback_part', 'callback_total_parts', 'number', 'status'];
protected array $expected = ['request_id', 'callback_part', 'callback_total_parts', 'number', 'status'];
protected $optional = [
'Type' => 'number_type',
'Network' => 'carrier_network_code',
Expand Down

0 comments on commit 6cafd52

Please sign in to comment.