Skip to content

Commit a25b947

Browse files
imzyfYifan Zhao
andauthored
fix: add @template TModel of static for Eloquent (#1631)
* fix: add @template TModel of static for Eloquent * fix: use `===` instead of `==` --------- Co-authored-by: Yifan Zhao <[email protected]>
1 parent 59eb267 commit a25b947

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

resources/views/helper.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
*/
2424

2525
<?php foreach ($namespaces_by_extends_ns as $namespace => $aliases) : ?>
26-
namespace <?= $namespace == '__root' ? '' : trim($namespace, '\\') ?> {
26+
namespace <?= $namespace === '__root' ? '' : trim($namespace, '\\') ?> {
2727
<?php foreach ($aliases as $alias) : ?>
2828
<?= trim($alias->getDocComment(' ')) ?>
2929
<?= $alias->getClassType() ?> <?= $alias->getExtendsClass() ?> {
@@ -47,9 +47,12 @@ public static function <?= $method->getName() ?>(<?= $method->getParamsWithDefau
4747
<?php endforeach; ?>
4848

4949
<?php foreach ($namespaces_by_alias_ns as $namespace => $aliases) : ?>
50-
namespace <?= $namespace == '__root' ? '' : trim($namespace, '\\') ?> {
50+
namespace <?= $namespace === '__root' ? '' : trim($namespace, '\\') ?> {
5151
<?php foreach ($aliases as $alias) : ?>
52-
<?= $alias->getClassType() ?> <?= $alias->getShortName() ?> extends <?= $alias->getExtends() ?> {<?php if ($alias->getExtendsNamespace() == '\Illuminate\Database\Eloquent') : ?>
52+
<?php if ($alias->getExtendsNamespace() === '\Illuminate\Database\Eloquent') : ?>
53+
/** @template TModel of static */
54+
<?php endif?>
55+
<?= $alias->getClassType() ?> <?= $alias->getShortName() ?> extends <?= $alias->getExtends() ?> {<?php if ($alias->getExtendsNamespace() === '\Illuminate\Database\Eloquent') : ?>
5356
<?php foreach ($alias->getMethods() as $method) : ?>
5457
<?= trim($method->getDocComment(' ')) ?>
5558
public static function <?= $method->getName() ?>(<?= $method->getParamsWithDefault() ?>)

0 commit comments

Comments
 (0)