diff --git a/.travis.yml b/.travis.yml index a6bcdd089..b73a1491f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,11 @@ language: php -php: - - 7.0 - - 7.1 - - 7.2 +matrix: + include: + - php: 7.2 + - php: nightly + allow_failures: + - php: nightly install: travis_retry composer install --no-interaction --prefer-source diff --git a/composer.json b/composer.json index c4e431216..f9b2defa3 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "chillerlan/php-qrcode", - "description": "A QR code generator. PHP 7+", + "description": "A QR code generator. PHP 7.2+", "homepage": "https://github.com/chillerlan/php-qrcode", "license": "MIT", "minimum-stability": "stable", @@ -20,15 +20,13 @@ } ], "require": { - "php": ">=7.0.3", - "chillerlan/php-traits": "^1.1" + "php": ">=7.2.0", + "chillerlan/php-traits": "^2.0" }, "require-dev": { - "phpunit/phpunit": "^6.5", + "phpunit/phpunit": "^7.3", "chillerlan/php-authenticator": "^2.0" }, - "suggest": { - }, "autoload": { "psr-4": { "chillerlan\\QRCode\\": "src/" diff --git a/phpunit.xml b/phpunit.xml index 25e82cf68..2a41c5d15 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -8,7 +8,6 @@ convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" - syntaxCheck="false" > diff --git a/src/Data/QRDataAbstract.php b/src/Data/QRDataAbstract.php index 3ec3a2a9e..645f53d45 100644 --- a/src/Data/QRDataAbstract.php +++ b/src/Data/QRDataAbstract.php @@ -18,8 +18,9 @@ use chillerlan\QRCode\{ use chillerlan\QRCode\Helpers\{ BitBuffer, Polynomial }; -use chillerlan\Traits\ClassLoader; -use chillerlan\Traits\ContainerInterface; +use chillerlan\Traits\{ + ClassLoader, ImmutableSettingsInterface +}; /** * Processes the binary data and maps it on a matrix which is then being returned @@ -89,10 +90,10 @@ abstract class QRDataAbstract implements QRDataInterface{ /** * QRDataInterface constructor. * - * @param \chillerlan\Traits\ContainerInterface $options + * @param \chillerlan\Traits\ImmutableSettingsInterface $options * @param string|null $data */ - public function __construct(ContainerInterface $options, string $data = null){ + public function __construct(ImmutableSettingsInterface $options, string $data = null){ $this->options = $options; if($data !== null){ @@ -186,6 +187,7 @@ abstract class QRDataAbstract implements QRDataInterface{ * @throws \chillerlan\QRCode\Data\QRCodeDataException */ protected function getMinimumVersion():int{ + $maxlength = 0; // guess the version number within the given range foreach(range(max(1, $this->options->versionMin), min($this->options->versionMax, 40)) as $version){ diff --git a/src/Output/QROutputAbstract.php b/src/Output/QROutputAbstract.php index 823450014..77904fcfe 100644 --- a/src/Output/QROutputAbstract.php +++ b/src/Output/QROutputAbstract.php @@ -15,7 +15,7 @@ namespace chillerlan\QRCode\Output; use chillerlan\QRCode\{ Data\QRMatrix, QRCode }; -use chillerlan\Traits\ContainerInterface; +use chillerlan\Traits\ImmutableSettingsInterface; /** * @@ -50,10 +50,10 @@ abstract class QROutputAbstract implements QROutputInterface{ /** * QROutputAbstract constructor. * - * @param \chillerlan\Traits\ContainerInterface $options + * @param \chillerlan\Traits\ImmutableSettingsInterface $options * @param \chillerlan\QRCode\Data\QRMatrix $matrix */ - public function __construct(ContainerInterface $options, QRMatrix $matrix){ + public function __construct(ImmutableSettingsInterface $options, QRMatrix $matrix){ $this->options = $options; $this->matrix = $matrix; $this->moduleCount = $this->matrix->size(); diff --git a/src/QRCode.php b/src/QRCode.php index a2d9cd0aa..13ba93ae6 100755 --- a/src/QRCode.php +++ b/src/QRCode.php @@ -19,7 +19,7 @@ use chillerlan\QRCode\Output\{ QRCodeOutputException, QRImage, QRMarkup, QROutputInterface, QRString }; use chillerlan\Traits\{ - ClassLoader, ContainerInterface + ClassLoader, ImmutableSettingsInterface }; /** @@ -106,9 +106,9 @@ class QRCode{ /** * QRCode constructor. * - * @param \chillerlan\Traits\ContainerInterface|null $options + * @param \chillerlan\Traits\ImmutableSettingsInterface|null $options */ - public function __construct(ContainerInterface $options = null){ + public function __construct(ImmutableSettingsInterface $options = null){ mb_internal_encoding('UTF-8'); $this->setOptions($options ?? new QROptions); @@ -117,12 +117,12 @@ class QRCode{ /** * Sets the options, called internally by the constructor * - * @param \chillerlan\Traits\ContainerInterface $options + * @param \chillerlan\Traits\ImmutableSettingsInterface $options * * @return \chillerlan\QRCode\QRCode * @throws \chillerlan\QRCode\QRCodeException */ - public function setOptions(ContainerInterface $options):QRCode{ + public function setOptions(ImmutableSettingsInterface $options):QRCode{ if(!array_key_exists($options->eccLevel, $this::ECC_MODES)){ throw new QRCodeException('Invalid error correct level: '.$options->eccLevel); diff --git a/src/QROptions.php b/src/QROptions.php index 5468e98f3..a33cc1d4a 100644 --- a/src/QROptions.php +++ b/src/QROptions.php @@ -12,7 +12,7 @@ namespace chillerlan\QRCode; -use chillerlan\Traits\ContainerAbstract; +use chillerlan\Traits\ImmutableSettingsAbstract; /** * @property int $version @@ -45,6 +45,6 @@ use chillerlan\Traits\ContainerAbstract; * * @property array $moduleValues */ -class QROptions extends ContainerAbstract{ +class QROptions extends ImmutableSettingsAbstract{ use QROptionsTrait; }