# RFC: Parameter (and Return) value type hints/checks

- Status: Inactive
- Original: https://wiki.php.net/rfc/typechecking
- Page: https://staging.externals.io/rfc/typechecking
- More for agents: search with https://staging.externals.io/search.md?q={query} · RFCs at https://staging.externals.io/rfc.md · JSON API at https://staging.externals.io/api · documentation at https://staging.externals.io/llms.txt

## Discussions on the mailing list

- [weak and strict type checking RFC](https://staging.externals.io/message/44690.md) — started on 2009-07-04, 14 messages
- [PHP 5.4 branch and trunk](https://staging.externals.io/message/47310.md) — started on 2010-03-16, 38 messages
- [hinting proposals status](https://staging.externals.io/message/50485.md) — started on 2010-11-25, 1 messages
- [Return Type Hinting for Methods RFC](https://staging.externals.io/message/56974.md) — started on 2011-12-21, 76 messages
- [Scalar type hinting](https://staging.externals.io/message/58111.md) — started on 2012-02-27, 159 messages

---

## Request for Comments: Parameter type specification

Various RFCs that have been proposed for parameter and return typing.

#### History

PHP is a [dynamically typed language](http://php.net/types), that does [automatic type juggling](http://php.net/manual/en/language.types.type-juggling.php) where ever possible. With PHP 5 a new feature called ["type hinting"](http://ch2.php.net/manual/en/language.oop5.typehinting.php) was introduced for arrays and objects. However the name “hint” is a bit misnamed, since triggers an E\_RECOVERABLE\_ERROR. While a fatal error can be prevented with an error handler, its not really nicely doable, since this needs to happen in a global error handler, far away in terms of code from the original context. It also comes with quite an overhead.

- [Return value type hint](https://wiki.php.net/rfc/returntypehint) by Felipe
- [Return value and parameter type hint](https://wiki.php.net/rfc/typehint) by Felipe
- [Strict and weak parameter type checking](https://wiki.php.net/rfc/typecheckingstrictandweak) by Lukas and Zeev
- [Optional Strict Type Checking for Scalars](https://wiki.php.net/rfc/typecheckingstrictonly) by Paul (Ilia's proposal)
- [Parser and Reflection-API only Type Hints](https://wiki.php.net/rfc/typecheckingparseronly) by Derick (Implemented)
- [Parameter Type Casting Hints](https://staging.externals.io/rfc/parameter_type_casting_hints) by Anthony
