-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
Improved type inference around page containers, upgraded vimeo/psalm
and dependencies
#40
Conversation
Signed-off-by: Renovate Bot <bot@renovateapp.com>
| datasource | package | from | to | | ---------- | ----------- | ------ | ----- | | packagist | vimeo/psalm | 4.30.0 | 5.1.0 | Signed-off-by: Renovate Bot <bot@renovateapp.com>
Branch automerge failureThis PR was configured for branch automerge. However, this is not possible, so it has been raised as a PR instead.
|
The constraint on `laminas/laminas-servicemanager:^3` has been added ages ago: this code is dead and defunct.
…enovate/lock-file-maintenance
The constraint on `laminas/laminas-servicemanager:^3` has been added ages ago: this code is dead and defunct.
…`vimeo/psalm:^5.1`
Edited/Blocked NotificationRenovate will not automatically rebase this PR, because it does not recognize the last commit author and assumes somebody else may have edited the PR. ⚠ Warning: custom changes will be lost. |
Type inference improved: from |
vimeo/psalm
and dependencies
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚢 here meanwhile - rolling a release too :)
@Ocramius I don't know about Psalm, but this completely breaks PHPStan. Say I have a (native) return type Am I just missing something here? |
PHPStan supports templates too: do you have an example, perhaps an error reported by phpstan? Be aware that we keep parity with psalm, for now, so if psalm is ahead, phpstan will indeed report issues. |
What you probably want:
|
I'm sorry, I probably wasn't being clear enough. I am well aware of PHPStan's template support. I also use templates a lot. Here's an example: // We're in some page factory class
public function createPage(): AbstractPage
{
// ...
} PHPStan complains about the missing type argument for the returned
When I add the type argument: /**
* @return AbstractPage<AbstractPage>
*/ PHPStan complains about the missing type argument for the "inner" I guess what you're saying is "make your page factory class generic as well"? Well, this factory isn't the only place I'm using pages. You've got the same problem if you just have a I think this all boils down to the lack of default types for type arguments like you have in TypeScript: interface Foo<T extends object = {myDefault: string}> {
// ...
} |
I mainly use PHPStan over psalm and they're pretty similar. You can use a template in the method instead of the class if you want to avoid making your factories generic too. Though I have to ask why the solution to this would be to weaken the types in laminas and not strengthen the types in the implementation? |
@internalsystemerror You're right, I haven't thought of making the methods themselves generic. That would be a solution, thanks. I'm not saying we should weaken Laminas' types, I was just stating my problem and asking for a solution. Believe me, my collegues sometimes hate me for being so crazy about strict typing. But in this particular case I really don't see any benefit in |
I just tried adding a |
@MidnightDesign ah fair ... |
@internalsystemerror Exactly. @Ocramius What do you think? I can open a PR if you want. |
I'm not following: send a patch with your idea, and let's discuss on a diff. |
This PR contains the following updates:
🔧 This Pull Request updates lock files to use the latest dependency versions.
Configuration
📅 Schedule: Branch creation - "before 2am" in timezone UTC, Automerge - At any time (no schedule defined).
🚦 Automerge: Enabled.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
👻 Immortal: This PR will be recreated if closed unmerged. Get config help if that's undesired.
Read more information about the use of Renovate Bot within Laminas.