Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Declare strict_types and use STH/RTH #329

Merged

Conversation

weierophinney
Copy link
Member

Adds RTH and scalar type hints wherever possible. However, in many cases, because we are implementing interfaces, we cannot provide parameter type hints without conflicting with the interface; return type hints are allowed, though, due to PHP's contravariant return type rules.

Constructors always add parameter types, however, which eliminates the need for many unit tests, as well as type checks within the constructors.

A number of additional code changes were made due to enabling strict types. In some cases, we were returning values that we should not have been based on the return signature. In other cases, we were not casting values before passing them to functions or methods, and should have.

Adds RTH and scalar type hints wherever possible. However, in many
cases, because we are implementing interfaces, we cannot provide
parameter type hints without conflicting with the interface; return type
hints are allowed, though, due to PHP's contravariant return type rules.

Constructors always add parameter types, however, which eliminates the
need for many unit tests, as well as type checks within the
constructors.

A number of additional code changes were made due to enabling strict
types. In some cases, we were returning values that we should not have
been based on the return signature. In other cases, we were not casting
values before passing them to functions or methods, and should have.
@weierophinney weierophinney merged commit e09009e into zendframework:release-2.0 Sep 8, 2018
weierophinney added a commit that referenced this pull request Sep 8, 2018
@weierophinney weierophinney deleted the hotfix/strict-types branch September 8, 2018 20:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant