You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
niden
transferred this issue from zephir-lang/zephir-docs
Jan 16, 2024
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.The text was updated successfully, but these errors were encountered: