mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-17 17:47:13 +00:00
Fix MorphTo Model Doc Generation (#1668)
fix:
```php
/**
* @return MorphTo<contravariant ModelA|ModelB, $this>
*/
public function reminderable(): MorphTo {
return $this->morphTo(__FUNCTION__, 'entity', 'entity_id');
}
```
From:
```php
* @property-read contravariant ModelA|ModelB $reminderable
```
To:
```php
* @property-read ModelA|ModelB $reminderable
```
Fixes: #1667
This commit is contained in:
@@ -826,7 +826,7 @@ class ModelsCommand extends Command
|
||||
$matches = [];
|
||||
$returnType = $this->getReturnTypeFromDocBlock($reflection);
|
||||
if ($returnType !== null) {
|
||||
preg_match('/MorphTo<(.+?)(?:,|>)/i', $returnType, $matches);
|
||||
preg_match('/MorphTo<(?:contravariant\s+)?(.+?)(?:,|>)/i', $returnType, $matches);
|
||||
}
|
||||
|
||||
// Model isn't specified because relation is polymorphic
|
||||
|
||||
Reference in New Issue
Block a user