Skip to content

Conversation

@sbuerk
Copy link
Contributor

@sbuerk sbuerk commented Aug 6, 2024

  • [TASK] Avoid implicitly nullable class method parameter
    With PHP 8.4 marking method parameter implicitly nullable
    is deprecated and will emit a E_DEPRECATED warning. One
    recommended way to resolve this, is making it explicitly
    nullable using the ? nullable operator or adding a null
    type to an union type definition. [1]

    This prepares the way towards PHP 8.4 compatibility.

    [1] https://php.watch/versions/8.4/implicitly-marking-parameter-type-nullable-deprecated

  • [TASK] Ensure coding-style for nullable type declarations
    This change modifies the php-cs-fixer ruleset and
    activate two rules related to nullable types.

    Following options are added:

      'nullable_type_declaration' => [
        'syntax' => 'question_mark',
      ],
      'nullable_type_declaration_for_default_null_value' => true,

    nullable_type_declaration ensures to use ?<type> declaration
    instead of union type <type>|null as a convention for properties,
    method and return types. For already union types the nullable is
    added as additional null union type ObjectOne|ObjectInterface|null.

    nullable_type_declaration_for_default_null_value ensures
    to use nullable type declarations to mitigate implicitly
    nullable method arguments [1] which has been already fixed
    with a series of dedicated changes.

    Used command(s):

    Build/Scripts/runTests.sh -s cgl
    

    [1] https://php.watch/versions/8.4/implicitly-marking-parameter-type-nullable-deprecated

sbuerk added 2 commits August 6, 2024 17:16
With PHP 8.4 marking method parameter implicitly nullable
is deprecated and will emit a `E_DEPRECATED` warning. One
recommended way to resolve this, is making it explicitly
nullable using the `?` nullable operator or adding a null
type to an union type definition. [1]

This prepares the way towards PHP 8.4 compatibility.

[1] https://php.watch/versions/8.4/implicitly-marking-parameter-type-nullable-deprecated
This change modifies the `php-cs-fixer` ruleset and
activate two rules related to nullable types.

Following options are added:

  'nullable_type_declaration' => [
    'syntax' => 'question_mark',
  ],
  'nullable_type_declaration_for_default_null_value' => true,

`nullable_type_declaration` ensures to use `?<type>` declaration
instead of union type `<type>|null` as a convention for properties,
method and return types. For already union types the nullable is
added as additional null union type `ObjectOne|ObjectInterface|null`.

`nullable_type_declaration_for_default_null_value` ensures
to use nullable type declarations to mitigate implicitly
nullable method arguments [1] which has been already fixed
with a series of dedicated changes.

Used command(s):

  Build/Scripts/runTests.sh -s cgl

[1] https://php.watch/versions/8.4/implicitly-marking-parameter-type-nullable-deprecated
@sbuerk sbuerk changed the title stefan 1 [TASK] Prepare towards PHP 8.4 compatibility Aug 6, 2024
Copy link
Contributor

@achimfritz achimfritz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 thanks

@achimfritz achimfritz merged commit b164645 into b13:master Aug 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants