Skip to content

Commit

Permalink
PHP 8.4 - implicit nulls are deprecated
Browse files Browse the repository at this point in the history
`MobileDetect::__construct(): Implicitly marking parameter $cache as nullable is deprecated, the explicit nullable type must be used instead`
`CacheException::__construct(): Implicitly marking parameter $previous as nullable is deprecated, the explicit nullable type must be used instead`

Updated Github Actions workflow to include PHP 8.4

Fixes #956
Replaces #957
  • Loading branch information
drbyte committed Aug 7, 2024
1 parent 9deba9f commit c898b69
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/4.8.x-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,10 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
php-version: [8.0, 8.1, 8.2, 8.3]
php-version: [8.0, 8.1, 8.2, 8.3, 8.4]
os: ['ubuntu-latest']
include:
- os: 'ubuntu-latest'
phpunit-version: '9.6.10'
composer-version: 'latest'
composer-version: ['latest']
phpunit-version: ['^9.6.18']
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^v3.35.1",
"phpunit/phpunit": "^9.6",
"phpunit/phpunit": "^9.6.18",
"squizlabs/php_codesniffer": "^3.7",
"phpbench/phpbench": "^1.2",
"phpstan/phpstan": "^1.10"
Expand Down
2 changes: 1 addition & 1 deletion src/Cache/CacheException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class CacheException extends \Exception
{
public function __construct($message, $code = 0, \Throwable $previous = null)
public function __construct($message, $code = 0, ?\Throwable $previous = null)
{
// some code

Expand Down
4 changes: 2 additions & 2 deletions src/MobileDetect.php
Original file line number Diff line number Diff line change
Expand Up @@ -1028,11 +1028,11 @@ class MobileDetect
* Construct an instance of this class.
*/
public function __construct(
Cache $cache = null,
?Cache $cache = null,
array $config = [],
) {
// If no custom cache provided then use our own.
$this->cache = $cache == null ? new Cache() : $cache;
$this->cache = $cache ?? new Cache();
// Override config from user.
$this->config = array_merge($this->config, $config);

Expand Down

0 comments on commit c898b69

Please sign in to comment.