shish/phpstan-matchy-string

PHPStan rule for strings that match certain conditions

v0.0.0 2025-06-04 00:37 UTC

This package is auto-updated.

Last update: 2025-06-04 00:39:34 UTC


README

  • patterns defined in phpstan.neon, eg email-string: '^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}$'
  • function defined like:
/**
 * @param email-string $email
 */
function sendEmail(string $email): void {
    ...
}
  • phpstan will then allow sendEmail("bob@example.com") but not sendEmail("bob@example")