-
Notifications
You must be signed in to change notification settings - Fork 61
Fix crashes with Nette 3.2 #69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jtojnar
wants to merge
14
commits into
Kdyby:master
Choose a base branch
from
jtojnar:fixes
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Nette Forms 3.2.0 replaced SplObjectStorage with WeakMap nette/forms@ec8ecfd
291a615 introduced type hints so the method now expects a string for name, consistent with `nette/component-model` (nette/component-model@47dab8f). This unfortunately leads to an error when rendering a form since range produces integers: Kdyby\Replicator\Container::createOne(): Argument Kdyby#1 ($name) must be of type ?string, int given
`Container::getComponents()` returns array when `$deep` is false (by default): nette/component-model@7f613ee The method also no longer takes any arguments: nette/component-model@4e0946a
It was introduced in 7ae4bd3 as using `string|false` but the actual type was not reflected in the annotation. Let’s tighten it up as `?string` and use type hint. This is required for PHPStan level 3.
The check was there to allow passing the callable as the first and only argument but that got broken by introduction of type hints in 291a615 so PHPStan would complain: Call to function is_bool() with bool will always evaluate to true. But we do not need this now that we support PHP 8 with named arguments: https://www.php.net/manual/en/functions.arguments.php#functions.named-arguments
Mostly adding generic types to iterables. Disabling `treatPhpDocTypesAsCertain` since we cannot guarantee the caller of public methods will respect the annotation and without this, PHPStan will complain about redundant `is_iterable`.
This was a bit annoying since the annotations in nette and phpstan-nette are not the most precise.
e7cc49e
to
5a15cae
Compare
@jakubboucek can I ask you for a review? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When trying this with latest Nette, I got several crashes. Trying to fix them all and increase PHPStan level so that I can be more certain more are not hiding in the shadows.