I'm looking at some one else's code that I do not understand. This is example of class:
class ImageService
{
public function __construct(
private ImageTransformer $imageTransformer,
private PostService $postService
) {
}
// other methods here
}
IDE is showing errors under _construct due to "private" inside params. I know that in PHP 8 there are union types, but I cannot find any info about using "private" or "public" not inside class but inside constructor, and what this supposed to do. I thought that this is typo, and it supposed to be inside class, but multiple classes are created like this. Is this a valid code or someone does not know what is he doing?