Problem/Motivation

From the PHP manual:

By default, PHP will coerce values of the wrong type into the expected scalar type declaration if possible. For example, a function that is given an int for a parameter that expects a string will get a variable of type string.

This silent type-casting is often unintentional, hides potential type mismatches, and can result in runtime bugs. To align this module with modern PHP practices and Drupal 11 development standards, strict type checking should be implemented.

Proposed resolution

  • Set declare(strict_types=1); at the top of each PHP file
  • Review and fix any strict typing side effects in those files before committing them
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

dimaro created an issue. See original summary.

dimaro’s picture

Assigned: dimaro » Unassigned
Status: Active » Reviewed & tested by the community

Created Merge request: https://git.drupalcode.org/project/commerce_paypal_dynamic_subscriptions... . Skipping community / maintainer review because this was written by a maintainer.

  • dimaro committed 9814ca89 on 1.x
    Issue: #3593015 Declare strict_types in all PHP files
    
    By: dimaro
    
dimaro’s picture

Status: Reviewed & tested by the community » Fixed

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.