diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 87764e11..83816d49 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -5,6 +5,7 @@ on: branches: [ master, develop ] pull_request: branches: [ master, develop ] + workflow_dispatch: permissions: contents: read @@ -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 diff --git a/src/DB.php b/src/DB.php index 83b88a76..b1fdd331 100644 --- a/src/DB.php +++ b/src/DB.php @@ -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; diff --git a/src/Entities/PaidMedia/PaidMedia.php b/src/Entities/PaidMedia/PaidMedia.php index 5f84d8c0..d3d066f2 100644 --- a/src/Entities/PaidMedia/PaidMedia.php +++ b/src/Entities/PaidMedia/PaidMedia.php @@ -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 []; + } + }; } } } diff --git a/src/TelegramLog.php b/src/TelegramLog.php index 449256ee..f3ab0661 100644 --- a/src/TelegramLog.php +++ b/src/TelegramLog.php @@ -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();