Skip to content

Commit f3cbc38

Browse files
committed
fix ambiguous class resolutions
1 parent 3847b33 commit f3cbc38

File tree

2 files changed

+195
-4
lines changed

2 files changed

+195
-4
lines changed

composer.json

+7-4
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,7 @@
3636
},
3737
"autoload": {
3838
"psr-4": {
39-
"App\\": "app/",
40-
"Database\\Factories\\": "database/factories/",
41-
"Database\\Seeders\\": "database/seeders/"
39+
"App\\": "app/"
4240
}
4341
},
4442
"autoload-dev": {
@@ -58,5 +56,10 @@
5856
"prefer-stable": true,
5957
"bin": [
6058
"php-parser"
61-
]
59+
],
60+
"scripts": {
61+
"pre-autoload-dump": [
62+
"test -f fix-class-resolutions.php && php fix-class-resolutions.php || true"
63+
]
64+
}
6265
}

fix-class-resolutions.php

+188
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
<?php
2+
3+
$files = [
4+
'Application.php',
5+
'Vite.php',
6+
'Mix.php',
7+
'Precognition.php',
8+
'Configuration/Middleware.php',
9+
'Configuration/Exceptions.php',
10+
'Configuration/ApplicationBuilder.php',
11+
'PackageManifest.php',
12+
'Bootstrap/RegisterProviders.php',
13+
'Bootstrap/LoadEnvironmentVariables.php',
14+
'Bootstrap/LoadConfiguration.php',
15+
'Bootstrap/BootProviders.php',
16+
'Bootstrap/SetRequestForConsole.php',
17+
'Bootstrap/RegisterFacades.php',
18+
'Bootstrap/HandleExceptions.php',
19+
'ComposerScripts.php',
20+
'Auth/Access/Authorizable.php',
21+
'Auth/Access/AuthorizesRequests.php',
22+
'Auth/User.php',
23+
'Auth/EmailVerificationRequest.php',
24+
'ProviderRepository.php',
25+
'EnvironmentDetector.php',
26+
'Providers/FormRequestServiceProvider.php',
27+
'Providers/ArtisanServiceProvider.php',
28+
'Providers/ComposerServiceProvider.php',
29+
'Providers/ConsoleSupportServiceProvider.php',
30+
'Providers/FoundationServiceProvider.php',
31+
'Inspiring.php',
32+
'MaintenanceModeManager.php',
33+
'Bus/PendingChain.php',
34+
'Bus/DispatchesJobs.php',
35+
'Bus/PendingDispatch.php',
36+
'Bus/Dispatchable.php',
37+
'Bus/PendingClosureDispatch.php',
38+
'Exceptions/ReportableHandler.php',
39+
'Exceptions/Handler.php',
40+
'Exceptions/Whoops/WhoopsExceptionRenderer.php',
41+
'Exceptions/Whoops/WhoopsHandler.php',
42+
'Exceptions/RegisterErrorViewPaths.php',
43+
'CacheBasedMaintenanceMode.php',
44+
'Testing/Traits/CanConfigureMigrationCommands.php',
45+
'Testing/DatabaseTruncation.php',
46+
'Testing/RefreshDatabaseState.php',
47+
'Testing/DatabaseMigrations.php',
48+
'Testing/WithFaker.php',
49+
'Testing/WithConsoleEvents.php',
50+
'Testing/WithoutMiddleware.php',
51+
'Testing/TestCase.php',
52+
'Testing/RefreshDatabase.php',
53+
'Testing/LazilyRefreshDatabase.php',
54+
'Testing/Wormhole.php',
55+
'Testing/DatabaseTransactions.php',
56+
'Testing/Concerns/InteractsWithSession.php',
57+
'Testing/Concerns/InteractsWithContainer.php',
58+
'Testing/Concerns/InteractsWithDatabase.php',
59+
'Testing/Concerns/InteractsWithTime.php',
60+
'Testing/Concerns/MakesHttpRequests.php',
61+
'Testing/Concerns/InteractsWithViews.php',
62+
'Testing/Concerns/InteractsWithAuthentication.php',
63+
'Testing/Concerns/InteractsWithDeprecationHandling.php',
64+
'Testing/Concerns/InteractsWithRedis.php',
65+
'Testing/Concerns/InteractsWithExceptionHandling.php',
66+
'Testing/Concerns/InteractsWithConsole.php',
67+
'Testing/Concerns/WithoutExceptionHandlingHandler.php',
68+
'Testing/Concerns/InteractsWithTestCaseLifecycle.php',
69+
'Testing/DatabaseTransactionsManager.php',
70+
'Support/Providers/AuthServiceProvider.php',
71+
'Support/Providers/RouteServiceProvider.php',
72+
'Support/Providers/EventServiceProvider.php',
73+
'Http/Middleware/HandlePrecognitiveRequests.php',
74+
'Http/Middleware/VerifyCsrfToken.php',
75+
'Http/Middleware/ConvertEmptyStringsToNull.php',
76+
'Http/Middleware/TrimStrings.php',
77+
'Http/Middleware/ValidateCsrfToken.php',
78+
'Http/Middleware/ValidatePostSize.php',
79+
'Http/Middleware/TransformsRequest.php',
80+
'Http/Middleware/CheckForMaintenanceMode.php',
81+
'Http/Middleware/PreventRequestsDuringMaintenance.php',
82+
'Http/Middleware/Concerns/ExcludesPaths.php',
83+
'Http/FormRequest.php',
84+
'Http/MaintenanceModeBypassCookie.php',
85+
'Http/Events/RequestHandled.php',
86+
'Http/HtmlDumper.php',
87+
'Http/Kernel.php',
88+
'FileBasedMaintenanceMode.php',
89+
'ViteManifestNotFoundException.php',
90+
'Routing/PrecognitionCallableDispatcher.php',
91+
'Routing/PrecognitionControllerDispatcher.php',
92+
'Events/MaintenanceModeDisabled.php',
93+
'Events/DiscoverEvents.php',
94+
'Events/DiagnosingHealth.php',
95+
'Events/LocaleUpdated.php',
96+
'Events/PublishingStubs.php',
97+
'Events/VendorTagPublished.php',
98+
'Events/Dispatchable.php',
99+
'Events/MaintenanceModeEnabled.php',
100+
'Validation/ValidatesRequests.php',
101+
'Concerns/ResolvesDumpSource.php',
102+
'Console/LangPublishCommand.php',
103+
'Console/PackageDiscoverCommand.php',
104+
'Console/TestMakeCommand.php',
105+
'Console/ConfigPublishCommand.php',
106+
'Console/ViewCacheCommand.php',
107+
'Console/UpCommand.php',
108+
'Console/EnvironmentCommand.php',
109+
'Console/DownCommand.php',
110+
'Console/EventGenerateCommand.php',
111+
'Console/ProviderMakeCommand.php',
112+
'Console/ExceptionMakeCommand.php',
113+
'Console/DocsCommand.php',
114+
'Console/VendorPublishCommand.php',
115+
'Console/RuleMakeCommand.php',
116+
'Console/RouteClearCommand.php',
117+
'Console/ConfigCacheCommand.php',
118+
'Console/KeyGenerateCommand.php',
119+
'Console/EnumMakeCommand.php',
120+
'Console/ViewMakeCommand.php',
121+
'Console/ObserverMakeCommand.php',
122+
'Console/CliDumper.php',
123+
'Console/EnvironmentEncryptCommand.php',
124+
'Console/EventClearCommand.php',
125+
'Console/ComponentMakeCommand.php',
126+
'Console/StorageLinkCommand.php',
127+
'Console/EventListCommand.php',
128+
'Console/InterfaceMakeCommand.php',
129+
'Console/ChannelMakeCommand.php',
130+
'Console/ClosureCommand.php',
131+
'Console/ApiInstallCommand.php',
132+
'Console/BroadcastingInstallCommand.php',
133+
'Console/QueuedCommand.php',
134+
'Console/EventCacheCommand.php',
135+
'Console/RouteListCommand.php',
136+
'Console/ResourceMakeCommand.php',
137+
'Console/ClearCompiledCommand.php',
138+
'Console/EnvironmentDecryptCommand.php',
139+
'Console/ConfigShowCommand.php',
140+
'Console/EventMakeCommand.php',
141+
'Console/StorageUnlinkCommand.php',
142+
'Console/ChannelListCommand.php',
143+
'Console/PolicyMakeCommand.php',
144+
'Console/StubPublishCommand.php',
145+
'Console/InteractsWithComposerPackages.php',
146+
'Console/ScopeMakeCommand.php',
147+
'Console/ConfigClearCommand.php',
148+
'Console/RequestMakeCommand.php',
149+
'Console/JobMakeCommand.php',
150+
'Console/ConsoleMakeCommand.php',
151+
'Console/CastMakeCommand.php',
152+
'Console/ServeCommand.php',
153+
'Console/RouteCacheCommand.php',
154+
'Console/OptimizeClearCommand.php',
155+
'Console/OptimizeCommand.php',
156+
'Console/ListenerMakeCommand.php',
157+
'Console/MailMakeCommand.php',
158+
'Console/ModelMakeCommand.php',
159+
'Console/ClassMakeCommand.php',
160+
'Console/ViewClearCommand.php',
161+
'Console/NotificationMakeCommand.php',
162+
'Console/TraitMakeCommand.php',
163+
'Console/AboutCommand.php',
164+
'Console/Kernel.php',
165+
'AliasLoader.php',
166+
];
167+
168+
echo "Removing duplicate class resolutions from Laravel Zero...\n\n";
169+
170+
$results = [];
171+
172+
foreach ($files as $file) {
173+
$path = __DIR__ . '/vendor/laravel/framework/src/Illuminate/Foundation/' . $file;
174+
175+
if (!file_exists($path)) {
176+
$results[] = 'x';
177+
continue;
178+
}
179+
180+
$results[] = '.';
181+
unlink($path);
182+
}
183+
184+
foreach (array_chunk($results, 50) as $chunk) {
185+
echo implode('', $chunk) . "\n";
186+
}
187+
188+
echo "\n\nDone!\n\n";

0 commit comments

Comments
 (0)