Skip to content
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

Interface for Model Workflow #73

Open
wit3 opened this issue Feb 20, 2023 · 4 comments
Open

Interface for Model Workflow #73

wit3 opened this issue Feb 20, 2023 · 4 comments

Comments

@wit3
Copy link
Contributor

wit3 commented Feb 20, 2023

Hi

When custom model it's defined the entire package continue to reference in php doc to the "base" workflow model in phpdocblock use Workflow class
like here

* @param callable(Workflow): void $callback

this create an error with phpstan beacause doesn't accept the new defined model ( that extend Workflow as described in readme )

Maybe an interface it's a solution?

@ksassnowski
Copy link
Owner

Weird, as passing in a class that extends from Workflow should still be covariant. I'm a bit surprised PHPStan complains about that.

@wit3
Copy link
Contributor Author

wit3 commented Feb 21, 2023

My custom model is a plain class that extend Workflow

<?php

namespace App\Models;


use Sassnowski\Venture\Models\Workflow as VentureWorkflow;


class Workflow extends VentureWorkflow
{
    
}

this is the error in phpstan
image

@ksassnowski
Copy link
Owner

Ok, I'm able to reproduce this and understand what the issue is. Unfortunately, it looks like this is not something I can fix before this PR gets merged into PHPStan phpstan/phpstan-src#1835. So for now, you'll have to add that error to your baseline.

@wit3
Copy link
Contributor Author

wit3 commented Feb 21, 2023

No probleme dude 👍

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

No branches or pull requests

2 participants