Skip to content

Commit

Permalink
Run Composer\Package\Locker::fixupJsonDataType on lock data
Browse files Browse the repository at this point in the history
  • Loading branch information
kubawerlos committed Feb 2, 2025
1 parent 600b179 commit 4bff81d
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 12 deletions.
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2475,15 +2475,13 @@ None - this is a Composer's plugin, it will subscribe to Composer's events itsel
],
"aliases": [],
"minimum-stability": "stable",
- "stability-flags": {},
+ "stability-flags": [],
"stability-flags": {},
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
"php": "^7.2.5 || ^8.0"
},
- "platform-dev": {},
+ "platform-dev": [],
"platform-dev": {},
"platform-overrides": {
"php": "7.2.5"
},
Expand Down
7 changes: 7 additions & 0 deletions src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Composer\EventDispatcher\EventSubscriberInterface;
use Composer\IO\IOInterface;
use Composer\Json\JsonFile;
use Composer\Package\Locker;
use Composer\Plugin\PluginInterface;
use Composer\Script\Event;
use Composer\Script\ScriptEvents;
Expand Down Expand Up @@ -67,6 +68,12 @@ public static function clean(Event $event): void
}
}

$composerLockData = \Closure::bind(
static fn (Locker $locker) => $locker->fixupJsonDataType($composerLockData),
null,
Locker::class,
)((new \ReflectionClass(Locker::class))->newInstanceWithoutConstructor());

$lock->write($composerLockData);
}

Expand Down
4 changes: 2 additions & 2 deletions tests/fixtures/composer/expected.composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/fixtures/dist_shasum/expected.composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/fixtures/extra/expected.composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/fixtures/keeping_properties/expected.composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/fixtures/simple/expected.composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4bff81d

Please sign in to comment.