@@ -149,8 +149,18 @@ public function postUpdate(Event $event)
149
149
$ composer ->getPackage ()->getRequires (),
150
150
$ composer ->getPackage ()->getDevRequires (),
151
151
];
152
+ $ pinnedAbstractions = [];
153
+ $ pinned = $ composer ->getPackage ()->getExtra ()['discovery ' ] ?? [];
154
+ foreach (self ::INTERFACE_MAP as $ abstraction => $ interfaces ) {
155
+ foreach (isset ($ pinned [$ abstraction ]) ? [] : $ interfaces as $ interface ) {
156
+ if (!isset ($ pinned [$ interface ])) {
157
+ continue 2 ;
158
+ }
159
+ }
160
+ $ pinnedAbstractions [$ abstraction ] = true ;
161
+ }
152
162
153
- $ missingRequires = $ this ->getMissingRequires ($ repo , $ requires , 'project ' === $ composer ->getPackage ()->getType ());
163
+ $ missingRequires = $ this ->getMissingRequires ($ repo , $ requires , 'project ' === $ composer ->getPackage ()->getType (), $ pinnedAbstractions );
154
164
$ missingRequires = [
155
165
'require ' => array_fill_keys (array_merge ([], ...array_values ($ missingRequires [0 ])), '* ' ),
156
166
'require-dev ' => array_fill_keys (array_merge ([], ...array_values ($ missingRequires [1 ])), '* ' ),
@@ -229,7 +239,7 @@ public function postUpdate(Event $event)
229
239
}
230
240
}
231
241
232
- public function getMissingRequires (InstalledRepositoryInterface $ repo , array $ requires , bool $ isProject ): array
242
+ public function getMissingRequires (InstalledRepositoryInterface $ repo , array $ requires , bool $ isProject, array $ pinnedAbstractions ): array
233
243
{
234
244
$ allPackages = [];
235
245
$ devPackages = method_exists ($ repo , 'getDevPackageNames ' ) ? array_fill_keys ($ repo ->getDevPackageNames (), true ) : [];
@@ -269,7 +279,14 @@ public function getMissingRequires(InstalledRepositoryInterface $repo, array $re
269
279
$ rules = array_intersect_key (self ::PROVIDE_RULES , $ rules );
270
280
271
281
while ($ rules ) {
272
- $ abstractions [] = $ abstraction = key ($ rules );
282
+ $ abstraction = key ($ rules );
283
+
284
+ if (isset ($ pinnedAbstractions [$ abstraction ])) {
285
+ unset($ rules [$ abstraction ]);
286
+ continue ;
287
+ }
288
+
289
+ $ abstractions [] = $ abstraction ;
273
290
274
291
foreach (array_shift ($ rules ) as $ candidate => $ deps ) {
275
292
[$ candidate , $ version ] = explode (': ' , $ candidate , 2 ) + [1 => null ];
0 commit comments