Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add BackedEnum support for ChoiceControl, MultiChoiceControl, HiddenF… #293

Closed
wants to merge 32 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
48e11e0
opened 4.0-dev
dg Mar 1, 2021
94ec819
removed community health files
dg Mar 11, 2021
a009fc6
requires PHP 8.0
dg Mar 1, 2021
f16732c
composer: updated dependencies
dg Oct 9, 2021
a0be737
uses newer nette utils
dg Oct 9, 2021
8487932
coding style
dg Mar 29, 2022
e4a40e0
removed support for PHP 7
dg Oct 6, 2021
338d978
added property typehints
dg Mar 1, 2021
486f48f
added PHP 8 typehints
dg Oct 12, 2022
61d4030
used 'string|Stringable' for labels and messages
dg Dec 12, 2021
2fbaadf
type fix
dg Mar 4, 2021
5a04a49
used native PHP 8 features
dg Jul 28, 2021
2ce6910
constants are PascalCase
dg Dec 4, 2022
8df0740
uses PascalCase constants
dg Nov 27, 2022
0ad73da
Container: getValues(true) is deprecated (BC break)
dg Sep 12, 2021
72fb8fd
Container: only Control/Container can be added to form (BC break)
dg Sep 12, 2021
366dfcf
some classes marked as final (BC break)
dg Nov 9, 2021
a984330
phpdoc generics for Control
dg Nov 9, 2021
0b46630
added type inference tests
dg Nov 9, 2021
9f3f39e
Validator: added support for enums (#282)
drobek94 Jan 18, 2022
f5004ca
BaseControl, ControlGroup::getOption() parameter $default is deprecated
dg Jun 21, 2022
bbfcd97
netteForms: showModal uses <dialog> by default
dg Oct 3, 2022
55f2e6e
added HTML attribute data-nette-error
dg Nov 27, 2022
66569a0
CsrfProtection: used new sessionSection API
dg Dec 4, 2022
6321ff9
removed compatibility for old class names
dg Dec 19, 2022
52fe3d6
Latte: {inputError} must have argument
dg Dec 27, 2022
54ed8f6
Latte: Runtime for v2 renamed to Runtime2
dg Dec 27, 2022
077f5b2
Latte: rewritten Runtime as non-static class
dg Dec 27, 2022
048c9aa
Add BackedEnum support for ChoiceControl, MultiChoiceControl, HiddenF…
Jan 2, 2023
89eb82b
Fixes
Jan 2, 2023
bd9f22d
Fix CI
Jan 4, 2023
06112de
Fix CI
Jan 4, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions .github/ISSUE_TEMPLATE/Bug_report.md

This file was deleted.

9 changes: 0 additions & 9 deletions .github/ISSUE_TEMPLATE/Feature_request.md

This file was deleted.

12 changes: 0 additions & 12 deletions .github/ISSUE_TEMPLATE/Support_question.md

This file was deleted.

21 changes: 0 additions & 21 deletions .github/ISSUE_TEMPLATE/Support_us.md

This file was deleted.

2 changes: 0 additions & 2 deletions .github/funding.yml

This file was deleted.

11 changes: 0 additions & 11 deletions .github/pull_request_template.md

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- uses: actions/checkout@v3
- uses: shivammathur/setup-php@v2
with:
php-version: 7.4
php-version: 8.0
coverage: none

- run: composer install --no-progress --prefer-dist
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
php: ['8.0', '8.1', '8.2']

fail-fast: false

Expand Down Expand Up @@ -35,7 +35,7 @@ jobs:
- uses: actions/checkout@v3
- uses: shivammathur/setup-php@v2
with:
php-version: 7.2
php-version: 8.0
coverage: none

- run: composer update --no-progress --prefer-dist --prefer-lowest --prefer-stable
Expand Down
14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
}
],
"require": {
"php": ">=7.2 <8.3",
"nette/component-model": "^3.0",
"nette/http": "^3.1",
"nette/utils": "^3.2.1"
"php": ">=8.0 <8.3",
"nette/component-model": "^4.0",
"nette/http": "^4.0",
"nette/utils": "^4.0"
},
"require-dev": {
"nette/application": "^3.0",
"nette/di": "^3.0",
"nette/application": "^4.0",
"nette/di": "^4.0",
"nette/tester": "^2.4",
"latte/latte": "^2.10.2 || ^3.0.3",
"tracy/tracy": "^2.9",
Expand All @@ -41,7 +41,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "3.1-dev"
"dev-master": "4.0-dev"
}
}
}
33 changes: 0 additions & 33 deletions contributing.md

This file was deleted.

16 changes: 8 additions & 8 deletions examples/basic-example.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@

$form->addText('age', 'Your age:')
->setRequired('Enter your age')
->addRule($form::INTEGER, 'Age must be numeric value')
->addRule($form::RANGE, 'Age must be in range from %d to %d', [10, 100]);
->addRule($form::Integer, 'Age must be numeric value')
->addRule($form::Range, 'Age must be in range from %d to %d', [10, 100]);

$form->addRadioList('gender', 'Your gender:', [
'm' => 'male',
Expand All @@ -53,7 +53,7 @@
->setOption('embedNext', true);

$form->addCheckbox('send', 'Ship to address')
->addCondition($form::FILLED) // conditional rule: if is checkbox checked...
->addCondition($form::Filled) // conditional rule: if is checkbox checked...
->toggle('sendBox'); // toggle div #sendBox


Expand All @@ -64,7 +64,7 @@
$form->addText('street', 'Street:');

$form->addText('city', 'City:')
->addConditionOn($form['send'], $form::FILLED)
->addConditionOn($form['send'], $form::Filled)
->setRequired('Enter your shipping address');

$countries = [
Expand All @@ -77,7 +77,7 @@
];
$form->addSelect('country', 'Country:', $countries)
->setPrompt('Select your country')
->addConditionOn($form['send'], $form::FILLED)
->addConditionOn($form['send'], $form::Filled)
->setRequired('Select your country');


Expand All @@ -86,14 +86,14 @@

$form->addPassword('password', 'Choose password:')
->setRequired('Choose your password')
->addRule($form::MIN_LENGTH, 'The password is too short: it must be at least %d characters', 3);
->addRule($form::MinLength, 'The password is too short: it must be at least %d characters', 3);

$form->addPassword('password2', 'Reenter password:')
->setRequired('Reenter your password')
->addRule($form::EQUAL, 'Passwords do not match', $form['password']);
->addRule($form::Equal, 'Passwords do not match', $form['password']);

$form->addUpload('avatar', 'Picture:')
->addRule($form::IMAGE, 'Uploaded file is not image');
->addRule($form::Image, 'Uploaded file is not image');

$form->addHidden('userid');

Expand Down
15 changes: 7 additions & 8 deletions examples/custom-control.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@

class DateInput extends Nette\Forms\Controls\BaseControl
{
/** @var string */
private $day = '';
private string $day = '';

private $month = '';
private string $month = '';

private $year = '';
private string $year = '';


public function __construct($label = null)
Expand Down Expand Up @@ -63,9 +62,9 @@ public function isFilled(): bool

public function loadHttpData(): void
{
$this->day = $this->getHttpData(Form::DATA_LINE, '[day]');
$this->month = $this->getHttpData(Form::DATA_LINE, '[month]');
$this->year = $this->getHttpData(Form::DATA_LINE, '[year]');
$this->day = $this->getHttpData(Form::DataLine, '[day]');
$this->month = $this->getHttpData(Form::DataLine, '[month]');
$this->year = $this->getHttpData(Form::DataLine, '[year]');
}


Expand All @@ -88,7 +87,7 @@ public function getControl()
. Helpers::createSelectBox(
[1 => 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
[],
$this->month
$this->month,
)->name($name . '[month]')

. Html::el('input', [
Expand Down
8 changes: 4 additions & 4 deletions examples/html5.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@
$form->addText('count', 'Number of results:')
->setHtmlType('number')
->setDefaultValue(10)
->addRule($form::INTEGER, 'Must be numeric value')
->addRule($form::RANGE, 'Must be in range from %d to %d', [1, 100]);
->addRule($form::Integer, 'Must be numeric value')
->addRule($form::Range, 'Must be in range from %d to %d', [1, 100]);

$form->addText('precision', 'Precision:')
->setHtmlType('range')
->setDefaultValue(50)
->addRule($form::INTEGER, 'Precision must be numeric value')
->addRule($form::RANGE, 'Precision must be in range from %d to %d', [0, 100]);
->addRule($form::Integer, 'Precision must be numeric value')
->addRule($form::Range, 'Precision must be in range from %d to %d', [0, 100]);

$form->addEmail('email', 'Send to email:')
->setHtmlAttribute('autocomplete', 'off')
Expand Down
4 changes: 2 additions & 2 deletions examples/latte.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@

$form->addPassword('password', 'Choose password:')
->setRequired('Choose your password')
->addRule($form::MIN_LENGTH, 'The password is too short: it must be at least %d characters', 3);
->addRule($form::MinLength, 'The password is too short: it must be at least %d characters', 3);

$form->addPassword('password2', 'Reenter password:')
->setRequired('Reenter your password')
->addRule($form::EQUAL, 'Passwords do not match', $form['password']);
->addRule($form::Equal, 'Passwords do not match', $form['password']);

$form->addSubmit('submit', 'Send');

Expand Down
8 changes: 4 additions & 4 deletions examples/live-validation.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@

$form->addText('age', 'Your age:')
->setRequired('Enter your age')
->addRule($form::INTEGER, 'Age must be numeric value')
->addRule($form::RANGE, 'Age must be in range from %d to %d', [10, 100]);
->addRule($form::Integer, 'Age must be numeric value')
->addRule($form::Range, 'Age must be in range from %d to %d', [10, 100]);

$form->addPassword('password', 'Choose password:')
->setRequired('Choose your password')
->addRule($form::MIN_LENGTH, 'The password is too short: it must be at least %d characters', 3);
->addRule($form::MinLength, 'The password is too short: it must be at least %d characters', 3);

$form->addPassword('password2', 'Reenter password:')
->setRequired('Reenter your password')
->addRule($form::EQUAL, 'Passwords do not match', $form['password']);
->addRule($form::Equal, 'Passwords do not match', $form['password']);

$form->addSubmit('submit', 'Send');

Expand Down
4 changes: 2 additions & 2 deletions examples/localization.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ public function translate($message, ...$parameters): string

$form->addText('age', 'Your age:')
->setRequired('Enter your age')
->addRule($form::INTEGER, 'Age must be numeric value')
->addRule($form::RANGE, 'Age must be in range from %d to %d', [10, 100]);
->addRule($form::Integer, 'Age must be numeric value')
->addRule($form::Range, 'Age must be in range from %d to %d', [10, 100]);

$countries = [
'World' => [
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ The recommended way to install is via Composer:
composer require nette/forms
```

It requires PHP version 7.2 and supports PHP up to 8.2.
It requires PHP version 8.0 and supports PHP up to 8.2.


Client-side support can be installed with npm or yarn:
Expand Down
2 changes: 1 addition & 1 deletion src/Bridges/FormsDI/FormsExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function __construct()
{
$this->config = new class {
/** @var string[] */
public $messages = [];
public array $messages = [];
};
}

Expand Down
Loading