From 8df59f669551dce2509ab6b06c0361316c6ecd35 Mon Sep 17 00:00:00 2001 From: ARCANEDEV Date: Mon, 30 Nov 2020 19:16:27 +0100 Subject: [PATCH] Adding PHP 8.0 Support --- .github/workflows/run-tests.yml | 5 +++-- .scrutinizer.yml | 2 +- composer.json | 8 ++++---- src/FormBuilder.php | 3 +++ 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 5b8e007..ea976b7 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -9,7 +9,7 @@ jobs: strategy: fail-fast: true matrix: - php: [7.3, 7.4] + php: [7.3, 7.4, 8.0] dependency-version: [prefer-lowest, prefer-stable] name: PHP ${{ matrix.php }} - ${{ matrix.dependency-version }} @@ -30,9 +30,10 @@ jobs: php-version: ${{ matrix.php }} extensions: curl, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, iconv coverage: xdebug + tools: composer:v2 - name: Install dependencies - run: composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest + run: composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction - name: Execute tests run: | diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 5dc7cd4..a34f2cb 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -23,7 +23,7 @@ checks: tools: external_code_coverage: timeout: 600 - runs: 4 + runs: 6 php_code_sniffer: enabled: true config: diff --git a/composer.json b/composer.json index 1a53df9..3a697fe 100644 --- a/composer.json +++ b/composer.json @@ -14,15 +14,15 @@ "type": "library", "license": "MIT", "require": { - "php": "^7.3", + "php": "^7.3|^8.0", "arcanedev/php-html": "^5.0", "arcanedev/support": "^8.0" }, "require-dev": { "ext-dom": "*", - "orchestra/testbench": "^6.0", - "mockery/mockery": "^1.3.1", - "phpunit/phpunit": "^9.3" + "orchestra/testbench": "^6.4", + "mockery/mockery": "^1.4.2", + "phpunit/phpunit": "^9.3.3" }, "autoload": { "psr-4": { diff --git a/src/FormBuilder.php b/src/FormBuilder.php index 8cebad2..e92b7c5 100644 --- a/src/FormBuilder.php +++ b/src/FormBuilder.php @@ -224,6 +224,9 @@ private function getModelValueAttribute(string $name, $model = null) ); } + if (is_null($model) || is_array($model)) + return data_get($model, $key); + return method_exists($model, 'getFormValue') ? $model->getFormValue($key) : data_get($model, $key);