Skip to content

IntlChar::foldCase()'s $option is not optional #15087

Closed
@mmalferov

Description

@mmalferov

The method signature designates the options parameter as optional with the constant IntlChar::FOLD_CASE_DEFAULT as default. I am expecting the string(1) "i" when calling var_dump(IntlChar::foldCase("I"), but I get an error:

Fatal error: Uncaught ArgumentCountError: IntlChar::foldCase() expects exactly 2 arguments, 1 given

<?php

$method = new ReflectionMethod('IntlChar', 'foldCase');
$options = $method->getParameters()[1];

// All good
var_dump(
	"Param name: " . $options->name,
	"Is optional: " . $options->isOptional(),
	"Type: " . $options->getType(),
	"Is default available: " . $options->isDefaultValueAvailable(),
	"Is default value constant: ". $options->isDefaultValueConstant(),
	"Default const name: " . $options->getDefaultValueConstantName(),
	"Default value: " . $options->getDefaultValue(),
);

// But fatal error
var_dump(IntlChar::foldCase('I'));

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions