Skip to content

Add mixed type declaration to FieldTypeInterface::render() $data parameter for BC layer #423

Description

@Prometee

Background

The FieldTypeInterface::render() method in src/Component/FieldTypes/FieldTypeInterface.php currently has a $data parameter without an explicit type declaration. The docblock indicates @param mixed $data, but the parameter itself lacks the mixed type hint.

Current Implementation

public function render(Field $field, $data, array $options);

Proposal

Add the explicit mixed type to the $data parameter to align with modern PHP standards and maintain backward compatibility:

public function render(Field $field, mixed $data, array $options);

Benefits

  • Aligns the method signature with its documented behavior
  • Improves type safety and IDE support
  • Prepares the codebase for stricter type enforcement in future PHP versions
  • Maintains backward compatibility as mixed accepts any type

Related Files

  • src/Component/FieldTypes/FieldTypeInterface.php
  • All implementations of FieldTypeInterface will need to be updated accordingly

Tasks

  • Update FieldTypeInterface::render() to include mixed type for $data parameter
  • Update all implementations of FieldTypeInterface in the codebase
  • Run tests to ensure BC is maintained
  • Update documentation if needed

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions