diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 76318df..2c6d6f4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,14 +1,14 @@ name: build -on: [push, pull_request] +on: [ push, pull_request ] jobs: run: runs-on: ${{ matrix.operating-system }} strategy: matrix: - operating-system: [ubuntu-latest] - php-versions: ['7.4', '8.0', '8.1', '8.2'] + operating-system: [ ubuntu-latest ] + php-versions: [ '7.4', '8.0', '8.1', '8.2' ] name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }} steps: @@ -28,4 +28,7 @@ jobs: - name: Static analysis run: | composer require --dev phpstan/phpstan - vendor/bin/phpstan analyse -l 4 src tests + vendor/bin/phpstan analyse -l 6 src tests + + - name: Run PHPUnit + run: vendor/bin/phpunit --verbose --colors=always tests \ No newline at end of file diff --git a/src/Models/VideoInfo.php b/src/Models/VideoInfo.php index 36f74db..c1ad3e3 100644 --- a/src/Models/VideoInfo.php +++ b/src/Models/VideoInfo.php @@ -8,7 +8,7 @@ class VideoInfo { // uniquely identifies this video - public ?string $id; + public ?string $id = null; public ?string $channelId = null; public ?string $channelTitle = null; @@ -19,13 +19,13 @@ class VideoInfo public ?string $category; - public ?int $viewCount; - public ?int $commentCount; - public ?int $likeCount; - public ?int $dislikeCount; + public ?int $viewCount = null; + public ?int $commentCount = null; + public ?int $likeCount = null; + public ?int $dislikeCount = null; // in seconds - public ?int $durationSeconds; + public ?int $durationSeconds = null; // tags? public array $keywords = []; diff --git a/src/Utils/Utils.php b/src/Utils/Utils.php index 57a9e63..c793313 100644 --- a/src/Utils/Utils.php +++ b/src/Utils/Utils.php @@ -52,7 +52,7 @@ public static function extractChannel(string $url): ?string * @param mixed $default * @return mixed|null */ - public static function arrayGet($array, string $key, $default = null) + public static function arrayGet(array $array, string $key, $default = null) { foreach (explode('.', $key) as $segment) {