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

Fix incorrect boolean type cast #513

Merged
merged 1 commit into from
Mar 31, 2020
Merged

Fix incorrect boolean type cast #513

merged 1 commit into from
Mar 31, 2020

Conversation

leo108
Copy link
Contributor

@leo108 leo108 commented Mar 29, 2020

Boolean properties were cast to boolean here:
https://github.com/nunomaduro/larastan/blob/master/src/Properties/ModelPropertyExtension.php#L233
So we need to compare $column->readableType with boolean instead of bool

@canvural
Copy link
Collaborator

Hi, thanks for the PR!

Can you explain why this is necessary? Cause here the type resolver would convert both bool and boolean to the correct type. So I don't think there will be an issue.

@leo108
Copy link
Contributor Author

leo108 commented Mar 30, 2020

@canvural In old logic, if $column->readableType is boolean, the getReadableAndWritableTypes method will return [mixed, mixed] instead of [bool, bool].

The core of this PR is this line: https://github.com/nunomaduro/larastan/pull/513/files#diff-8c4331b9e7c6c4544f1895befdc48f1dR198

@canvural
Copy link
Collaborator

In that case, you are right 👍 Thank you!

@canvural canvural merged commit 165b417 into larastan:master Mar 31, 2020
@leo108 leo108 deleted the patch-1 branch August 13, 2021 08:31
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.

2 participants