Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
  • Loading branch information
crynobone committed Nov 20, 2024
1 parent a6ac3b5 commit 840c21f
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 48 deletions.
9 changes: 7 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
},
"require-dev": {
"laravel/dusk": "^5.8.2 || ^6.0 || ^7.0 || ^8.0",
"phpstan/phpstan": "^1.10.7",
"phpstan/phpstan": "^1.12",
"phpunit/phpunit": "^9.6"
},
"conflict": {
Expand All @@ -58,7 +58,12 @@
}
},
"scripts": {
"test": "@php vendor/bin/phpunit -c ./ --color"
"lint": "@php vendor/bin/phpstan analyse --verbose",
"test": "@php vendor/bin/phpunit -c ./ --color",
"ci": [
"@lint",
"@test"
]
},
"minimum-stability": "stable"
}
6 changes: 4 additions & 2 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ parameters:
# The level 8 is the highest level
level: 8

ignoreErrors:
# - identifier: missingType.generics
- identifier: missingType.iterableValue

treatPhpDocTypesAsCertain: false
checkMissingIterableValueType: false
checkGenericClassInNonGenericObjectType: false
21 changes: 4 additions & 17 deletions src/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,8 @@ class Command extends SymfonyCommand
*/
protected $withSslVerification = true;

/**
* Configure the command options.
*
* @return void
*/
/** {@inheritDoc */
#[\Override]
protected function configure()
{
$this->ignoreValidationErrors();
Expand All @@ -54,18 +51,8 @@ protected function configure()
->addOption('ssl-no-verify', null, InputOption::VALUE_NONE, 'Bypass SSL certificate verification when installing through a proxy');
}

/**
* Initializes the command after the input has been bound and before the input
* is validated.
*
* This is mainly useful when a lot of commands extends one main command
* where some things need to be initialized based on the input arguments and options.
*
* @see InputInterface::bind()
* @see InputInterface::validate()
*
* @return void
*/
/** {@inheritDoc */
#[\Override]
protected function initialize(InputInterface $input, OutputInterface $output)
{
$this->directory = $input->getOption('install-dir');
Expand Down
10 changes: 3 additions & 7 deletions src/Concerns/DetectsChromeVersion.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ trait DetectsChromeVersion
/**
* The legacy versions for the ChromeDriver.
*
* @var array
* @var array<int, string>
*/
protected $legacyVersions = [
43 => '2.20',
Expand Down Expand Up @@ -130,9 +130,7 @@ protected function installedChromeVersion(string $operatingSystem, $directory =
continue;
}

preg_match('/(\d+)\.(\d+)\.(\d+)(\.\d+)?/', $process->getOutput(), $matches);

if (! isset($matches[1])) {
if (preg_match('/(\d+)\.(\d+)\.(\d+)(\.\d+)?/', $process->getOutput(), $matches) === false) {
continue;
}

Expand Down Expand Up @@ -175,9 +173,7 @@ protected function installedChromeDriverVersion(string $operatingSystem, string
$process->run();

if ($process->getExitCode() == 0) {
preg_match('/ChromeDriver\s(\d+)\.(\d+)\.(\d+)(\.\d+)?\s[\w\D]+/', $process->getOutput(), $matches);

if (isset($matches[1])) {
if (preg_match('/ChromeDriver\s(\d+)\.(\d+)\.(\d+)(\.\d+)?\s[\w\D]+/', $process->getOutput(), $matches) !== false) {
$semver = implode('.', [$matches[1], $matches[2], $matches[3]]);

return [
Expand Down
14 changes: 4 additions & 10 deletions src/DetectCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,8 @@
*/
class DetectCommand extends Command
{
/**
* Configure the command options.
*
* @return void
*/
/** {@inheritDoc */
#[\Override]
protected function configure()
{
$this->setName('detect')
Expand All @@ -29,11 +26,8 @@ protected function configure()
parent::configure();
}

/**
* Execute the command.
*
* @return int 0 if everything went fine, or an exit code
*/
/** {@inheritDoc */
#[\Override]
protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
Expand Down
14 changes: 4 additions & 10 deletions src/UpdateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,8 @@
*/
class UpdateCommand extends Command
{
/**
* Configure the command options.
*
* @return void
*/
/** {@inheritDoc */
#[\Override]
protected function configure()
{
$this->setName('update')
Expand All @@ -31,11 +28,8 @@ protected function configure()
parent::configure();
}

/**
* Execute the command.
*
* @return int 0 if everything went fine, or an exit code
*/
/** {@inheritDoc */
#[\Override]
protected function execute(InputInterface $input, OutputInterface $output)
{
$version = $this->version($input);
Expand Down

0 comments on commit 840c21f

Please sign in to comment.