Skip to content

code_samples_usage.php: Fix nullables #2777

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: 5.0
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions tools/code_samples/code_samples_usage.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
}
}

function displayBlocks(array $docFileBlocks, string $docFilePath = null, $lineOffset = 0): void
function displayBlocks(array $docFileBlocks, ?string $docFilePath = null, $lineOffset = 0): void
{
if (!$docFilePath) {
$docFilePath = '';
Expand Down Expand Up @@ -53,7 +53,7 @@ function displayBlocks(array $docFileBlocks, string $docFilePath = null, $lineOf
* If null, all files including a file are returned.
* @return array<int, string> List of file paths from docs/ directory.
*/
function getIncludingFileList(string $codeSampleFilePath = null): array
function getIncludingFileList(?string $codeSampleFilePath = null): array
{
$pattern = null === $codeSampleFilePath ? '= include_file' : $codeSampleFilePath;
$pattern = escapeshellarg($pattern);
Expand All @@ -71,7 +71,7 @@ function getIncludingFileList(string $codeSampleFilePath = null): array
* @return array<int, array<int, string>> List of blocks. A block is an array of consecutive lines where the key is the one-based line number.
* @todo Create a Block class
*/
function getInclusionBlocks(string $docFilePath, string $codeSampleFilePath = null): array
function getInclusionBlocks(string $docFilePath, ?string $codeSampleFilePath = null): array
{
$pattern = null === $codeSampleFilePath ? '= include_file' : $codeSampleFilePath;

Expand Down
Loading