Skip to content
This repository was archived by the owner on Sep 2, 2025. It is now read-only.

Commit 46abfbc

Browse files
committed
Strict PHP inspection
1 parent 57255e6 commit 46abfbc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+84
-62
lines changed

src/Abstracts/CustomType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@
1212
*/
1313
abstract class CustomType extends TelegramTypes
1414
{
15-
public $data = null;
15+
public $data = [];
1616
}

src/Abstracts/TelegramMethods.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ public function performSpecialConditions(): TelegramMethods
6868
* Exports the class to an array in order to send it to the Telegram servers without extra fields that we don't need
6969
*
7070
* @return array
71+
* @throws MissingMandatoryField
7172
*/
7273
final public function export(): array
7374
{
@@ -77,7 +78,7 @@ final public function export(): array
7778
$cleanObject = new $this();
7879
foreach ($cleanObject as $fieldId => $value) {
7980
if ($this->$fieldId === $cleanObject->$fieldId) {
80-
if (in_array($fieldId, $mandatoryFields)) {
81+
if (in_array($fieldId, $mandatoryFields, true)) {
8182
throw new MissingMandatoryField(sprintf(
8283
'The field "%s" is mandatory and empty, please correct',
8384
$fieldId

src/Interfaces/CustomArrayType.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types = 1);
4+
35
namespace unreal4u\TelegramAPI\Interfaces;
46

57
use Psr\Log\LoggerInterface;

src/Telegram/Methods/DeleteWebhook.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
use unreal4u\TelegramAPI\Abstracts\TelegramTypes;
1010
use unreal4u\TelegramAPI\InternalFunctionality\TelegramRawData;
1111
use unreal4u\TelegramAPI\Telegram\Types\Custom\ResultBoolean;
12-
use unreal4u\TelegramAPI\Telegram\Types\User;
1312

1413
/**
1514
* Use this method to remove webhook integration if you decide to switch back to getUpdates. Returns True on success.

src/Telegram/Methods/GetFile.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class GetFile extends TelegramMethods
3232
/**
3333
* This call will return an array with updates, so call up a custom type to do this
3434
*
35-
* @param array $data
35+
* @param TelegramRawData $data
3636
* @param LoggerInterface $logger
3737
* @return TelegramTypes
3838
*/

src/Telegram/Methods/GetGameScore.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,8 @@
77
use Psr\Log\LoggerInterface;
88
use unreal4u\TelegramAPI\Abstracts\TelegramMethods;
99
use unreal4u\TelegramAPI\Abstracts\TelegramTypes;
10-
use unreal4u\TelegramAPI\Exceptions\InvalidResultType;
1110
use unreal4u\TelegramAPI\InternalFunctionality\TelegramRawData;
1211
use unreal4u\TelegramAPI\Telegram\Types\Custom\GameHighScoreArray;
13-
use unreal4u\TelegramAPI\Telegram\Types\Custom\ResultBoolean;
14-
use unreal4u\TelegramAPI\Telegram\Types\Message;
1512

1613
/**
1714
* Use this method to get data for high score tables. Will return the score of the specified user and several of his

src/Telegram/Methods/GetUserProfilePhotos.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class GetUserProfilePhotos extends TelegramMethods
4040
/**
4141
* This call will return an array with updates, so call up a custom type to do this
4242
*
43-
* @param array $data
43+
* @param TelegramRawData $data
4444
* @param LoggerInterface $logger
4545
* @return TelegramTypes
4646
*/

src/Telegram/Methods/SendAudio.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace unreal4u\TelegramAPI\Telegram\Methods;
66

7+
use unreal4u\TelegramAPI\Abstracts\KeyboardMethods;
78
use unreal4u\TelegramAPI\Abstracts\TelegramMethods;
89
use unreal4u\TelegramAPI\Telegram\Types\Custom\InputFile;
910

@@ -80,9 +81,9 @@ class SendAudio extends TelegramMethods
8081
/**
8182
* Optional. Additional interface options. A JSON-serialized object for a custom reply keyboard, instructions to
8283
* hide keyboard or to force a reply from the user
83-
* @var null
84+
* @var KeyboardMethods
8485
*/
85-
public $reply_markup = null;
86+
public $reply_markup;
8687

8788
public function getMandatoryFields(): array
8889
{

src/Telegram/Methods/SendGame.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class SendGame extends TelegramMethods
4747
* hide keyboard or to force a reply from the user.
4848
* @var Markup
4949
*/
50-
public $reply_markup = null;
50+
public $reply_markup;
5151

5252
public function getMandatoryFields(): array
5353
{

src/Telegram/Types/Custom/ChatMembersArray.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,9 @@
1414
*/
1515
class ChatMembersArray extends CustomType implements CustomArrayType
1616
{
17-
public $data = [];
18-
1917
public function __construct(array $data = null, LoggerInterface $logger = null)
2018
{
21-
if (!empty($data)) {
19+
if (count($data) !== 0) {
2220
foreach ($data as $id => $chatMember) {
2321
$this->data[$id] = new ChatMember($chatMember, $logger);
2422
}

0 commit comments

Comments
 (0)