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

First implementation #1

Merged
merged 35 commits into from
May 7, 2023
Merged

First implementation #1

merged 35 commits into from
May 7, 2023

Conversation

vjik
Copy link
Member

@vjik vjik commented Apr 27, 2023

Q A
Is bugfix?
New feature? ✔️
Breaks BC?
Fixed issues

@codecov
Copy link

codecov bot commented Apr 27, 2023

Codecov Report

❗ No coverage uploaded for pull request base (master@7622ca0). Click here to learn what that means.
Patch has no changes to coverable lines.

Additional details and impacted files
@@            Coverage Diff             @@
##             master        #1   +/-   ##
==========================================
  Coverage          ?   100.00%           
  Complexity        ?       149           
==========================================
  Files             ?        16           
  Lines             ?       360           
  Branches          ?         0           
==========================================
  Hits              ?       360           
  Misses            ?         0           
  Partials          ?         0           

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

@vjik vjik requested a review from a team April 28, 2023 11:26
@vjik vjik added the status:code review The pull request needs review. label Apr 28, 2023
src/HydratorInterface.php Outdated Show resolved Hide resolved
src/Typecast/SimpleTypecast.php Outdated Show resolved Hide resolved
src/Typecast/SimpleTypecast.php Outdated Show resolved Hide resolved
src/Attribute/Parameter/CastToString.php Outdated Show resolved Hide resolved
src/Attribute/NoPopulate.php Outdated Show resolved Hide resolved
src/Attribute/Parameter/Di.php Show resolved Hide resolved
src/Typecast/SimpleTypecast.php Outdated Show resolved Hide resolved
config/di.php Outdated Show resolved Hide resolved
src/Typecast/SimpleTypecast.php Outdated Show resolved Hide resolved
src/Typecast/SimpleTypecast.php Outdated Show resolved Hide resolved
@arogachev arogachev self-requested a review May 4, 2023 04:55
src/Attribute/Data/Strict.php Show resolved Hide resolved
src/Attribute/Parameter/CastToString.php Outdated Show resolved Hide resolved
src/Attribute/Parameter/CastToString.php Outdated Show resolved Hide resolved
src/Attribute/Parameter/Data.php Show resolved Hide resolved
src/Attribute/SkipHydrate.php Outdated Show resolved Hide resolved
src/Typecast/SimpleTypecast.php Outdated Show resolved Hide resolved
src/Typecast/SimpleTypecast.php Outdated Show resolved Hide resolved
src/Hydrator.php Show resolved Hide resolved
src/Hydrator.php Outdated Show resolved Hide resolved
src/Hydrator.php Outdated Show resolved Hide resolved
vjik and others added 2 commits May 4, 2023 13:34
Co-authored-by: Alexey Rogachev <[email protected]>
Co-authored-by: Alexey Rogachev <[email protected]>
@arogachev arogachev requested a review from xepozz May 4, 2023 11:10
composer.json Outdated Show resolved Hide resolved
src/Attribute/Parameter/CastToString.php Outdated Show resolved Hide resolved
) {
return (string) $resolvedValue;
}
return '';
Copy link
Member

Choose a reason for hiding this comment

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

Isn't it expected to become as an error?

Copy link
Member Author

Choose a reason for hiding this comment

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

Idea of CastToString — cast value to string always.

Copy link
Member

Choose a reason for hiding this comment

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

That it's better to handle it and add context: which attribute crashed the runtime

src/DataAttributeInterface.php Outdated Show resolved Hide resolved
src/DataAttributesHandler.php Outdated Show resolved Hide resolved
src/DataAttributesHandler.php Show resolved Hide resolved
src/DataHelper.php Show resolved Hide resolved
src/NotResolvedException.php Show resolved Hide resolved
src/Typecast/CompositeTypecast.php Outdated Show resolved Hide resolved
src/TypecastInterface.php Outdated Show resolved Hide resolved
src/Attribute/SkipHydrate.php Outdated Show resolved Hide resolved
src/Hydrator.php Show resolved Hide resolved
true,
);

$this->assertSame('.', $model->getA());
Copy link
Member

Choose a reason for hiding this comment

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

Why so?

Copy link
Member Author

Choose a reason for hiding this comment

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

Strict mode. In strcit mode hydrate properties from map only.

Copy link
Member

Choose a reason for hiding this comment

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

I mean why the dot, but not an empty string, null or exception?

Copy link
Member Author

Choose a reason for hiding this comment

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

In strict mode not hydrate properties which are not in map. In this test dots is default values in model:

image

Copy link
Member

Choose a reason for hiding this comment

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

And what would happen if a model doesn't have default value?

Copy link
Member Author

Choose a reason for hiding this comment

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

Nothing

@vjik vjik merged commit 712252e into master May 7, 2023
@vjik vjik deleted the first-implementation branch May 7, 2023 15:06
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.

6 participants