From 99ed78976d2e952505773ccbc244f61e7d43eeb0 Mon Sep 17 00:00:00 2001 From: Dominic Tubach Date: Fri, 9 Feb 2024 17:01:47 +0100 Subject: [PATCH] fixup! Set minimum CiviCRM version to 5.45, Use PHP 8.3 for tests --- .github/workflows/phpcs.yml | 2 +- .github/workflows/phpstan.yml | 2 +- .github/workflows/phpunit.yml | 2 +- Civi/Civioffice/Api4/Action/LiveSnippet/GetAction.php | 7 +------ .../Civioffice/Api4/Action/LiveSnippet/GetFieldsAction.php | 7 +------ ci/composer.json | 2 +- info.xml | 2 +- phpstan.ci.neon | 2 -- 8 files changed, 7 insertions(+), 19 deletions(-) diff --git a/.github/workflows/phpcs.yml b/.github/workflows/phpcs.yml index 395cf22..a8c4a2d 100644 --- a/.github/workflows/phpcs.yml +++ b/.github/workflows/phpcs.yml @@ -18,7 +18,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: 8.1 + php-version: 8.3 coverage: none tools: cs2pr env: diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index 33c30f5..5173b27 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php-versions: ['7.4', '8.0', '8.1'] + php-versions: ['7.4', '8.0', '8.3'] prefer: ['prefer-stable', 'prefer-lowest'] name: PHPStan with PHP ${{ matrix.php-versions }} ${{ matrix.prefer }} diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 7948148..22e9578 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - civicrm-image-tags: [ '5-drupal', '5-drupal-php7.4', '5.44-drupal-php7.4' ] + civicrm-image-tags: [ '5-drupal', '5-drupal-php7.4', '5.45-drupal-php7.4' ] name: PHPUnit with Docker image michaelmcandrew/civicrm:${{ matrix.civicrm-image-tags }} env: CIVICRM_IMAGE_TAG: ${{ matrix.civicrm-image-tags }} diff --git a/Civi/Civioffice/Api4/Action/LiveSnippet/GetAction.php b/Civi/Civioffice/Api4/Action/LiveSnippet/GetAction.php index 8f37b59..46b95d0 100644 --- a/Civi/Civioffice/Api4/Action/LiveSnippet/GetAction.php +++ b/Civi/Civioffice/Api4/Action/LiveSnippet/GetAction.php @@ -40,14 +40,9 @@ public function _run(Result $result): void { ->setLimit($this->getLimit()) ->setWhere($this->getWhere()) ->setOrderBy($this->getOrderBy()) + ->setLanguage($this->language) ->addWhere('option_group_id:name', '=', 'civioffice_live_snippets'); - // Property "language" is not available in CiviCRM <5.45 - // @phpstan-ignore-next-line - if (property_exists($this, 'language')) { - $action->setLanguage($this->language); - } - $result->exchangeArray($action->execute()->getArrayCopy()); $lastValueSelected = $this->isLastValueSelected(); diff --git a/Civi/Civioffice/Api4/Action/LiveSnippet/GetFieldsAction.php b/Civi/Civioffice/Api4/Action/LiveSnippet/GetFieldsAction.php index ad455b7..5c7b159 100644 --- a/Civi/Civioffice/Api4/Action/LiveSnippet/GetFieldsAction.php +++ b/Civi/Civioffice/Api4/Action/LiveSnippet/GetFieldsAction.php @@ -37,15 +37,10 @@ protected function getRecords(): array { ->setAction($this->getAction()) ->setLoadOptions($this->getLoadOptions()) ->setOrderBy($this->getOrderBy()) + ->setLanguage($this->language) ->addWhere('name', 'IN', ['label', 'name', 'description']) ->addValue('option_group_id:name', 'civioffice_live_snippets'); - // Property "language" is not available in CiviCRM <5.45 - // @phpstan-ignore-next-line - if (property_exists($this, 'language')) { - $action->setLanguage($this->language); - } - $fields = $action->execute()->getArrayCopy(); $fields[] = [ diff --git a/ci/composer.json b/ci/composer.json index 0d355a6..e281518 100644 --- a/ci/composer.json +++ b/ci/composer.json @@ -9,6 +9,6 @@ } }, "require": { - "civicrm/civicrm-core": "^5.44" + "civicrm/civicrm-core": "^5.45" } } diff --git a/info.xml b/info.xml index d764b02..aeedd4f 100644 --- a/info.xml +++ b/info.xml @@ -18,7 +18,7 @@ 1.0-dev dev - 5.44 + 5.45 diff --git a/phpstan.ci.neon b/phpstan.ci.neon index 3f912b9..4bb1dcc 100644 --- a/phpstan.ci.neon +++ b/phpstan.ci.neon @@ -16,5 +16,3 @@ parameters: - message: '#Dead catch - CRM_Core_Exception is never thrown in the try block.#' path: */Civi/Civioffice/EventSubscriber/ParticipantCiviOfficeTokenSubscriber.php - # CiviCRM <5.45 - - '#^Call to an undefined method Civi\\Api4\\Generic\\DAOGetFieldsAction::setLanguage\(\).$#'