Skip to content

Conversation

vrana
Copy link
Member

@vrana vrana commented Aug 28, 2025

  • new feature
  • BC break? yes
  • doc PR: n/a

I have this property:

	#[Parameter]
	public string $code;

If there's no ?code= in URL and I access $this->code then PHP dies with this fatal error:

Typed property Presenter::$code must not be accessed before initialization

I would prefer to behave it the same way as if there's a missing parameter with render(int $code) which is to throw InvalidArgumentException.

@vrana vrana requested a review from dg August 28, 2025 12:41
@vrana vrana force-pushed the require-parameter branch from 0459dc6 to f96d45c Compare August 28, 2025 12:45
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.

1 participant