-
-
Notifications
You must be signed in to change notification settings - Fork 58
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
enclose return of getRawSchemaLessAttributes with is_array check #46
Conversation
There's a lot - too much - going on in that line. Could you split it up to make the intention more clear. Could you also add a test that illustrates why this change is necessary? |
Thank you for the feedback, I have split the code to be more clear and follow correct if statement semantics (not committed yet) I will write the test later today. |
Added test.
I've split up the code and added a test with assertions that use the old code to prove it doesn't return an array, and an assertion that executes the modified function and asserts it returns an empty array. I will agree on the fact that the original issue could only occur if the model property is manually set to a string instead of using the suggested helper methods for updating values, which is definitely a mistake on the implementation side. |
Disclaimer, this is actually my first time writing a unit test, feel free to give me feedback on it, I kinda quickly looked through the other tests and wrote my test based on the knowledge gathered from those. |
Going through the original issue again, I don't know if we should fix this. Shouldn't the users take care that there are regular |
I agree that this is indeed the user's responsibility, though on the official php documentation it clearly states that there are more possible return types than just object/array: source TL;DR: You are probably right about this and if you decide to close this PR I wouldn't disagree, though I wouldn't mind if you could find the time (I know, time is precious) if you could give any positive/negative/neutral feedback about my test case, as I'm always eager to improve my skills and this was a very new thing to me. |
Going to close this for now. I took a look at the test, on first glance it seemed good. Thanks for wanting to contribute. |
Fixes #45