minkphp/Mink

Strictly typed methods

uuf6429 opened this issue · 3 comments

Hey,

@stof I'm wondering about the last release, where support for PHP <7.2 has been removed, isn't that considered a BC break?

I'm wondering because at the same time that happened, I would have taken advantage of the version jump to update the driver interface methods argument/result types.

stof commented

Bumping the minimum PHP version is not a BC break as Composer takes the PHP constraints into account (if someone runs composer with --ignore-platform-reqs, they are on their own). So this can happen in a minor version (this is a big difference with the npm ecosystem where the node compat is not taken into account during dependency resolution but only to show a warning during installation time later).

However, adding return types in methods is a BC break, so this can happen only in a major version.
And with the way variance rules work, we should add the return types in driver implementations before adding them in the interface (note that this is a big reason why I'm working on adding static analysis in Mink to make sure that the phpdoc types are right in the interface).

Sounds good. Feel free to close this issue.

stof commented

Thinking about that again, what I said is true for return types. But parameter types should be added in the parent first so we can add them now that we require PHP 7.2+ (which is a prerequisite for any work on adding types)