Skip to content

PHP 8.3 and Interface Properties #10518

Answered by ondrejmirtes
hskrasek asked this question in Support
Discussion options

You must be logged in to vote

You should typehint Hvac\AttributeCost|Siding\AttributeCost instead of the AttributeCosts interface. That would make the problem go away.

If there's a lot of classes like that, you can create a type alias: https://phpstan.org/writing-php-code/phpdoc-types#local-type-aliases

The problem is that you can't declare properties on interfaces. So @property above an interface does not enforce anything. It's a hack and you're better off getting rid of it :)

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
3 replies
@hskrasek
Comment options

@hskrasek
Comment options

@ondrejmirtes
Comment options

Answer selected by hskrasek
Comment options

You must be logged in to vote
2 replies
@hskrasek
Comment options

@mad-briller
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Support
Labels
None yet
3 participants