Summary
The following typing improvements have been made since PHP 7.0:
- Introduction of scalar type and return types for methods (PHP 7.0)
- Nullable types and void return type (PHP 7.1)
- object type for arguments and return values (PHP 7.2)
- Union types (PHP 8.0)
Motivation
There is a push in the PHP ecosystem to use stricter typing when writing PHP code. While this is not as important for PHP extensions such as PHPC, it provides users with a sense of security in that argument types and return types are not only specified in documentation, but also set in code. Introducing such types can cause BC breaks when method signatures change, so these changes should be done with care to prevent unnecessary breakage in user projects that rely on this code.
Cast of Characters
Engineering Lead:
Document Author:
POCers:
Product Owner:
Program Manager:
Stakeholders:
Documentation
[Scope Document|some.url]
[Technical Design Document|some.url]
- is related to
-
PHPC-2139 Fully typed extension
- Canceled
- related to
-
PHPC-2229 Narrow Serializable::bsonSerialize() tentative return type from array|object to array|stdClass
- Backlog
-
PHPLIB-599 Backwards compatible typing changes
- Released
-
PHPC-2108 ClientEncryption::decrypt() should expect Binary parameter instead of BinaryInterface
- Closed
-
PHPC-2182 Include stub files in generated PECL packages
- Closed
-
PHPC-2284 Force regeneration of arginfo in GitHub workflow
- Closed
-
PHPC-1858 Add return type to arginfo for JsonSerializable::jsonSerialize() in PHP 8.1
- Closed
-
PHPC-1933 Add return type to arginfo for Iterator and Countable methods in PHP 8.1
- Closed
- split from
-
PHPLIB-571 Typing improvements to driver APIs
- Development Complete