chillerlan / php-qrcode

A PHP QR Code generator and reader with a user-friendly API.
https://smiley.codes/qrcode/
Apache License 2.0
2.01k stars 302 forks source link

QROptions expected type mismatch flagged #111

Closed danieldevine closed 2 years ago

danieldevine commented 2 years ago

Hi,

This doesn't break anything, all works as expected, but thought you might like to know.

When using QROptions, following an example in the docs, the following issue is flagged by intellephense when QROptions are passed to a new QRCode.

"Expected type 'chillerlan\Settings\SettingsContainerInterface|null'. Found 'chillerlan\QRCode\QROptions'.",

        $options = new QROptions([
            'version'    => 5,
            'outputType' => QRCode::OUTPUT_MARKUP_SVG,
            'eccLevel'   => QRCode::ECC_L,
        ]);

        $qr =  (new QRCode($options))->render($data);
codemasher commented 2 years ago

Hmm, looks like Intelephense doesn't properly analyze the ancestors of the QROptions class - that is, in fact, a SettingsContainerInterface - is it perhaps a configuration issue? For phan it's possible to configure the vendor path, so that it will be registered during runtime.