diff --git a/.github/workflows/qa.yml b/.github/workflows/qa.yml index 524b2c2..96b1b7c 100644 --- a/.github/workflows/qa.yml +++ b/.github/workflows/qa.yml @@ -42,7 +42,7 @@ jobs: strategy: matrix: os: [ ubuntu-latest, macos-latest, windows-latest ] - php: [8.1, 8.2, 8.3] + php: [8.1, 8.2, 8.3, 8.4] dependencies: [locked] include: - os: ubuntu-latest @@ -54,6 +54,9 @@ jobs: - os: ubuntu-latest php: 8.3 dependencies: lowest + - os: ubuntu-latest + php: 8.4 + dependencies: lowest steps: - uses: actions/checkout@v4 - uses: shivammathur/setup-php@v2 diff --git a/composer.json b/composer.json index 38f92d5..53bbdd8 100644 --- a/composer.json +++ b/composer.json @@ -34,19 +34,17 @@ "symfony/console": "^6.0", "symfony/filesystem": "^6.0", "symfony/http-client": "^6.0", - "symfony/polyfill-php80": "^1.28", "symfony/process": "^6.0", - "thecodingmachine/safe": "^2.0" + "thecodingmachine/safe": "^3.0" }, "require-dev": { "doctrine/coding-standard": "^12.0", - "phpstan/phpstan": "^1.10", - "phpstan/phpstan-phpunit": "^1.3", - "phpstan/phpstan-strict-rules": "^1.5", + "phpstan/phpstan": "^2.0", + "phpstan/phpstan-phpunit": "^2.0", + "phpstan/phpstan-strict-rules": "^2.0", "phpunit/phpunit": "^10.0", "roave/security-advisories": "dev-latest", - "thecodingmachine/phpstan-safe-rule": "^1.2", - "thecodingmachine/phpstan-strict-rules": "^1.0" + "thecodingmachine/phpstan-safe-rule": "^1.2" }, "autoload": { "psr-4": { diff --git a/phpstan.neon b/phpstan.neon index a155464..d7431fb 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,5 +1,5 @@ parameters: - level: max + level: 9 paths: - src - tests @@ -8,5 +8,4 @@ parameters: includes: - vendor/phpstan/phpstan-strict-rules/rules.neon - vendor/phpstan/phpstan-phpunit/extension.neon - - vendor/thecodingmachine/phpstan-safe-rule/phpstan-safe-rule.neon - - vendor/thecodingmachine/phpstan-strict-rules/phpstan-strict-rules.neon \ No newline at end of file + - vendor/thecodingmachine/phpstan-safe-rule/phpstan-safe-rule.neon \ No newline at end of file diff --git a/src/Command/DetectCommand.php b/src/Command/DetectCommand.php index 28398b0..b919b08 100644 --- a/src/Command/DetectCommand.php +++ b/src/Command/DetectCommand.php @@ -81,7 +81,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int if ($innerReturnCode > $returnCode) { $returnCode = $innerReturnCode; } - } catch (Throwable $exception) { // @phpstan-ignore-line + } catch (Throwable $exception) { if ($io->isVerbose()) { $io->warning(sprintf('Could not execute command "%s".', $commandName)); } diff --git a/src/Command/Input/CpuArchitectureOption.php b/src/Command/Input/CpuArchitectureOption.php index 8b800cc..a2de4a7 100644 --- a/src/Command/Input/CpuArchitectureOption.php +++ b/src/Command/Input/CpuArchitectureOption.php @@ -52,7 +52,7 @@ public function description(): string ); } - public function default(): string|null + public function default(): string { return CpuArchitecture::detectFromPhp()->value; } diff --git a/src/Command/Input/InstallPathArgument.php b/src/Command/Input/InstallPathArgument.php index 7b3eeb4..a62e47a 100644 --- a/src/Command/Input/InstallPathArgument.php +++ b/src/Command/Input/InstallPathArgument.php @@ -38,7 +38,7 @@ public function description(): string return 'Location where the driver will be installed'; } - public function default(): string|null + public function default(): string { return '.'; } diff --git a/src/Command/Input/OperatingSystemOption.php b/src/Command/Input/OperatingSystemOption.php index 78a5635..9974cce 100644 --- a/src/Command/Input/OperatingSystemOption.php +++ b/src/Command/Input/OperatingSystemOption.php @@ -55,7 +55,7 @@ public function description(): string ); } - public function default(): string|null + public function default(): string { return OperatingSystem::fromFamily(Family::from(PHP_OS_FAMILY))->value; } diff --git a/src/Command/Input/VersionOption.php b/src/Command/Input/VersionOption.php index e9597f4..b2c5725 100644 --- a/src/Command/Input/VersionOption.php +++ b/src/Command/Input/VersionOption.php @@ -57,7 +57,7 @@ public function description(): string return 'Driver version to install'; } - public function default(): string|null + public function default(): string { return self::LATEST; } diff --git a/src/Driver/GeckoDriver/Downloader.php b/src/Driver/GeckoDriver/Downloader.php index e080827..235fd1c 100644 --- a/src/Driver/GeckoDriver/Downloader.php +++ b/src/Driver/GeckoDriver/Downloader.php @@ -9,7 +9,6 @@ use DBrekelmans\BrowserDriverInstaller\Driver\Downloader as DownloaderInterface; use DBrekelmans\BrowserDriverInstaller\Driver\Driver; use DBrekelmans\BrowserDriverInstaller\Driver\DriverName; -use DBrekelmans\BrowserDriverInstaller\Exception\NotImplemented; use DBrekelmans\BrowserDriverInstaller\OperatingSystem\OperatingSystem; use RuntimeException; use Safe\Exceptions\FilesystemException; @@ -47,7 +46,7 @@ public function download(Driver $driver, string $location): string { try { $archive = $this->downloadArchive($driver); - } catch (NotImplemented | FilesystemException | IOException | TransportExceptionInterface $exception) { + } catch (FilesystemException | IOException | TransportExceptionInterface $exception) { throw new RuntimeException('Something went wrong downloading the geckodriver archive.', 0, $exception); } diff --git a/src/Driver/GeckoDriver/VersionResolver.php b/src/Driver/GeckoDriver/VersionResolver.php index 32c5440..5b85bba 100644 --- a/src/Driver/GeckoDriver/VersionResolver.php +++ b/src/Driver/GeckoDriver/VersionResolver.php @@ -11,6 +11,7 @@ use RuntimeException; use Symfony\Contracts\HttpClient\HttpClientInterface; +use function krsort; use function Safe\json_decode; use function sprintf; diff --git a/src/Version.php b/src/Version.php index 7a5c1ff..bee4827 100644 --- a/src/Version.php +++ b/src/Version.php @@ -46,10 +46,10 @@ public static function fromString(string $versionString): self } return new self( - (string) $matches['major'], - (string) $matches['minor'], - isset($matches['patch']) ? (string) $matches['patch'] : null, - isset($matches['build']) ? (string) $matches['build'] : null, + $matches['major'], + $matches['minor'], + $matches['patch'] ?? null, + $matches['build'] ?? null, ); } catch (PcreException $exception) { throw new InvalidArgumentException(