From fad2e4ae2d33eb41ab2005ba172e57be3462b676 Mon Sep 17 00:00:00 2001 From: Atsushi Matsuo Date: Sat, 4 Jul 2026 21:54:49 +0900 Subject: [PATCH 1/2] Update Mago to 1.42.0 in the CI workflow --- .github/workflows/mago.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/mago.yml b/.github/workflows/mago.yml index 73e5fd4..300d62c 100644 --- a/.github/workflows/mago.yml +++ b/.github/workflows/mago.yml @@ -19,7 +19,7 @@ jobs: uses: ./.github/actions/setup-php - name: Install Mago - run: composer config --no-plugins allow-plugins.carthage-software/mago true; composer require --dev carthage-software/mago:1.9.1 + run: composer config --no-plugins allow-plugins.carthage-software/mago true; composer require --dev carthage-software/mago:1.42.0 - name: Run Mago run: ./vendor/bin/mago --config .mago/mago.toml analyze From 397663b9e24d1bd307f0c78bead9a43aa782a763 Mon Sep 17 00:00:00 2001 From: Atsushi Matsuo Date: Sat, 4 Jul 2026 22:01:20 +0900 Subject: [PATCH 2/2] Fix type safety issues reported by Mago static analyzer --- src/Supporting/CommunicationProvider.php | 3 ++- src/Supporting/FileMakerRelation.php | 12 +++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/Supporting/CommunicationProvider.php b/src/Supporting/CommunicationProvider.php index 10c8287..5fa2007 100644 --- a/src/Supporting/CommunicationProvider.php +++ b/src/Supporting/CommunicationProvider.php @@ -1114,8 +1114,9 @@ private function _createCurlHandle(string $url): CurlHandle This fixes SSL validation errors if `php.ini` doesn't have [curl] `curl.cainfo`, set properly of if this PEM file isn't up to date. Better rely on the OS certificate authorities, which is maintained automatically. */ + $curlVersion = curl_version(); if (defined('CURLSSLOPT_NATIVE_CA') - && version_compare(curl_version()['version'], '7.71', '>=')) { + && is_array($curlVersion) && version_compare($curlVersion['version'], '7.71', '>=')) { curl_setopt($ch, CURLOPT_SSL_OPTIONS, CURLSSLOPT_NATIVE_CA); } } else { diff --git a/src/Supporting/FileMakerRelation.php b/src/Supporting/FileMakerRelation.php index feb01d9..ffafc8a 100644 --- a/src/Supporting/FileMakerRelation.php +++ b/src/Supporting/FileMakerRelation.php @@ -61,7 +61,7 @@ class FileMakerRelation implements Iterator /** * FileMakerRelation constructor. * - * @param array $responseData + * @param array|object $responseData * @param object|array|null $infoData * @param string $result * @param int $errorCode @@ -263,7 +263,8 @@ public function getFieldNames(): array private function getNumberedRecord(int $num): ?FileMakerRelation { $value = null; - if (isset($this->data[$num])) { + $data = $this->data; + if (is_array($data) && isset($data[$num])) { $tmpInfo = $this->getDataInfo(); $dataInfo = null; if (is_object($tmpInfo)) { @@ -271,7 +272,7 @@ private function getNumberedRecord(int $num): ?FileMakerRelation $dataInfo->returnedCount = 1; } $value = new FileMakerRelation( - $this->data[$num], $dataInfo, ($this->result == "PORTAL") ? "PORTALRECORD" : "RECORD", + $data[$num], $dataInfo, ($this->result == "PORTAL") ? "PORTALRECORD" : "RECORD", $this->errorCode, $this->portalName, $this->restAPI); } return $value; @@ -542,7 +543,8 @@ public function current(): ?FileMakerRelation switch ($this->result) { case "OK": case "PORTAL": - if (isset($this->data[$this->pointer])) { + $data = $this->data; + if (is_array($data) && isset($data[$this->pointer])) { $tmpInfo = $this->getDataInfo(); $dataInfo = null; if (is_object($tmpInfo)) { @@ -551,7 +553,7 @@ public function current(): ?FileMakerRelation } $result = ($this->result == "PORTAL") ? "PORTALRECORD" : "RECORD"; $portalName = $this->portalName; - $value = new FileMakerRelation($this->data[$this->pointer], $dataInfo, $result, + $value = new FileMakerRelation($data[$this->pointer], $dataInfo, $result, $this->errorCode, $portalName, $this->restAPI); } break;