Skip to content

Commit

Permalink
Migrate to composer runtime api v2
Browse files Browse the repository at this point in the history
  • Loading branch information
xificurk committed Aug 29, 2021
1 parent dca01cc commit d0c074a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions .github/dependabot.yml
Expand Up @@ -17,3 +17,4 @@ updates:
- dependency-name: "nette/di"
- dependency-name: "nette/http"
- dependency-name: "nette/caching"
- dependency-name: "composer-runtime-api"
4 changes: 3 additions & 1 deletion composer.json
Expand Up @@ -36,7 +36,9 @@
"nette/bootstrap": "^3.0@dev",
"nette/di": "^3.0.5@dev",
"nette/http": "^3.0@dev",
"nette/caching": "^3.0@dev"
"nette/caching": "^3.0@dev",
"composer-runtime-api": "^2.0",
"composer/semver": "3.2.5"
},
"suggest": {
"nette/di": "for integration with Nette DI container"
Expand Down
8 changes: 4 additions & 4 deletions tests/PHPStan/conditional.config.tests.php
@@ -1,6 +1,8 @@
<?php
declare(strict_types = 1);

use Composer\InstalledVersions;
use Composer\Semver\VersionParser;
use Nette\Bridges\ApplicationLatte\LatteFactory;

$config = [];
Expand All @@ -14,9 +16,7 @@
];
}

// Read nette/forms version from bundled package.json, this should be replaced by Composer v2 runtime package version API
$netteFormsVersion = json_decode((string) file_get_contents(__DIR__ . '/../../vendor/nette/forms/package.json'))->version;
if (version_compare($netteFormsVersion, '3.0.5', '<')) {
if (InstalledVersions::satisfies(new VersionParser(), 'nette/forms', '<3.0.5')) {
// false positive, fixed in nette/forms 3.0.5
$config['parameters']['ignoreErrors'][] = [
'message' => '~Parameter #1 \\$value of method Nette\\\\Forms\\\\Controls\\\\MultiChoiceControl::setDisabled\\(\\) expects array<bool>\\|bool, array<int, string> given~',
Expand All @@ -25,7 +25,7 @@
];
}

if (version_compare($netteFormsVersion, '3.1.2', '>=')) {
if (InstalledVersions::satisfies(new VersionParser(), 'nette/forms', '>=3.1.2')) {
// method available since nette/forms 3.1.2
$config['parameters']['ignoreErrors'][] = [
'message' => '~Call to function method_exists\\(\\) with Nette\\\\Forms\\\\Form and \'initialize\' will always evaluate to true~',
Expand Down

0 comments on commit d0c074a

Please sign in to comment.