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

Document PHP 7+ type handling nuances #3

Open
danhunsaker opened this issue Nov 29, 2018 · 0 comments
Open

Document PHP 7+ type handling nuances #3

danhunsaker opened this issue Nov 29, 2018 · 0 comments

Comments

@danhunsaker
Copy link

The way ZendEngine2 handles types requires Zephir to enforce its own type restrictions internally. PHP 7.0 and 7.1 still rely on this functionality to a point, but adding type hinting into the language itself means they can both rely on PHP to enforce type restrictions for non-scalar values. PHP 7.2 finally added scalar type declarations to the language itself, so extensions compiled against 7.2+ no longer have to enforce strict typing internally (though that's still there as a fallback, and for values that come from within Zephir code rather than PHP userland), but do have to add declare(strict_types=1); to the beginning of their source files when PHP shouldn't be allowed to coerce the type automatically. This distinction needs to be pointed out in the docs, and the tests added in zephir-lang/zephir#1761 should help generate examples, here.

@niden niden transferred this issue from zephir-lang/zephir-docs Jan 16, 2024
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

No branches or pull requests

1 participant