Skip to content

Commit 6a768e7

Browse files
authored
Merge pull request msyk#104 from matsuo/reduce-errors-detected-by-phpstan
Reduce errors detected by PHPStan
2 parents 0c65292 + 3564adf commit 6a768e7

4 files changed

Lines changed: 13 additions & 11 deletions

File tree

src/FMDataAPI.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*
1313
* @package INTER-Mediator\FileMakerServer\RESTAPI
1414
* @link https://github.com/msyk/FMDataAPI GitHub Repository
15-
* @property-read FileMakerLayout <<layout_name>> Returns the FileMakerLayout object from the layout named with the property.
15+
* @property-read FileMakerLayout $layout Returns the FileMakerLayout object from the layout named with the property.
1616
* If the layout doesn't exist, no error arises here. Any errors might arise on methods of FileMakerLayout class.
1717
* @version 31
1818
* @author Masayuki Nii <nii@msyk.net>

src/Supporting/FileMakerLayout.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ public function delete(int|null $recordId,
359359
* Keys are field names and values is these initial values.
360360
* @param int $modId The modId to allow updating. This parameter is for detect to modifying other users.
361361
* If you omit this parameter, update operation does not care the value of modId special field.
362-
* @param array|null $portal Associated array contains the modifying values in the portal.
362+
* @param array|object|null $portal Associated array contains the modifying values in the portal.
363363
* Ex.: {"<PortalName>"=>{"<FieldName>"=>"<Value>", "recordId"=>"12"}}. FieldName has to "<TOCName>::<FieldName>".
364364
* The recordId key specifiy the record to edit in portal.
365365
* @param array|null $script scripts that should execute the right timings. See FileMakerRelation::query().
@@ -368,7 +368,7 @@ public function delete(int|null $recordId,
368368
public function update(int|null $recordId,
369369
array|null $data,
370370
int $modId = -1,
371-
array|null $portal = null,
371+
array|object|null $portal = null,
372372
array|null $script = null): void
373373
{
374374
if (is_null($recordId)) {

src/Supporting/FileMakerRelation.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,12 @@ class FileMakerRelation implements Iterator
6969
*
7070
* @ignore
7171
*/
72-
public function __construct(array|object $responseData,
73-
object|array $infoData,
74-
string $result = "PORTAL",
75-
int $errorCode = 0,
76-
string|null $portalName = null,
77-
CommunicationProvider $provider = null)
72+
public function __construct(array|object $responseData,
73+
object|array $infoData,
74+
string $result = "PORTAL",
75+
int $errorCode = 0,
76+
string|null $portalName = null,
77+
?CommunicationProvider $provider = null)
7878
{
7979
$this->data = $responseData;
8080
$this->dataInfo = $infoData;
@@ -385,7 +385,7 @@ public function getPortalNames(): array
385385
* @see FMDataAPI::setFieldHTMLEncoding() Compatible mode for FileMaker API for PHP.
386386
*
387387
*/
388-
public function field(string $name, string $toName = null): string|FileMakerRelation
388+
public function field(string $name, string|null $toName = null): string|FileMakerRelation
389389
{
390390
$toName = is_null($toName) ? "" : "{$toName}::";
391391
$fieldName = "{$toName}$name";

test/TestProvider.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
namespace INTERMediator\FileMakerServer\RESTAPI\Supporting;
1010

11+
use Exception;
12+
1113
class TestProvider extends CommunicationProvider
1214
{
1315

@@ -51,7 +53,7 @@ public function callRestAPI(array $params,
5153
bool $isAddToken,
5254
string $method = 'GET',
5355
array|null|string $request = null,
54-
array $addHeader = null,
56+
array|null $addHeader = null,
5557
bool $isSystem = false,
5658
string|null|false $directPath = null): void
5759
{

0 commit comments

Comments
 (0)