cloudflare / cloudflare/cloudflare-php

Strict PHP Return types not correct for DNS getRecordID()

Open
#140 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
674
Forks
268
PR merge metrics
No merged PRs in 30d

Description

In `DNS.php`, the function `getRecordID` is declared with return type `string`, but returns false.

Can we change this to either empty string, or throw and exception instead of having conflicting return types?

```php
public function getRecordID(string $zoneID, string $type = '', string $name = ''): string
{
$records = $this->listRecords($zoneID, $type, $name);
if (isset($records->result[0]->id)) {
return $records->result[0]->id;
}
return false;
}
```

could change final lines to:
```php
return $records->result[0]->id ?? : '';
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.