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.

dg added 19 commits August 1, 2025 03:55
- inteface Nette\Application\IRouter replaced by Nette\Routing\Router
…e() for persistent parameters. [Closes nette/nette#703][Closes nette/nette#703][Closes nette#69]" (possible BC break)

This reverts commit cda17f4.

See https://forum.nette.org/cs/35528-stejne-pojmenovany-parametr-akce-presenteru-a-persistentni-odlisne-chovani-v-nette-2-0-oproti-aktualnimu#p221742

BC break: Property must be nullable, ie: #[Persistent] public ?int $foo
…rs dynamically (BC break)

TODO: scanDir must be active
@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
@dg dg force-pushed the master branch 5 times, most recently from 246b583 to 158960d Compare November 25, 2025 00:31
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.

2 participants