Skip to content

Commit

Permalink
Remove phpstan as dev dependency from split packages.
Browse files Browse the repository at this point in the history
Use the phpstan version from the main composer.json for split package checks for consistency.
  • Loading branch information
ADmad committed Aug 29, 2024
1 parent 3cea64b commit 2aac6ee
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 11 deletions.
10 changes: 9 additions & 1 deletion contrib/validate-split-packages-phpstan.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,22 @@
}
ksort($packages);

$mainJsonContent = file_get_contents(dirname(__FILE__, 2) . DS . 'composer.json');
$mainJson = json_decode($mainJsonContent, true);
$composerCommand = 'composer require --dev phpstan/phpstan:' . $mainJson['require-dev']['phpstan/phpstan'];

$issues = [];
foreach ($packages as $path => $package) {
if (!file_exists($path . 'phpstan.neon.dist')) {
continue;
}

$exitCode = null;
exec('cd ' . $path . ' && composer install && vendor/bin/phpstan analyze ./', $output, $exitCode);
exec(
'cd ' . $path . ' && ' . $composerCommand . ' && vendor/bin/phpstan analyze ./',
$output,
$exitCode
);
if ($exitCode !== 0) {
$code = $exitCode;

Expand Down
3 changes: 1 addition & 2 deletions src/Database/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
},
"require-dev": {
"cakephp/i18n": "^5.0",
"cakephp/log": "^5.0",
"phpstan/phpstan": "1.12.0"
"cakephp/log": "^5.0"
}
}
3 changes: 1 addition & 2 deletions src/Datasource/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
"require-dev": {
"cakephp/cache": "^5.0",
"cakephp/collection": "^5.0",
"cakephp/utility": "^5.0",
"phpstan/phpstan": "1.12.0"
"cakephp/utility": "^5.0"
}
}
3 changes: 1 addition & 2 deletions src/Http/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
"cakephp/console": "^5.0",
"cakephp/orm": "^5.0",
"cakephp/i18n": "^5.0",
"paragonie/csp-builder": "^2.3",
"phpstan/phpstan": "1.12.0"
"paragonie/csp-builder": "^2.3"
}
}
3 changes: 1 addition & 2 deletions src/ORM/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
},
"require-dev": {
"cakephp/cache": "^5.0",
"cakephp/i18n": "^5.0",
"phpstan/phpstan": "1.12.0"
"cakephp/i18n": "^5.0"
}
}
3 changes: 1 addition & 2 deletions src/Validation/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
}
},
"require-dev": {
"cakephp/i18n": "^5.0",
"phpstan/phpstan": "1.12.0"
"cakephp/i18n": "^5.0"
}
}

0 comments on commit 2aac6ee

Please sign in to comment.