diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7d2e98d3..ace5d66f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -8,17 +8,17 @@ jobs: fail-fast: true matrix: os: [ ubuntu-latest, windows-latest ] - php: [ "8.0", "7.4", "7.3", "7.2" ] + php: [ "8.3", "8.2", "8.1", "8.0", "7.4", "7.3", "7.2" ] name: PHP ${{ matrix.php }} - ${{ matrix.os }} runs-on: ${{ matrix.os }} steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Cache dependencies - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: ~/.composer/cache/files key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }} diff --git a/README.md b/README.md index 4caddd89..32b7d7e1 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ # Former ## A Laravelish way to create and format forms -[![Build Status](http://img.shields.io/travis/formers/former.svg?style=flat)](https://travis-ci.org/formers/former) [![Latest Stable Version](http://img.shields.io/packagist/v/anahkiasen/former.svg?style=flat)](https://packagist.org/packages/anahkiasen/former) [![Total Downloads](http://img.shields.io/packagist/dt/anahkiasen/former.svg?style=flat)](https://packagist.org/packages/anahkiasen/former) @@ -66,12 +65,8 @@ Add then alias Former's main class by adding its facade to the `aliases` array i 'Former' => 'Former\Facades\Former', -### Table of contents +----- -- [Getting started][] -- [Features][] -- [Usage and Examples][] +### Documentation - [Getting started]: https://github.com/formers/former/wiki/Getting-started - [Features]: https://github.com/formers/former/wiki/Features - [Usage and Examples]: https://github.com/formers/former/wiki/Usage-and-Examples +Please refer to the [wiki](https://github.com/formers/former/wiki) for the full documentation. diff --git a/composer.json b/composer.json index 603ef001..7cbd2908 100644 --- a/composer.json +++ b/composer.json @@ -17,20 +17,20 @@ ], "require": { "php": "^7.2|^8.0", - "anahkiasen/html-object": "~1.4", - "illuminate/config": "^5.1.3|^6.0|^7.0|^8.0", - "illuminate/container": "^5.1.3|^6.0|^7.0|^8.0", - "illuminate/contracts": "^5.1.3|^6.0|^7.0|^8.0", - "illuminate/http": "^5.1.3|^6.0|^7.0|^8.0", - "illuminate/routing": "^5.1.3|^6.0|^7.0|^8.0", - "illuminate/session": "^5.1.3|^6.0|^7.0|^8.0", - "illuminate/translation": "^5.1.3|^6.0|^7.0|^8.0", - "illuminate/support": "^5.1.3|^6.0|^7.0|^8.0" + "illuminate/config": "^5.1.3|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0", + "illuminate/container": "^5.1.3|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0", + "illuminate/contracts": "^5.1.3|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0", + "illuminate/http": "^5.1.3|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0", + "illuminate/routing": "^5.1.3|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0", + "illuminate/session": "^5.1.3|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0", + "illuminate/translation": "^5.1.3|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0", + "illuminate/support": "^5.1.3|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0", + "kylekatarnls/html-object": "^1.5" }, "require-dev": { "phpunit/phpunit": "^8.5", "mockery/mockery": "^1.3", - "illuminate/database": "^5.1.3|^6.0|^7.0|^8.0" + "illuminate/database": "^5.1.3|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0" }, "autoload": { "psr-4": { diff --git a/src/Former/Form/Elements.php b/src/Former/Form/Elements.php index 72ac6c97..99d415e3 100644 --- a/src/Former/Form/Elements.php +++ b/src/Former/Form/Elements.php @@ -62,7 +62,7 @@ public function label($label, $for = null, $attributes = array()) { if (!$label instanceof Htmlable) { $oldLabel = (string) $label; - $label = Helpers::translate($oldLabel); + $label = Helpers::translate($oldLabel, ''); // If there was no change to the label, // then a Laravel translation did not occur @@ -70,7 +70,7 @@ public function label($label, $for = null, $attributes = array()) $label = str_replace('_', ' ', $label); } } else { - $label = (string) $label->toHtml(); + $label = $label->toHtml(); } $attributes['for'] = $for; diff --git a/src/Former/Form/Fields/Choice.php b/src/Former/Form/Fields/Choice.php index 652e217b..c67d4609 100644 --- a/src/Former/Form/Fields/Choice.php +++ b/src/Former/Form/Fields/Choice.php @@ -191,7 +191,7 @@ public function getOption($key, $value) public function getCheckables($choiceType) { - if (!(is_array($this->value) || $this->value instanceof \ArrayAccess)) { + if ($this->value !== null && !(is_array($this->value) || $this->value instanceof \ArrayAccess)) { $this->value = explode(',', $this->value); } @@ -233,7 +233,7 @@ public function getCheckables($choiceType) } // If inline items, add class - $isInline = $this->inline ? ' '.$this->app['former.framework']->getInlineLabelClass($this) : null; + $isInline = $this->inline ? ' '.$this->app['former.framework']->getInlineLabelClass($this) : ''; // In Bootsrap 3, don't append the the checkable type (radio/checkbox) as a class if // rendering inline. diff --git a/src/Former/Form/Group.php b/src/Former/Form/Group.php index 6877547e..c1f2c659 100644 --- a/src/Former/Form/Group.php +++ b/src/Former/Form/Group.php @@ -532,7 +532,7 @@ protected function getHelp() $inline = $this->app['former.framework']->createValidationError($errors); } - return join(null, array($inline, $block)); + return implode('', array($inline, $block)); } /** diff --git a/src/Former/Former.php b/src/Former/Former.php index b6955cd7..17f9363e 100644 --- a/src/Former/Former.php +++ b/src/Former/Former.php @@ -250,7 +250,7 @@ public function getValue($field, $fallback = null) */ public function getPost($name, $fallback = null) { - $name = str_replace(array('[', ']'), array('.', ''), $name); + $name = str_replace(array('[', ']'), array('.', ''), $name ?? ''); $name = trim($name, '.'); $oldValue = $this->app['request']->old($name, $fallback); diff --git a/src/Former/Framework/Nude.php b/src/Former/Framework/Nude.php index 5fab121c..69be716b 100644 --- a/src/Former/Framework/Nude.php +++ b/src/Former/Framework/Nude.php @@ -161,9 +161,9 @@ public function placeAround($item) public function prependAppend($field, $prepend, $append) { $return = '