Skip to content

Conversation

@jaydiablo
Copy link
Member

Fixes #383

This changes the isValidType method to explicitly check for the "json" type and returns true if the var is a valid type for a "json" column.

@codecov
Copy link

codecov bot commented Oct 9, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.03%. Comparing base (3b32af1) to head (ceafd93).

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #384      +/-   ##
============================================
+ Coverage     69.96%   70.03%   +0.07%     
- Complexity     7724     7727       +3     
============================================
  Files           262      262              
  Lines         18383    18383              
============================================
+ Hits          12862    12875      +13     
+ Misses         5521     5508      -13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

return true;
} elseif ($type === 'json') {
// JSON type can be object, array, string, number, boolean, or null (null handled above)
return is_object($var) || is_array($var) || is_string($var) || is_numeric($var) || is_bool($var);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So you're basically checking for:
is_object($var) || is_array($var) || is_scalar($var) || is_null($var), right?
=> basically everything except resources, callables and such

Note the fine difference that is_numeric() !== (is_int() || is_float()) ;-)

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.

JSON type: Cannot persist due to failing validation

3 participants