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

Add AllowDynamicProperties Attribute to cooperate with php8.2 deprecation #1428

Merged

Conversation

GeoSot
Copy link
Contributor

@GeoSot GeoSot commented Mar 9, 2023

Summary

Trying to Add #[\AllowDynamicProperties] before class on mixin, as solution to PHPStan errors

Note: could add an extra check PHP_VERSION_ID>= 80200, but seems redundant as attributes have backwards compatibility

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Misc. change (internal, infrastructure, maintenance, etc.)

Checklist

  • Existing tests have been adapted and/or new tests have been added
  • Add a CHANGELOG.md entry
  • Update the README.md
  • Code style has been fixed via composer fix-style

rel #1386
closes #1402

@GeoSot GeoSot marked this pull request as ready for review March 9, 2023 14:52
@GeoSot
Copy link
Contributor Author

GeoSot commented May 8, 2023

@barryvdh

Any news on this? It has started to be much problematic with phpstan support

@Orrison
Copy link

Orrison commented Sep 17, 2023

@barryvdh any possibility of this merging in any time soon? Looks like it has been approved and tests are passing. Is currently needed to make use of mixins while using PHP8.2

@barryvdh barryvdh requested a review from mfn September 17, 2023 15:46
@mfn
Copy link
Collaborator

mfn commented Sep 18, 2023

I want to understand the issue better first, I added a comment in #1402 (comment)

@GeoSot
Copy link
Contributor Author

GeoSot commented Nov 14, 2023

I want to understand the issue better first, I added a comment in #1402 (comment)

@mfn please can you provide a solution here?

yes, generated class can extend the initial eloquent model, but either way is a 'stub'. So 'AllowDynamicProperties' can just do this without extra complexity.
We would like any of both solutions, just to help us go on with php 8.2

@barryvdh
Copy link
Owner

barryvdh commented Feb 8, 2024

Is this still required now that the files are ignored?

@GeoSot
Copy link
Contributor Author

GeoSot commented Feb 8, 2024

php 8.2 introduced a change where dynamicProperties are not allowed be default, so when phpStan reads the _ide_helper*.php files, in order to resolve the laravel "magic" properties form docblocks, throws the exception Access to an undefined property (details)

Short answer: Yes we really need this , and would appreciate your help

@barryvdh
Copy link
Owner

barryvdh commented Feb 8, 2024

This PR should disable the inspection though right? #1486

@GeoSot
Copy link
Contributor Author

GeoSot commented Feb 8, 2024

Yes for codesniffer, and for phpstorm. PhpStan doesn't seem to respect/recognize any the following

/* @noinspection ALL */
// @formatter:off
// phpcs:ignoreFile

ps: have already test it, getting the dev-master on composer

@barryvdh barryvdh merged commit bc158a1 into barryvdh:master Feb 8, 2024
@GeoSot GeoSot deleted the feat/add-dynamic-properties-attribute branch February 8, 2024 10:10
@barryvdh
Copy link
Owner

See #1516
Should we revert this for now?

@mfn
Copy link
Collaborator

mfn commented Feb 15, 2024

Maybe my hunch for the proposed fix is correct, then it would be as fast as the revert. But I can't do it right now

@barryvdh
Copy link
Owner

See #1517

d3v2a pushed a commit to d3v2a/laravel-ide-helper that referenced this pull request Feb 16, 2024
…cation (barryvdh#1428)

* Add `AllowDynamicProperties` Attribute to cooperate with php8.2 deprecation

* lint snapshot
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

Successfully merging this pull request may close these issues.

PHP 8.2 - Ide helper files seem not recognized
5 participants