diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 4006475..0d0b19c 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -8,26 +8,28 @@ on: jobs: build: - runs-on: ubuntu-latest strategy: matrix: - php: [8.1, 8.2] + php: [8.0, 8.1, 8.2, 8.3, 8.4, 8.5] steps: - - uses: actions/checkout@v2 + - name: Checkout code + uses: actions/checkout@v4 - - name: Set PHP version - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: none + tools: composer - - name: Install dependencies - run: composer update --prefer-dist --no-progress --no-suggest + - name: Install dependencies + run: composer update --prefer-dist --no-progress --no-interaction - - name: Execute PHPUnit - run: vendor/bin/phpunit + - name: Run PHPUnit + run: vendor/bin/phpunit - - name: Execute PHPStan analyse - run: vendor/bin/phpstan \ No newline at end of file + - name: Run PHPStan + run: vendor/bin/phpstan analyse diff --git a/composer.json b/composer.json index bd76d89..537f660 100644 --- a/composer.json +++ b/composer.json @@ -16,11 +16,11 @@ } ], "require": { - "php": "^8.1" + "php": "^8.0" }, "require-dev": { "phpunit/phpunit": "^9.0", - "symfony/var-dumper": "^6.3", + "symfony/var-dumper": "^5.4", "phpstan/phpstan": "^1.10" }, "autoload": { diff --git a/src/Manager.php b/src/Manager.php index 9e091ba..a88a23d 100644 --- a/src/Manager.php +++ b/src/Manager.php @@ -6,10 +6,15 @@ abstract class Manager { + protected Aggregator $aggregator; + public function __construct( protected bool $singleton = false, - protected Aggregator $aggregator = new Aggregator(), - ) {} + ?Aggregator $aggregator = null, + ) { + // php8.0 retro-compatibility + $this->aggregator = $aggregator ?? new Aggregator(); + } /** * Get the default driver name. @@ -30,7 +35,7 @@ public function __call(string $method, array $parameters): mixed * @throws \DeGraciaMathieu\Manager\Exceptions\DriverOverwrittenException * @throws \DeGraciaMathieu\Manager\Exceptions\DriverResolutionException */ - public function driver(string $name = null): mixed + public function driver(?string $name = null): mixed { $name = $name ?: $this->getDefaultDriver();