Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 2 additions & 25 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches: [ master, develop ]
pull_request:
branches: [ master, develop ]
workflow_dispatch:

permissions:
contents: read
Expand All @@ -16,40 +17,16 @@ jobs:

strategy:
matrix:
php: ['8.1', '8.2', '8.3']

services:
mariadb:
image: mariadb:10.3
ports:
- 3306:3306
env:
MYSQL_ROOT_PASSWORD: root
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
php: ['8.1', '8.2', '8.3', '8.4']

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Verify MariaDB connection
run: |
while ! mysqladmin ping -h127.0.0.1 -P3306 --silent; do
sleep 1
done

- name: Test migrations
run: |
git fetch origin 0.44.1 && git checkout FETCH_HEAD -- structure.sql
mysql -h127.0.0.1 -P3306 -uroot -proot -e "create database telegrambot_migrations; use telegrambot_migrations; source structure.sql;"
git checkout HEAD -- structure.sql
mysql -h127.0.0.1 -P3306 -uroot -proot -e "create database telegrambot; use telegrambot; source structure.sql;"
for SCHEMA_UPDATE_FILE in $(ls utils/db-schema-update); do mysql -h127.0.0.1 -P3306 -uroot -proot -e "use telegrambot_migrations; source utils/db-schema-update/${SCHEMA_UPDATE_FILE};"; done;

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: pdo_mysql

- name: Cache Composer packages
id: composer-cache
Expand Down
2 changes: 1 addition & 1 deletion src/DB.php
Original file line number Diff line number Diff line change
Expand Up @@ -1265,7 +1265,7 @@ public static function selectChats($select_chats_params)
* @return array|bool Array containing TOTAL and CURRENT fields or false on invalid arguments
* @throws TelegramException
*/
public static function getTelegramRequestCount(int $chat_id = null, string $inline_message_id = null)
public static function getTelegramRequestCount(?int $chat_id = null, ?string $inline_message_id = null)
{
if (!self::isDbConnected()) {
return false;
Expand Down
8 changes: 7 additions & 1 deletion src/Entities/PaidMedia/PaidMedia.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,13 @@ public static function getFactory($data)
// return new static($data);
// throw new TelegramException('Unsupported paid media type: ' . $type);
// Return a base PaidMedia object or handle as an error
return new class($data) extends PaidMedia { protected function subEntities(): array { return [];}};
return new class ($data) extends PaidMedia
{
protected function subEntities(): array
{
return [];
}
};
}
}
}
2 changes: 1 addition & 1 deletion src/TelegramLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class TelegramLog
* @param LoggerInterface|null $logger
* @param LoggerInterface|null $update_logger
*/
public static function initialize(LoggerInterface $logger = null, LoggerInterface $update_logger = null): void
public static function initialize(?LoggerInterface $logger = null, ?LoggerInterface $update_logger = null): void
{
self::$logger = $logger ?: new NullLogger();
self::$update_logger = $update_logger ?: new NullLogger();
Expand Down