-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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
[8.x] Fixes for PHP 8.1 #37101
[8.x] Fixes for PHP 8.1 #37101
Changes from all commits
65e5ea4
1e93718
304bc82
1046255
493876b
4838af5
b3bfa4a
6facd57
173362c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,16 +20,16 @@ class RedisBroadcaster extends Broadcaster | |
/** | ||
* The Redis connection to use for broadcasting. | ||
* | ||
* @var string | ||
* @var ?string | ||
*/ | ||
protected $connection; | ||
protected $connection = null; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If it will throw a type exception when it takes a "null" value, we can fix it by converting it to a string. I am saying this from the following point of view. It doesn't seem nice to me to define default values for parameters in the class. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Briefly, isn't it a good solution to convert a "null" value to a string instead of defining it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
It has already had the default value and it was defined in the constructor. Using mocks, however, bypasses the constructor and this property isn't set to its default. I've written that already in this comment. Seems pretty nice to me, that's how default properties are meant to be used. It just has been unnecessary, as it was set in the constructor anyway (except for when this class was mocked, which nobody noticed). |
||
|
||
/** | ||
* The Redis key prefix. | ||
* | ||
* @var string | ||
*/ | ||
protected $prefix; | ||
protected $prefix = ''; | ||
|
||
/** | ||
* Create a new broadcaster instance. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,14 +36,10 @@ public function setUpRedis() | |
|
||
if (! extension_loaded('redis')) { | ||
$this->markTestSkipped('The redis extension is not installed. Please install the extension to enable '.__CLASS__); | ||
|
||
return; | ||
} | ||
|
||
if (static::$connectionFailedOnceWithDefaultsSkip) { | ||
$this->markTestSkipped('Trying default host/port failed, please set environment variable REDIS_HOST & REDIS_PORT to enable '.__CLASS__); | ||
|
||
return; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
} | ||
|
||
foreach ($this->redisDriverProvider() as $driver) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the default in the constructor, which is bypassed by mocks. The same goes for
$prefix
.