Problem/Motivation

Lots of work has gone into Statement classes in the last couple of majors. Maybe we can now reflect that in the typehinting of StatementInterface methods' parameters.

Proposed resolution

Prepare new signatures for the methods in D11 according to https://www.drupal.org/about/core/policies/core-change-policies/how-to-d.... In D12, finalize the change.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3522561

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mondrake created an issue. See original summary.

mondrake’s picture

Issue summary: View changes
Status: Active » Needs review
needs-review-queue-bot’s picture

Status: Needs review » Needs work
StatusFileSize
new91 bytes

The Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".

This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

mondrake’s picture

Status: Needs work » Needs review

smustgrave made their first commit to this issue’s fork.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +Needs Review Queue Initiative

Fixed a minor cspell issue

Reviewing how other tickets like this have been believe this should be correct. Not comment!

mondrake’s picture

Thanks for fixing that typo!

needs-review-queue-bot’s picture

Status: Reviewed & tested by the community » Needs work
StatusFileSize
new91 bytes

The Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".

This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

mondrake’s picture

Status: Needs work » Reviewed & tested by the community

rebased

longwave’s picture

Status: Reviewed & tested by the community » Needs work

Change record links are invalid.

Also not very happy about the phpcs:ignore tags as they make the docs super hard to read - more meta tags than useful information! - but not sure what we can do about that.

mondrake’s picture

Status: Needs work » Needs review

Totally missed the CR, sorry. Added a draft one.

#3531685: Ignore specifc sniffs when adding additional parameters to interface methods came up with a different format for the phpcs:ignore, @todo and @see dance. Attending the ball here.

mondrake’s picture

dcam’s picture

Status: Needs review » Reviewed & tested by the community

I reviewed the most recent changes. The change record links are correct now. The new formatting of the tags seems very readable to me. I'm going to bump this back to RTBC.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.

needs-review-queue-bot’s picture

Status: Reviewed & tested by the community » Needs work
StatusFileSize
new944 bytes

The Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

mondrake’s picture

Status: Needs work » Reviewed & tested by the community
Issue tags: +no-needs-review-bot

bot fluke

mondrake’s picture

Changed inline @see references to a new meta, the previously referenced one was pointing to a closed D11 one. Leaving at RTBC.

godotislate’s picture

Status: Reviewed & tested by the community » Needs review

A couple questions on the MR.

mondrake’s picture

Assigned: Unassigned » mondrake
Status: Needs review » Needs work

Needs some more work, on it.

longwave’s picture

We only need to go through that preparation cycle when changing an existing typehint or adding a new argument I think?

Adding a new typehint to an existing argument on an interface should be fine: https://3v4l.org/Whe7r - this is the opposite way round to return types where we need to add them from the bottom up.

mondrake’s picture

Thanks for #21, forgot about contravariance. Let's try, we'd have to deprecate passing unexpected parameters on the base class.

mondrake’s picture

Title: Prepare full typing of StatementInterface methods' parameters » Fully type StatementInterface methods' parameters
Assigned: mondrake » Unassigned
Status: Needs work » Needs review
smustgrave’s picture

Question how come this one didn’t follow the same path as the other parameter tickets with it being commented out?

mondrake’s picture

#24 because we are adding type to method parameters, and these are contravariant unlike return types that are covariant

From https://www.php.net/manual/en/language.o op5.variance.php:

Covariance allows a child's method to return a more specific type than the return type of its parent's method. Contravariance allows a parameter type to be less specific in a child method, than that of its parent.

It was like that till #21 when @longwave pointed out it was unnecessary.

smustgrave’s picture

Only other question and don't mind marking, but should it be 13 vs 12?

mondrake’s picture

No strong opinions

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Lets leave as is then and see if the core committer. I'm 50/50 since it's the database stuff but may be a none issue in the grand scheme of things. Thanks for indulging my questions!

  • amateescu committed 645ffba8 on main
    task: #3522561 Fully type StatementInterface methods' parameters
    
    By:...
amateescu’s picture

Version: main » 11.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

Searched contrib for any usage of PDO::FETCH_ORI_* and found none, so I think removing in D12 is fine.

Committed 645ffba and pushed to main. Thanks!

We'll need a 11.x backport MR.

mondrake’s picture

Status: Patch (to be ported) » Needs review

MR 15426 backports to 11.x

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

looks like a good rebase

  • amateescu committed ab14cc05 on 11.x
    task: #3522561 Fully type StatementInterface methods' parameters
    
    By:...
amateescu’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: -no-needs-review-bot

Committed ab14cc0 and pushed to 11.x. Thanks!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.