Skip to content

[11.x] fix: specify type of TClass generic in Container#54545

Merged
taylorotwell merged 1 commit into
laravel:11.xfrom
MrMeshok:container-generics-facade
Feb 10, 2025
Merged

[11.x] fix: specify type of TClass generic in Container#54545
taylorotwell merged 1 commit into
laravel:11.xfrom
MrMeshok:container-generics-facade

Conversation

@MrMeshok

Copy link
Copy Markdown
Contributor

After #54543 docblocks for App facade generated incorrect return values (void). With this PR diff looks like that

--- a/src/Illuminate/Support/Facades/App.php
+++ b/src/Illuminate/Support/Facades/App.php
@@ -53,7 +53,7 @@
  * @method static void loadDeferredProviders()
  * @method static void loadDeferredProvider(string $service)
  * @method static void registerDeferredProvider(string $provider, string|null $service = null)
- * @method static mixed make(string $abstract, array $parameters = [])
+ * @method static object|mixed make(string $abstract, array $parameters = [])
  * @method static bool bound(string $abstract)
  * @method static bool isBooted()
  * @method static void boot()
@@ -120,10 +120,10 @@
  * @method static mixed refresh(string $abstract, mixed $target, string $method)
  * @method static \Closure wrap(\Closure $callback, array $parameters = [])
  * @method static mixed call(callable|string $callback, array $parameters = [], string|null $defaultMethod = null)
- * @method static \Closure factory(string $abstract)
- * @method static mixed makeWith(string|callable $abstract, array $parameters = [])
- * @method static mixed get(string $id)
- * @method static mixed build(\Closure|string $concrete)
+ * @method static \Closure|\Closure factory(string $abstract)
+ * @method static object|mixed makeWith(string|callable $abstract, array $parameters = [])
+ * @method static object|mixed get(string $id)
+ * @method static object build(\Closure|string $concrete)
  * @method static mixed resolveFromAttribute(\ReflectionAttribute $attribute)
  * @method static void beforeResolving(\Closure|string $abstract, \Closure|null $callback = null)
  * @method static void resolving(\Closure|string $abstract, \Closure|null $callback = null)
@method static \Closure|\Closure factory(string $abstract)

factory looks a little weird, maybe it could be fixed in facade-documenter

I also changed generics in app() and resolve() helper for consistency

@taylorotwell
taylorotwell merged commit 0ea7856 into laravel:11.x Feb 10, 2025
@MrMeshok
MrMeshok deleted the container-generics-facade branch February 10, 2025 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants