Skip to content

Commit debe318

Browse files
Fix update type detection problem and getting stuck in an infinite loop (checkClassType , getCheckField)
1 parent ced920d commit debe318

File tree

7 files changed

+12
-12
lines changed

7 files changed

+12
-12
lines changed

src/Type.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class Type
2727
// * @param array $data
2828
// * @return object
2929
// */
30-
// protected function checkClassType(array $data)
30+
// private function checkClassType(array $data)
3131
// {
3232
// return;
3333
// }
@@ -39,7 +39,7 @@ class Type
3939
// *
4040
// * @return array name and datas
4141
// */
42-
// protected function getCheckField()
42+
// private function getCheckField()
4343
// {
4444
// return [
4545
// 'name' => 'source',
@@ -78,12 +78,12 @@ class Type
7878
public function __construct(array $data)
7979
{
8080

81-
if (method_exists($this, 'checkClassType')) {
81+
if (is_callable([$this, 'checkClassType'])) {
8282
$class = $this->checkClassType($data);
8383
return (new $class($data));
8484
}
8585

86-
if (method_exists($this, 'getCheckField')) {
86+
if (is_callable([$this, 'getCheckField'])) {
8787

8888
$checkField = $this->getCheckField();
8989
$checkFieldName = $checkField['name'];
@@ -104,10 +104,10 @@ public function __construct(array $data)
104104
$key = Format::toCamelCase($key);
105105

106106
if (is_array($value)) {
107-
if (method_exists($this, 'getTypeVariables') && isset($this->getTypeVariables()[$key])) {
107+
if (is_callable([$this, 'getTypeVariables']) && isset($this->getTypeVariables()[$key])) {
108108
$class = $this->getTypeVariables()[$key];
109109
$value = new $class($value);
110-
} elseif (method_exists($this, 'getTypeArrayVariables') && isset($this->getTypeArrayVariables()[$key])) {
110+
} elseif (is_callable([$this, 'getTypeArrayVariables']) && isset($this->getTypeArrayVariables()[$key])) {
111111

112112
$class = $this->getTypeArrayVariables()[$key];
113113

src/Types/BotCommandScope/BotCommandScope.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class BotCommandScope extends Type
3333
*
3434
* @return array name and datas
3535
*/
36-
protected function getCheckField()
36+
private function getCheckField()
3737
{
3838
return [
3939
'name' => 'type',

src/Types/ChatMember/ChatMember.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ protected function getTypeVariables()
4646
*
4747
* @return array name and datas
4848
*/
49-
protected function getCheckField()
49+
private function getCheckField()
5050
{
5151
return [
5252
'name' => 'status',

src/Types/InlineMode/InlineQueryResult/InlineQueryResult.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class InlineQueryResult extends Type
4848
* @param array $data
4949
* @return object
5050
*/
51-
protected function checkClassType(array $data)
51+
private function checkClassType(array $data)
5252
{
5353
/**
5454
* for cached

src/Types/InlineMode/InputMessageContent/InputMessageContent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class InputMessageContent extends Type
3131
* @param array $data
3232
* @return object
3333
*/
34-
protected function checkClassType(array $data)
34+
private function checkClassType(array $data)
3535
{
3636
/**
3737
* values:

src/Types/InputMedia/InputMedia.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ protected function getTypeArrayVariables()
4545
*
4646
* @return array name and datas
4747
*/
48-
protected function getCheckField()
48+
private function getCheckField()
4949
{
5050
return [
5151
'name' => 'type',

src/Types/TelegramPassport/PassportElementError/PassportElementError.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class PassportElementError extends Type
3535
*
3636
* @return array name and datas
3737
*/
38-
protected function getCheckField()
38+
private function getCheckField()
3939
{
4040
return [
4141
'name' => 'source',

0 commit comments

Comments
 (0)