New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enums cases as attribute params #6982
Comments
I found these snippets: https://psalm.dev/r/3615c731dc<?php
class CreateController {
#[Param(paramType: ParamType::FLAG)]
public function actionGet(): void {}
}
use Attribute;
#[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)]
class Param {
public function __construct(
public ParamType $paramType = ParamType::PARAM
) {
}
}
enum ParamType {
case FLAG;
case PARAM;
}
|
Fixed in #6984 |
Thank you for the super quick turnaround on this! |
I think I've seen @muglug fixing some issues within 15 minutes of them being reported, so we still have some room for improvement 😆 |
Either way, @weirdan this was gonna potentially block me from releasing the next version of my framework tomorrow, due to my strict Psalm rule for errorLevel 1 clean with 100% type inference (except in VERY limited cases for psalm-suppress) so this makes me happy. |
Enums in attributes are not properly detected for their types https://psalm.dev/r/3615c731dc?php=8.1 (simplified)
Originally posted by @jpresutti in #6425 (comment)
The text was updated successfully, but these errors were encountered: