Skip to content

Conversation

thekid
Copy link
Member

@thekid thekid commented Jan 29, 2022

This pull request generates more efficient code when performing casting to nullable types:

// Input
$value= (?string)$request->param('input');

// Generated code, before
$value= cast($request->param('input'), 'string', false);

// Generated code, now
$value= null === ($t0= $request->param('input')) ? null : (string)$t0;

In these cases, we can also do without the cast() function from XP Core.

@thekid thekid mentioned this pull request Jan 29, 2022
@thekid thekid merged commit 334817e into master Jan 29, 2022
@thekid thekid deleted the refactor/inline-nullable-checks branch January 29, 2022 11:01
@thekid
Copy link
Member Author

thekid commented Jan 29, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant