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

TypeToArrayConverter PHPStan error #72

Open
FVesely opened this issue Feb 15, 2024 · 3 comments
Open

TypeToArrayConverter PHPStan error #72

FVesely opened this issue Feb 15, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@FVesely
Copy link

FVesely commented Feb 15, 2024

Library version

v1.x-dev

Description

If I use TypeToArrayConverter instead of TypeToStringConverter I get a PHPStan error.

Steps to reproduce

$printer = new ErrorVisualPrinter(new TypeToArrayConverter());

Actual Behavior

 Parameter #1 $converter of class Orisai\ObjectMapper\Printers\ErrorVisualPrinter constructor expects Orisai\ObjectMapper\Printers\TypeToPrimitiveConverter<array>,  
         Orisai\ObjectMapper\Printers\TypeToArrayConverter given.                                                                                                            
         💡 Template type T on class Orisai\ObjectMapper\Printers\TypeToPrimitiveConverter is not covariant.

Expected Behavior

No error

Addition information

No response

@FVesely FVesely added the bug Something isn't working label Feb 15, 2024
@mabar
Copy link
Member

mabar commented Dec 30, 2024

Hello,
I am currently on latest v1.x-dev (which shall be soon released as 0.2.0) and on phpstan/phpstan:^2 and I get no error.
Please make sure your dependencies are up-to-date and, if you still get an error, re-open the issue.

@mabar mabar closed this as completed Dec 30, 2024
@FVesely
Copy link
Author

FVesely commented Dec 31, 2024

@mabar I still get this error with v1.x-dev and PHPStan 2 on level 9. I can't re-open this issue.

{
	"require": {
		"php": ">=8.4",
		"orisai/object-mapper": "v1.x-dev"
	},
	"require-dev": {
		"phpstan/phpstan": "^2.1"
	}
}

@mabar
Copy link
Member

mabar commented Dec 31, 2024

I see, the error starts to occur on level 9 (I am using 8)
I am not really sure how to solve the error and since it's just analysis error it will probably stay here for the foreseeable future (until I get back to re-working the printers)

@mabar mabar reopened this Dec 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

2 participants