Skip to content

Commit d5cac05

Browse files
We still need to return a union type with className to enable e.g. chaining of the magic whereX methods and scopes
1 parent e77e623 commit d5cac05

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/support/docblocks.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,15 @@ const getBuilderReturnType = (
7777
}
7878

7979
if (["static", "self"].includes(method.return)) {
80-
return `\\Illuminate\\Database\\Eloquent\\Builder<${className}>`;
80+
return `\\Illuminate\\Database\\Eloquent\\Builder<${className}>|${className}`;
8181
}
8282

8383
const certainOfType = ["sole", "find", "first", "firstOrFail"].includes(method.name);
8484

8585
const returnType = method.return
8686
.replace(
8787
"$this",
88-
`\\Illuminate\\Database\\Eloquent\\Builder<${className}>`,
88+
`\\Illuminate\\Database\\Eloquent\\Builder<${className}>|${className}`,
8989
)
9090
.replace("\\TReturn", "mixed")
9191
.replace("TReturn", "mixed")
@@ -202,7 +202,7 @@ const getAttributeBlocks = (
202202

203203
if (!["accessor", "attribute"].includes(attr.cast || "")) {
204204
blocks.push(
205-
`@method static \\Illuminate\\Database\\Eloquent\\Builder<${className}> where${attr.title_case}($value)`,
205+
`@method static \\Illuminate\\Database\\Eloquent\\Builder<${className}>|${className}> where${attr.title_case}($value)`,
206206
);
207207
}
208208

0 commit comments

Comments
 (0)