larastan livewire
v2.0.0
composer require calebdw/larastan-livewire --dev หากคุณติดตั้งตัวติดตั้ง PHPStan Extension ติดตั้งจะไม่จำเป็นต้องมีอะไรอีกแล้วมิฉะนั้นคุณจะต้องรวมส่วนขยายในไฟล์กำหนดค่า phpstan.neon(.dist) ด้วยตนเอง:
includes :
- ./vendor/calebdw/larastan-livewire/extension.neon คุณสมบัติที่คำนวณได้จะได้รับการแก้ไขอย่างถูกต้องจากวิธีการที่ใช้แอตทริบิวต์ Computed
<?php
use Livewire Attributes Computed ;
use Livewire Component ;
class ShowPost extends Component
{
#[Computed]
public function post ()
{
return Post:: find ( $ this -> postId );
}
}คุณลักษณะสไตล์ "Getter" ที่เก่ากว่าได้รับการสนับสนุนเช่นกัน:
<?php
use Livewire Component ;
class ShowPost extends Component
{
// Computed Property
public function getPostProperty ()
{
return Post:: find ( $ this -> postId );
}
}ขอบคุณที่พิจารณาการมีส่วนร่วม! คุณสามารถอ่านคู่มือการบริจาคได้ที่นี่
Larastan-Livewire เป็นซอฟต์แวร์ที่ได้รับใบอนุญาตที่ได้รับอนุญาตภายใต้ใบอนุญาต MIT