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

Add support for Endroid 5 #232

Merged
merged 2 commits into from
Oct 4, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Ignore PHPStan errors on different Endroid versions
  • Loading branch information
sprain committed Oct 4, 2023
commit 51888c05d08d512d91d6a02e532418e169130e4c
4 changes: 4 additions & 0 deletions src/QrCode/QrCode.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,21 @@ private function __construct(string $data, string $fileFormat)
// Endroid 4.x
$this->qrCode = BaseQrCode::create($data)
->setEncoding(new Encoding('UTF-8'))
/** @phpstan-ignore-next-line as it throws error if Endroid 5 is installed */
->setErrorCorrectionLevel(new ErrorCorrectionLevel\ErrorCorrectionLevelMedium())
->setSize(self::PX_QR_CODE)
->setMargin(0)
/** @phpstan-ignore-next-line as it throws error if Endroid 5 is installed */
->setRoundBlockSizeMode(new RoundBlockSizeMode\RoundBlockSizeModeEnlarge());
} else {
// Endroid 5.x
$this->qrCode = BaseQrCode::create($data)
->setEncoding(new Encoding('UTF-8'))
/** @phpstan-ignore-next-line as it throws error if Endroid 4 is installed */
->setErrorCorrectionLevel(ErrorCorrectionLevel::Medium)
->setSize(self::PX_QR_CODE)
->setMargin(0)
/** @phpstan-ignore-next-line as it throws error if Endroid 4 is installed */
->setRoundBlockSizeMode(RoundBlockSizeMode::Enlarge);
}

Expand Down