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

Refactoring of Schema::normalizeDefaultValue() method #262

Merged
merged 4 commits into from
Jul 20, 2023

Conversation

Tigrov
Copy link
Member

@Tigrov Tigrov commented Jul 20, 2023

Q A
Is bugfix?
New feature?
Breaks BC?
Fixed issues -

@what-the-diff
Copy link

what-the-diff bot commented Jul 20, 2023

PR Summary

  • Parameter Type Adjustment
    The declaration of the parameter type in the normalizeDefaultValue method located within src/Schema.php has been altered. Prior, the type was ?string and it has now been adjusted to string|null. This change will allow for null values to be handled more effectively.

  • Switched Matching Method
    Within the same method, normalizeDefaultValue, the matching expression used for $defaultValue has been swapped out in favor of an if statement. This introduces greater control and improves code readability.

  • Quote Removal Feature
    A new regex (a search pattern used for string matching) has been incorporated to eliminate any outer quotes that may surround $defaultValue, this happens before it is returned by the normalizeDefaultValue method. This can help reduce data processing errors due to unneeded or extra quotation marks.

@codecov
Copy link

codecov bot commented Jul 20, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.01 ⚠️

Comparison is base (032e1b3) 98.20% compared to head (13da011) 98.20%.

❗ Current head 13da011 differs from pull request most recent head d921653. Consider uploading reports for the commit d921653 to get more accurate results

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #262      +/-   ##
============================================
- Coverage     98.20%   98.20%   -0.01%     
- Complexity      323      325       +2     
============================================
  Files            17       17              
  Lines          1005     1004       -1     
============================================
- Hits            987      986       -1     
  Misses           18       18              
Impacted Files Coverage Δ
src/Schema.php 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@Tigrov Tigrov marked this pull request as ready for review July 20, 2023 12:51
src/Schema.php Show resolved Hide resolved
@vjik vjik requested a review from a team July 20, 2023 14:44
@vjik vjik added the status:code review The pull request needs review. label Jul 20, 2023
@terabytesoftw terabytesoftw merged commit b35f40e into yiisoft:master Jul 20, 2023
14 of 15 checks passed
@terabytesoftw
Copy link
Member

thks, 👍

@Tigrov Tigrov deleted the update_normalize_default_value branch July 21, 2023 04:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:code review The pull request needs review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants