-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
Add support enum dynamic constant #241
Comments
https://wiki.php.net/rfc/dynamic_class_constant_fetch Fix #241 This should have been done in #217 already.
Thanks @koraga, fixed the issue, will release it later today. |
Released in 3.1.0 now. Thanks again! |
I installed 3.1.0 but catch same error :( For example my real code: <?php
declare(strict_types=1);
namespace Modules\Admin\Http\Requests\AccessList;
use Illuminate\Foundation\Http\FormRequest;
/**
* @property non-empty-string $type
*/
final class DownloadAccessListRequest extends FormRequest
{
public function getType(): AccessListType
{
return AccessListType::{$this->type};
}
}
// ...
enum AccessListType
{
case White;
case Black;
} phpstan debug:
|
Oh, a return AccessListType::{$this->type}; I see, I'll fix, and sorry for the trouble. Btw, can you please post the code as code next time, not as a screenshot? It helps when I'm for example checking the issue on my mobile, or when I'm searching for things in the future or so. I have OCR'd the original description for the same reason. |
Because besides `Variable`, there's also `PropertyFetch` (`Foo::{$this->type}`), `StaticPropertyFetch` (`Foo::{Foo::$bar}`) and more. Fix #241, again.
Because besides `Variable`, there's also `PropertyFetch` (`Foo::{$this->type}`), `StaticPropertyFetch` (`Foo::{Foo::$bar}`) and more. Fix #241, again.
Because besides `Variable`, there's also - `PropertyFetch` (`Foo::{$this->type}`) - `StaticPropertyFetch` (`Foo::{Foo::$bar}`) - and more. Fix #241, again.
Okay, sorry |
No problem and thanks for updating the comment! :-) I have now fixed this (again!), hopefully for good this time 😅 Fix in 3.1.1 which replaces 3.1.0 Please let me know if it's alright, thanks. |
It work! Thanks! |
Awesome, thanks for the confirmation! 🎉 |
PHP: 8.3.1
When i use dynamic constants for enum.
For example:
https://phpstan.org/r/fc74146a-7438-4cd8-ae4c-56c8db97dad5
Screenshot
I catch error
Screenshot
The text was updated successfully, but these errors were encountered: