for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Cortex\Foundation\Transformers;
use Spatie\MediaLibrary\Models\Media;
use League\Fractal\TransformerAbstract;
class MediaTransformer extends TransformerAbstract
{
/**
* @return array
array<string,integer|string>
This check looks for the generic type array as a return type and suggests a more specific type. This type is inferred from the actual code.
array
*/
public function transform(Media $media)
return [
'id' => (int) $media->id,
'name' => (string) $media->name,
'file_name' => (string) $media->file_name,
'mime_type' => (string) $media->mime_type,
'size' => (string) $media->getHumanReadableSizeAttribute(),
'created_at' => (string) $media->created_at,
'updated_at' => (string) $media->updated_at,
'delete' => (string) route('adminarea.rooms.media.delete', ['room' => $media->model, 'media' => $media]),
];
}
This check looks for the generic type
array
as a return type and suggests a more specific type. This type is inferred from the actual code.