be-framework/psalm-plugin

Psalm plugin that detects Be Framework runtime errors at static-analysis time

Maintainers

Package info

github.com/be-framework/psalm-plugin

Type:psalm-plugin

pkg:composer/be-framework/psalm-plugin

Statistics

Installs: 84

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 0

dev-main 2026-05-16 01:26 UTC

This package is auto-updated.

Last update: 2026-05-16 14:32:37 UTC


README

Test

Psalm plugin that detects Be Framework runtime errors at static-analysis time.

What it detects

MissingBeingParameterAttribute

A Being class constructor parameter that lacks both #[Input] (Ray\InputQuery\Attribute\Input) and #[Inject] (Ray\Di\Di\Inject). At runtime this raises Be\Framework\Exception\MissingParameterAttribute from BecomingArguments.

final readonly class WeightLogged
{
    public function __construct(
        #[Input] public string $recordedAt,
        public StorageInterface $storage, // ← missing attribute, reported
    ) {}
}

A class is treated as a Being when its constructor declares at least one #[Input] parameter.

ConflictingBeingParameterAttribute

A Being constructor parameter that carries both #[Input] and #[Inject]. At runtime this raises a conflict error from BecomingArguments.

public function __construct(
    #[Input, Inject] public StorageInterface $storage, // ← reported
) {}

InvalidValidateException

A #[Validate] method that throws an exception not extending \DomainException. Be\Framework\SemanticVariable\SemanticValidator only catches DomainException, so other types silently bypass validation.

#[Validate]
public function validate(string $value): void
{
    if ($value === '') {
        throw new \RuntimeException('empty'); // ← reported
    }
}

Variable throws and ternary/match unions are resolved via Psalm's NodeTypeProvider. When the type cannot be resolved, the plugin stays silent (false-positive avoidance).

Installation

composer require --dev be-framework/psalm-plugin

Register the plugin in your psalm.xml:

<plugins>
    <pluginClass class="Be\PsalmPlugin\Plugin" />
</plugins>

Or use the Psalm plugin installer:

vendor/bin/psalm-plugin enable be-framework/psalm-plugin

Requirements

  • PHP 8.3+
  • Psalm 6.x

Suppressing issues

Standard Psalm suppression works at the class or method level:

/** @psalm-suppress MissingBeingParameterAttribute */
final readonly class IntentionallyLoose
{
    // ...
}

License

MIT