Skip to content

Commit cfe701d

Browse files
authored
Specify return type on methods and correct "integer" to "int"
1 parent ca80de1 commit cfe701d

1 file changed

Lines changed: 23 additions & 23 deletions

File tree

src/Supporting/FileMakerRelation.php

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -98,19 +98,19 @@ public function getDataInfo()
9898
/**
9999
* Get the table occurrence name of query to get this relation.
100100
*
101-
* @return string The table occurrence name.
101+
* @return string The table occurrence name.
102102
*/
103-
public function getTargetTable()
103+
public function getTargetTable(): string
104104
{
105105
return ($this->dataInfo) ? $this->dataInfo->table : null;
106106
}
107107

108108
/**
109109
* Get the total record count of query to get this relation. Portal relation doesn't have this information and returns NULL.
110110
*
111-
* @return integer The total record count.
111+
* @return int The total record count.
112112
*/
113-
public function getTotalCount()
113+
public function getTotalCount(): int
114114
{
115115
return ($this->dataInfo && property_exists($this->dataInfo, 'totalRecordCount')) ?
116116
$this->dataInfo->totalRecordCount : null;
@@ -120,9 +120,9 @@ public function getTotalCount()
120120
* Get the founded record count of query to get this relation. If the relation comes from getRecord() method,
121121
* this method returns 1.
122122
*
123-
* @return integer The founded record count.
123+
* @return int The founded record count.
124124
*/
125-
public function getFoundCount()
125+
public function getFoundCount(): int
126126
{
127127
return ($this->dataInfo) ? $this->dataInfo->foundCount : null;
128128
}
@@ -131,9 +131,9 @@ public function getFoundCount()
131131
* Get the returned record count of query to get this relation. If the relation comes from getRecord() method,
132132
* this method returns 1.
133133
*
134-
* @return integer The rreturned record count.
134+
* @return int The returned record count.
135135
*/
136-
public function getReturnedCount()
136+
public function getReturnedCount(): int
137137
{
138138
return ($this->dataInfo) ? $this->dataInfo->returnedCount : null;
139139
}
@@ -143,7 +143,7 @@ public function getReturnedCount()
143143
*
144144
* @param string $name The portal name.
145145
*/
146-
public function setPortalName($name): void
146+
public function setPortalName(string $name): void
147147
{
148148
$this->portalName = $name;
149149
}
@@ -209,7 +209,7 @@ public function count(): int
209209
* @return FileMakerRelation|string|null
210210
* @ignore
211211
*/
212-
public function __get($key)
212+
public function __get($key): FileMakerRelation|string|null
213213
{
214214
return $this->field($key);
215215
}
@@ -254,7 +254,7 @@ public function getFieldNames(): array
254254
return $list;
255255
}
256256

257-
private function getNumberedRecord($num)
257+
private function getNumberedRecord($num): ?FileMakerRelation
258258
{
259259
$value = null;
260260
if (isset($this->data) && isset($this->data[$num])) {
@@ -276,7 +276,7 @@ private function getNumberedRecord($num)
276276
*
277277
* @return FileMakerRelation|null The record set of the record.
278278
*/
279-
public function getFirstRecord()
279+
public function getFirstRecord(): ?FileMakerRelation
280280
{
281281
return $this->getNumberedRecord(0);
282282
}
@@ -286,17 +286,17 @@ public function getFirstRecord()
286286
*
287287
* @return FileMakerRelation|null The record set of the record.
288288
*/
289-
public function getLastRecord()
289+
public function getLastRecord(): ?FileMakerRelation
290290
{
291291
return $this->getNumberedRecord(count($this->data) - 1);
292292
}
293293

294294
/**
295295
* Returns the array of the query result. Usually iterating by using foreach is a better way.
296296
*
297-
* @return array|null The FileMakerRelation objects of the records.
297+
* @return array The FileMakerRelation objects of the records.
298298
*/
299-
public function getRecords()
299+
public function getRecords(): array
300300
{
301301
$records = [];
302302
foreach ($this as $record) {
@@ -308,7 +308,7 @@ public function getRecords()
308308
/**
309309
* Export to array
310310
*
311-
* @return void
311+
* @return array
312312
*/
313313
public function toArray(): array
314314
{
@@ -340,7 +340,7 @@ public function toArray(): array
340340
*
341341
* @return array List of portal names
342342
*/
343-
public function getPortalNames()
343+
public function getPortalNames(): array
344344
{
345345
$list = [];
346346
if (isset($this->data)) {
@@ -378,7 +378,7 @@ public function getPortalNames()
378378
* @see FMDataAPI::setFieldHTMLEncoding() Compatible mode for FileMaker API for PHP.
379379
*
380380
*/
381-
public function field($name, $toName = null)
381+
public function field($name, $toName = null): string|FileMakerRelation
382382
{
383383
$toName = is_null($toName) ? "" : "{$toName}::";
384384
$fieldName = "{$toName}$name";
@@ -444,7 +444,7 @@ public function field($name, $toName = null)
444444
*
445445
* @return int The value of special field recordId.
446446
*/
447-
public function getRecordId()
447+
public function getRecordId(): int
448448
{
449449
$value = null;
450450
switch ($this->result) {
@@ -479,7 +479,7 @@ public function getRecordId()
479479
*
480480
* @return int The value of special field modId.
481481
*/
482-
public function getModId()
482+
public function getModId(): int
483483
{
484484
$value = null;
485485
switch ($this->result) {
@@ -518,9 +518,9 @@ public function getModId()
518518
* The table occurrence name of the portal can be the portal name, and also the object name of the portal.
519519
* @param string $toName The table occurrence name of the portal as the prefix of the field name.
520520
*
521-
* @return string The base64 encoded data in container field.
521+
* @return string|null The base64 encoded data in container field.
522522
*/
523-
public function getContainerData($name, $toName = null)
523+
public function getContainerData($name, $toName = null): ?string
524524
{
525525
$fieldValue = $this->field($name, $toName);
526526
if (strpos($fieldValue, "https://") !== 0) {
@@ -609,4 +609,4 @@ public function rewind(): void
609609
{
610610
$this->pointer = 0;
611611
}
612-
}
612+
}

0 commit comments

Comments
 (0)