Skip to content
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

PHP 8.4 compatibility #41

Merged
merged 1 commit into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/LTDBeget/dns/configurator/Zone.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public function iterateNodes() : \Generator
* @param eRecordType|null $type
* @return \Generator|Record[]
*/
public function iterateRecords(eRecordType $type = NULL) : \Generator
public function iterateRecords(?eRecordType $type = NULL) : \Generator
{
foreach ($this->iterateNodes() as $node) {
foreach ($node->iterateRecords($type) as $record) {
Expand Down Expand Up @@ -183,7 +183,7 @@ public function isNodeExist($name) : bool
/**
* @param eRecordType|NULL $type
*/
public function removeRecords(eRecordType $type = NULL)
public function removeRecords(?eRecordType $type = NULL)
{
foreach ($this->iterateNodes() as $node) {
foreach ($node->iterateRecords($type) as $record) {
Expand Down
6 changes: 3 additions & 3 deletions src/LTDBeget/dns/configurator/zoneEntities/Node.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ protected function getRemovedRecordsStore()
/**
* @param eRecordType|NULL $type
*/
public function removeRecords(eRecordType $type = NULL)
public function removeRecords(?eRecordType $type = NULL)
{
foreach ($this->iterateRecords($type) as $record) {
$record->remove();
Expand All @@ -103,7 +103,7 @@ public function removeRecords(eRecordType $type = NULL)
* @param eRecordType|null $type
* @return \Generator|Record[]
*/
public function iterateRecords(eRecordType $type = NULL) : \Generator
public function iterateRecords(?eRecordType $type = NULL) : \Generator
{
foreach ($this->getRecordsStore()->iterate($type) as $record) {
yield $record;
Expand Down Expand Up @@ -204,4 +204,4 @@ public function getName() : string
{
return $this->name;
}
}
}
22 changes: 11 additions & 11 deletions src/LTDBeget/dns/configurator/zoneEntities/RecordAppender.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function __construct(Node $node)
* @param int|null $ttl
* @return ARecord
*/
public function appendARecord(string $address, int $ttl = NULL) : ARecord
public function appendARecord(string $address, ?int $ttl = NULL) : ARecord
{
return new ARecord($this->node, $ttl ?? $this->defaultTtl, $address);
}
Expand All @@ -62,7 +62,7 @@ public function appendARecord(string $address, int $ttl = NULL) : ARecord
* @param int|null $ttl
* @return AaaaRecord
*/
public function appendAaaaRecord(string $address, int $ttl = NULL) : AaaaRecord
public function appendAaaaRecord(string $address, ?int $ttl = NULL) : AaaaRecord
{
return new AaaaRecord($this->node, $ttl ?? $this->defaultTtl, $address);
}
Expand All @@ -72,7 +72,7 @@ public function appendAaaaRecord(string $address, int $ttl = NULL) : AaaaRecord
* @param int|null $ttl
* @return CnameRecord
*/
public function appendCNameRecord(string $cname, int $ttl = NULL) : CnameRecord
public function appendCNameRecord(string $cname, ?int $ttl = NULL) : CnameRecord
{
return new CnameRecord($this->node, $ttl ?? $this->defaultTtl, $cname);
}
Expand All @@ -83,7 +83,7 @@ public function appendCNameRecord(string $cname, int $ttl = NULL) : CnameRecord
* @param int|null $ttl
* @return MxRecord
*/
public function appendMxRecord(int $preference, string $exchange, int $ttl = NULL) : MxRecord
public function appendMxRecord(int $preference, string $exchange, ?int $ttl = NULL) : MxRecord
{
return new MxRecord($this->node, $ttl ?? $this->defaultTtl, $preference, $exchange);
}
Expand All @@ -93,7 +93,7 @@ public function appendMxRecord(int $preference, string $exchange, int $ttl = NUL
* @param int|null $ttl
* @return NsRecord
*/
public function appendNsRecord(string $nsdName, int $ttl = NULL) : NsRecord
public function appendNsRecord(string $nsdName, ?int $ttl = NULL) : NsRecord
{
return new NsRecord($this->node, $ttl ?? $this->defaultTtl, $nsdName);
}
Expand All @@ -103,7 +103,7 @@ public function appendNsRecord(string $nsdName, int $ttl = NULL) : NsRecord
* @param int|null $ttl
* @return PtrRecord
*/
public function appendPtrRecord(string $ptrDName, int $ttl = NULL) : PtrRecord
public function appendPtrRecord(string $ptrDName, ?int $ttl = NULL) : PtrRecord
{
return new PtrRecord($this->node, $ttl ?? $this->defaultTtl, $ptrDName);
}
Expand All @@ -128,7 +128,7 @@ public function appendSoaRecord
int $retry,
int $expire,
int $minimum,
int $ttl = NULL
?int $ttl = NULL
) : SoaRecord
{
return new SoaRecord(
Expand Down Expand Up @@ -158,7 +158,7 @@ public function appendSrvRecord
int $weight,
int $port,
string $target,
int $ttl = NULL
?int $ttl = NULL
) : SrvRecord
{
return new SrvRecord($this->node, $ttl ?? $this->defaultTtl, $priority, $weight, $port, $target);
Expand All @@ -169,7 +169,7 @@ public function appendSrvRecord
* @param int|null $ttl
* @return TxtRecord
*/
public function appendTxtRecord(string $txtData, int $ttl = NULL) : TxtRecord
public function appendTxtRecord(string $txtData, ?int $ttl = NULL) : TxtRecord
{
return new TxtRecord($this->node, $ttl ?? $this->defaultTtl, $txtData);
}
Expand All @@ -182,7 +182,7 @@ public function appendTxtRecord(string $txtData, int $ttl = NULL) : TxtRecord
*
* @return CaaRecord
*/
public function appendCaaRecord(int $flags, string $tag, string $value, int $ttl = NULL) : CaaRecord
public function appendCaaRecord(int $flags, string $tag, string $value, ?int $ttl = NULL) : CaaRecord
{
return new CaaRecord($this->node, $ttl ?? $this->defaultTtl, $flags, $tag, $value);
}
Expand All @@ -199,7 +199,7 @@ public function appendCaaRecord(int $flags, string $tag, string $value, int $ttl
* @return NaptrRecord
*/
public function appendNaptrRecord(int $order, int $preference, string $flags, string $services,
string $regexp, string $replacement, int $ttl = NULL) : NaptrRecord
string $regexp, string $replacement, ?int $ttl = NULL) : NaptrRecord
{
return new NaptrRecord($this->node, $ttl ?? $this->defaultTtl,
$order, $preference, $flags, $services, $regexp, $replacement);
Expand Down
4 changes: 2 additions & 2 deletions src/LTDBeget/dns/configurator/zoneEntities/RecordsStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function count() : int
* @param eRecordType $type
* @return \Generator|record\base\Record[]
*/
public function iterate(eRecordType $type = NULL) : \Generator
public function iterate(?eRecordType $type = NULL) : \Generator
{
foreach ($this->records as $record) {
if (NULL === $type) {
Expand All @@ -84,4 +84,4 @@ public function sort()
return strcmp($a->getType(), $b->getType());
});
}
}
}