Skip to content

Commit 6f4ec2e

Browse files
committed
Improve code to phpstan level 4
1 parent 488eb1f commit 6f4ec2e

7 files changed

Lines changed: 19 additions & 20 deletions

File tree

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ install and usage example.
3131
Bugs and feature request are tracked on [GitHub](https://github.com/bigbluebutton/bigbluebutton-api-php/issues)
3232

3333
## Contributing guidelines
34-
### Code Quality (style)
34+
### Code Quality 1: Style
3535

3636
Make sure the code style configuration is applied by running PHPCS-Fixer.
3737

@@ -40,7 +40,7 @@ Make sure the code style configuration is applied by running PHPCS-Fixer.
4040
$ composer cs-fix
4141
```
4242

43-
### Code Quality (static code analysis)
43+
### Code Quality 2: Static code analysis
4444
PHPStan shall be used for static code analysis by running the command below:
4545

4646
```bash
@@ -51,7 +51,7 @@ $ composer code-check
5151
$ ./vendor/bin/phpstan analyse
5252
```
5353

54-
### Running tests
54+
### Code Quality 3: Tests
5555

5656
For every implemented feature add unit tests and check all is green by running the command below.
5757

phpstan.neon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
parameters:
2-
level: 3
2+
level: 4
33
paths:
44
- src/
55
- tests/

src/BigBlueButton.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
use BigBlueButton\Responses\HooksCreateResponse;
4949
use BigBlueButton\Responses\HooksDestroyResponse;
5050
use BigBlueButton\Responses\HooksListResponse;
51-
use BigBlueButton\Responses\InsertDocumentResponse;
5251
use BigBlueButton\Responses\IsMeetingRunningResponse;
5352
use BigBlueButton\Responses\JoinMeetingResponse;
5453
use BigBlueButton\Responses\PublishRecordingsResponse;
@@ -74,9 +73,9 @@ class BigBlueButton
7473
/**
7574
* BigBlueButton constructor.
7675
*
77-
* @param null $baseUrl
78-
* @param null $secret
79-
* @param null|mixed $opts
76+
* @param null|string $baseUrl
77+
* @param null|string $secret
78+
* @param null|mixed $opts
8079
*/
8180
public function __construct($baseUrl = null, $secret = null, $opts = null)
8281
{
@@ -560,7 +559,7 @@ private function sendRequest($url, $payload = '', $contentType = 'application/xm
560559
{
561560
if (extension_loaded('curl')) {
562561
$ch = curl_init();
563-
if (!$ch) {
562+
if (!$ch) { /** @phpstan-ignore-line */
564563
throw new \RuntimeException('Unhandled curl error: ' . curl_error($ch));
565564
}
566565

src/Parameters/CreateMeetingParameters.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1431,7 +1431,7 @@ public function getHTTPQuery(): string
14311431
'preUploadedPresentationOverrideDefault' => $this->preUploadedPresentationOverrideDefault,
14321432
'disabledFeatures' => join(',', $this->disabledFeatures),
14331433
'disabledFeaturesExclude' => join(',', $this->disabledFeaturesExclude),
1434-
'notifyRecordingIsOn' => is_null($this->notifyRecordingIsOn) ? ($this->notifyRecordingIsOn ? 'true' : 'false') : $this->notifyRecordingIsOn,
1434+
'notifyRecordingIsOn' => !is_null($this->notifyRecordingIsOn) ? ($this->notifyRecordingIsOn ? 'true' : 'false') : $this->notifyRecordingIsOn,
14351435
'presentationUploadExternalUrl' => $this->presentationUploadExternalUrl,
14361436
'presentationUploadExternalDescription' => $this->presentationUploadExternalDescription,
14371437
'recordFullDurationMedia' => !is_null($this->recordFullDurationMedia) ? ($this->recordFullDurationMedia ? 'true' : 'false') : $this->recordFullDurationMedia,

src/Parameters/DocumentableTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ public function getPresentations()
3636
}
3737

3838
/**
39-
* @param null $content
40-
* @param null $filename
39+
* @param mixed $content
40+
* @param mixed $filename
4141
* @param mixed $nameOrUrl
4242
*
4343
* @return $this

src/Parameters/MetaParameters.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ public function addMeta($key, $value)
5656
protected function buildMeta(&$queries)
5757
{
5858
if (0 !== count($this->meta)) {
59-
foreach ($this->meta as $k => $v) {
60-
if (!is_bool($v)) {
61-
$queries['meta_' . $k] = $v;
59+
foreach ($this->meta as $key => $value) {
60+
if (!is_bool($value)) {
61+
$queries['meta_' . $key] = $value;
6262
} else {
63-
$queries['meta_' . $k] = !is_null($v) ? ($v ? 'true' : 'false') : $v;
63+
$queries['meta_' . $key] = $value ? 'true' : 'false';
6464
}
6565
}
6666
}

src/Parameters/UserDataParameters.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ public function addUserData($key, $value)
5656
protected function buildUserData(&$queries)
5757
{
5858
if (0 !== count($this->userData)) {
59-
foreach ($this->userData as $k => $v) {
60-
if (!is_bool($v)) {
61-
$queries['userdata-' . $k] = $v;
59+
foreach ($this->userData as $key => $value) {
60+
if (!is_bool($value)) {
61+
$queries['userdata-' . $key] = $value;
6262
} else {
63-
$queries['userdata-' . $k] = !is_null($v) ? ($v ? 'true' : 'false') : $v;
63+
$queries['userdata-' . $key] = $value ? 'true' : 'false';
6464
}
6565
}
6666
}

0 commit comments

Comments
 (0)