-
Notifications
You must be signed in to change notification settings - Fork 479
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
Readonly classes cannot be combined with #[AllowDynamicProperties]
#3738
Merged
+296
−1
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
b96f17b
Readonly classes cannot be combined with `#[AllowDynamicProperties]`
staabm 65a5889
Update TraitAttributesRule.php
ondrejmirtes 0b750a9
work in progress.. crashing atm
staabm ff83891
fix class fake
staabm b1cebc2
Use InTraitNode instead
ondrejmirtes b2b833c
Fix
ondrejmirtes b35a845
This file can still be linted
ondrejmirtes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading status checks…
fix class fake
commit ff83891b4524b9c7fdbf091c48356ec35efcb512
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to do something with $scope here. Please recreate this problem 3447391 but with a trait.
We probably need to do
$scope->enterTrait()
here before calling the check. Just doif !$scope instanceof MutatingScope then throw ShouldNotHappen
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have adjusted the PR. I think I have reproduced the problem you are after.
adding
$scope->enterTrait($classReflection)
didn't work and throws:at this point I have no idea what todo. could you fix the remaining thing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let me fix the build real quick
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Push the code that's crashing like that please, I will take a look
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here you are
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh right, we need to be in a class first before we can enter a trait.
I'd try two things: try to put the trait reflection into enterClass (but a different ShouldNotHappen might be thrown, not sure).
If that fails, we need to come up with some fake class to put into enterClass before we can enterTrait. It might be okay to simulate some anonymous Class_ node to use.
If it's too much work, don't worry and I'll merge the original code that doesn't use MutatingScope at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have class-faking without a thrown exception working. the test-case is still failling though
Will have another look after sleeping over it