Skip to content

Commit 40e9b98

Browse files
Further code cleanup
1 parent d937040 commit 40e9b98

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Laravel/ClassPropertyProcessors/ReplaceLaravelCollectionByArrayClassPropertyProcessor.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Spatie\TypeScriptTransformer\Laravel\ClassPropertyProcessors;
44

5+
use Illuminate\Database\Eloquent\Collection as EloquentCollection;
56
use Illuminate\Support\Collection;
67
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
78
use ReflectionProperty;
@@ -27,7 +28,10 @@ public function __construct()
2728
$this->visitor = Visitor::create()->before(function (TypeScriptGeneric $generic) {
2829
$isCollection = $generic->type instanceof TypeReference
2930
&& $generic->type->reference instanceof ClassStringReference
30-
&& is_a($generic->type->reference->classString, Collection::class, true);
31+
&& in_array($generic->type->reference->classString, [
32+
Collection::class,
33+
EloquentCollection::class,
34+
]);
3135

3236
if (! $isCollection) {
3337
return;

0 commit comments

Comments
 (0)