Skip to content
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

Undefined Property #2382

Closed
PutraLC opened this issue Jan 2, 2023 · 7 comments
Closed

Undefined Property #2382

PutraLC opened this issue Jan 2, 2023 · 7 comments

Comments

@PutraLC
Copy link

PutraLC commented Jan 2, 2023

Describe the bug
Before my code run without error now my code run as well but all of my property in code igniter 3 get error undefined property intelephense (1014).

To Reproduce
i don't know

Expected behavior
i expected when my program not run the code show error and when my code no error my program run as well

Screenshots
{E09D62C1-CFEF-45C9-959F-EFF90B51C3A1}

Platform and version
windows Visual Studio Code & PHP Intelephense v1.9.0

@bmewburn
Copy link
Owner

bmewburn commented Jan 2, 2023

PHP 8.2 deprecates dynamic property creation https://wiki.php.net/rfc/deprecate_dynamic_properties. Because this diagnostic is useful for picking up typos in code that does not utilise dynamic properties it was decided to apply the diagnostic to other versions of PHP too within intelephense.

If you have a code base that relies on dynamic properties (from my understanding CI 3 does) you can turn them off by setting intelephense.diagnostics.undefinedProperties to false.

@VaelVictus
Copy link

Thanks @bmewburn. I had to restart VS Code after applying this setting.

I would expect this to not have occurred, though? I'm using "intelephense.environment.phpVersion": "7.4.0", and the tooltip says:

A semver compatible string that represents the target PHP version. Used for providing version appropriate suggestions and diagnostics. PHP 5.3.0 and greater supported.

@bmewburn
Copy link
Owner

bmewburn commented Jan 2, 2023

@VaelVictus , as mentioned above, it's a useful diagnostic for any php version if dynamic properties are not used. It had been requested a few times. Because it can be switched off easily, no version check was implemented.

@PutraLC
Copy link
Author

PutraLC commented Jan 2, 2023

Thanks a lot @bmewburn it solve my problem.

@Mfarooq1122
Copy link

hi

@Mfarooq1122
Copy link

i have a problem

@Mfarooq1122
Copy link

@VaelVictus , as mentioned above, it's a useful diagnostic for any php version if dynamic properties are not used. It had been requested a few times. Because it can be switched off easily, no version check was implemented.

hello

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants