Skip to content

Commit

Permalink
Fix deprecation warnings thrown when used with PHP 8.4 (#32)
Browse files Browse the repository at this point in the history
* Drop support for PHP older than 7.1

* Add PHP 8.4 to php workflow

* Fix PHP 8.4 deprecation warning by making nullable all vars with null default value
  • Loading branch information
acelaya authored Nov 4, 2024
1 parent 1233099 commit 3aa4f87
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
matrix:
operating-system: ['ubuntu-latest', 'macos-latest']
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
php-versions: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
phpunit-versions: ['latest']

steps:
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
}
],
"require": {
"php": "~5.6|~7.0|~8.0",
"php": "~7.1|~8.0",
"paragonie/random_compat": ">=2.0"
},
"require-dev": {
Expand Down
12 changes: 6 additions & 6 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ class Client
*
* @codeCoverageIgnore
* @param integer $size
* @param GeneratorInterface $generator
* @param GeneratorInterface|null $generator
*/
public function __construct($size = 21, GeneratorInterface $generator = null)
public function __construct($size = 21, ?GeneratorInterface $generator = null)
{
$this->size = $size > 0 ? $size : 21;
$this->generator = $generator ?: new Generator();
Expand Down Expand Up @@ -67,12 +67,12 @@ public function generateId($size = 0, $mode = self::MODE_NORMAL)
* you have been implements your custom GeneratorInterface as correctly.
* Otherwise use the build-in default random bytes generator
*
* @param GeneratorInterface $generator
* @param GeneratorInterface|null $generator
* @param integer $size
* @param string $alphabet default CoreInterface::SAFE_SYMBOLS
* @return string
*/
public function formattedId($alphabet, $size = 0, GeneratorInterface $generator = null)
public function formattedId($alphabet, $size = 0, ?GeneratorInterface $generator = null)
{
$alphabet = $alphabet ?: CoreInterface::SAFE_SYMBOLS;
$size = $size > 0 ? $size : $this->size;
Expand All @@ -86,12 +86,12 @@ public function formattedId($alphabet, $size = 0, GeneratorInterface $generator
*
* @param string $alphabet
* @param integer $size
* @param GeneratorInterface $generator
* @param GeneratorInterface|null $generator
*
* @return string
* @since 1.0.0
*/
public function formatedId($alphabet, $size = 0, GeneratorInterface $generator = null)
public function formatedId($alphabet, $size = 0, ?GeneratorInterface $generator = null)
{
$size = $size > 0 ? $size : $this->size;

Expand Down

0 comments on commit 3aa4f87

Please sign in to comment.