Gradual Type Checking¶
Gradual type checking is the progressive introduction of types in a code base. When a code base is not fully typed, it is in a state of gradual typing. Types are introduced, which leads to various level of validation and verifications, and a better stability.
Gradual Type Checking ends when the code is all typed: arguments, return types, properties, constants. There might be some ambiguous situations, such as with variables, yields and use.
<?php
// partially typed function
function foo(int $i, $b) {
// some code
}
?>
See also Gradual Type Checking & Sorbet, What is Gradual Typing and PHP’s Gradual Typing Journey: From Wild West to Almost Respectable.
Related : Type System, Type Checking, Type Inference