Hi

On 4/4/24 17:40, Vinicius Dias wrote:
I like this concept, but instead of introducing a new syntax, have you
considered leveraging attributes in the same way that PHP 8.3
introduced #[Override]?

#[Nonvariadic]
function foo () {}
foo(42); // warning: foo() expects exactly 0 arguments, 1 given

I think the intent would be clearer and it would avoid introducing a new syntax.


I agree that using an attribute would be better for this case.

I disagree with an attribute being the right choice here. In contrast to #[\Override], this proposal changes the behavior for the *caller* of the function and likely also requires adjustments in child classes when newly introduced in a parent class or interface.

Thus it is part of the function's API and thus should be part of the regular signature and not the attribute-based metadata.

Best regards
Tim Düsterhus

Reply via email to