microsoftgraph / microsoftgraph/msgraph-sdk-php

Deprecated nullable type causes a warning on PHP 8.4

Open Beginner friendly
#1,643 8 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status:waiting-for-triage type:bug
Dominant language
PHP
Stars
669
Forks
150
Avg merge
15h 21m
Merged PRs (30d)
3

Description

Describe the bug

This is a mostly self-explaining problem whose fix is, fortunately, very simple - literally one extra letter.

Deprecated: Microsoft\Graph\Core\Requests\BaseBatchRequestBuilder::__construct(): Implicitly marking parameter $errorMappings as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/vendor/microsoft/microsoft-graph-core/src/Requests/BaseBatchRequestBuilder.php on line 49

Looking at the signature of the constructor

public function __construct(RequestAdapter $requestAdapter, array $errorMappings = null)

should be

public function __construct(RequestAdapter $requestAdapter, ?array $errorMappings = null)

Maybe the whole codebase should be scanned for this deprecation... these will become errors in PHP 9.

Expected behavior

No deprecation warning.

How to reproduce

Run anything with this class under PHP 8.4

SDK Version

2.25.0

Latest version known to work for scenario above?

No response

Known Workarounds

No response

Debug output
Click to expand log ```
</details>


### Configuration

_No response_

### Other information

_No response_

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at src/Requests/BaseBatchRequestBuilder.php around line 49 and inspect the constructor signature shown in the report. Run the class under PHP 8.4 to reproduce the deprecation warning. Done means the constructor no longer emits that warning; scan other nullable parameters only if the issue's broader codebase concern is addressed.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
api
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.