calebdw/larastan-livewire

A Larastan / PHPStan extension for Livewire.

Fund package maintenance!
calebdw

Installs: 7 143

Dependents: 0

Suggesters: 0

Security: 0

Stars: 18

Watchers: 2

Forks: 0

Open Issues: 0

Type:phpstan-extension

v1.0.1 2023-12-22 05:33 UTC

This package is auto-updated.

Last update: 2024-05-24 06:01:42 UTC


README

A Larastan / PHPStan extension for Livewire.

Install

composer require calebdw/larastan-livewire --dev

If you have the PHPStan extension installer installed then nothing more is needed, otherwise you will need to manually include the extension in the phpstan.neon(.dist) configuration file:

includes:
    - ./vendor/calebdw/larastan-livewire/extension.neon

Features

Computed Properties

Computed properties are properly resolved from methods that have the Computed attribute applied.

<?php
class ShowPost extends Component
{
    #[Computed]
    public function post()
    {
        return Post::find($this->postId);
    }
}

Getter Style

The older, "getter" style attributes are supported as well:

<?php
class ShowPost extends Component
{
    // Computed Property
    public function getPostProperty()
    {
        return Post::find($this->postId);
    }

Contributing

Thank you for considering contributing! You can read the contribution guide here.

License

Larastan-Livewire is open-sourced software licensed under the MIT license.