phpstan / phpstan-nette

Nette Framework class reflection extension for PHPStan & framework-specific rules
MIT License
100 stars 35 forks source link

Checking links #131

Closed MartinMystikJonas closed 1 year ago

MartinMystikJonas commented 1 year ago

I am planning to write rules to check validity of links (link, redirect, ...) creation.

We already do this in our phpstan-latte extension (in hacky way) but I would like to write universal solution.

Should I make it as PR to this package or would you preffer it as separate package?

ondrejmirtes commented 1 year ago

Yeah, sure, it'd be nice to have some kind of nette.containerLoader setting like we do in phpstan-symfony and phpstan-doctrine. Then we could obtain the real router and the job you're describing.

We could also use it to verify that services asked from the DIC exist, and provide the correct type for named services from ->getService($name).

MartinMystikJonas commented 1 year ago

Ok I will draft some solution

MartinMystikJonas commented 1 year ago

I have working proof of concept implementation. I just have one question: is it ok if I use internal Nette methods during static analysis? I tried to minimize dependencies on Nette. But there is lot of complex logic and I would like to use it as it is in Nette but it is marked as @internal. For example method Presenter::argsToParams (https://github.com/nette/application/blob/aa503fe11fc52c502ceefc4efa2c84b35f2194b4/src/Application/UI/Presenter.php#L1010) to preprocess link parameters?

MartinMystikJonas commented 1 year ago

Never mind it iseems I would have to reimplement it a bit differently anyway

MartinMystikJonas commented 1 year ago

Implemented in #132

github-actions[bot] commented 11 months ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.