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

Fix typo in "deprecated" #304

Closed
wants to merge 29 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
a0e2607
opened 4.0-dev
dg Mar 1, 2021
99860ee
removed community health files
dg Mar 11, 2021
302de76
requires PHP 8.0
dg Mar 1, 2021
3c6bb84
composer: updated dependencies
dg Oct 9, 2021
33996de
uses newer nette utils
dg Jan 19, 2023
2df3676
coding style
dg Mar 8, 2023
a8361fe
removed support for PHP 7
dg Oct 6, 2021
94f696d
added property typehints
dg Mar 1, 2021
ad00019
added PHP 8 typehints
dg Oct 12, 2022
0464b1f
used 'string|Stringable' for labels and messages
dg Mar 8, 2023
be9765e
used native PHP 8 features
dg Mar 8, 2023
1cd17b4
added deprecated notices
dg Jan 9, 2023
eb2a0b1
uses PascalCase constants
dg Nov 27, 2022
2f1350f
used Tester 2.5 [WIP - new nette/http]
dg Feb 5, 2023
1e0193f
Container: getValues(true) is deprecated (BC break)
dg Sep 12, 2021
3a2d4fc
Container: only Control/Container can be added to form (BC break)
dg Sep 12, 2021
b0b2a2c
some classes marked as final (BC break)
dg Nov 9, 2021
46b964c
phpdoc generics for Control
dg Nov 9, 2021
3a47230
added type inference tests
dg Nov 9, 2021
258edd1
Validator: added support for enums (#282)
drobek94 Jan 18, 2022
eecaf63
BaseControl, ControlGroup::getOption() parameter $default is deprecated
dg Jun 21, 2022
9ecec4c
netteForms: showModal uses <dialog> by default
dg Oct 3, 2022
03e58a1
added HTML attribute data-nette-error
dg Nov 27, 2022
7188743
CsrfProtection: used new sessionSection API
dg Dec 4, 2022
9303905
removed compatibility for old class names
dg Dec 19, 2022
03ae81c
Latte: {inputError} must have argument
dg Dec 27, 2022
96e3a8e
Latte: Runtime for v2 renamed to Runtime2
dg Dec 27, 2022
8e9b776
Latte: rewritten Runtime as non-static class
dg Dec 27, 2022
2810cb0
Typo (#310)
radimvaculik Aug 22, 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', '8.3']
php: ['8.0', '8.1', '8.2', '8.3']

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
16 changes: 8 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
}
],
"require": {
"php": "7.2 - 8.3",
"nette/component-model": "^3.0",
"nette/http": "^3.1",
"nette/utils": "^3.2.5 || ~4.0.0"
"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/tester": "^2.4",
"nette/application": "^4.0",
"nette/di": "^3.1 || ^4.0",
"nette/tester": "^2.5",
"latte/latte": "^2.10.2 || ^3.0.3",
"tracy/tracy": "^2.9",
"phpstan/phpstan-nette": "^1"
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.

9 changes: 4 additions & 5 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 @@ -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
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.3.
It requires PHP version 8.0 and supports PHP up to 8.3.


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 @@
{
$this->config = new class {
/** @var string[] */
public $messages = [];
public array $messages = [];
};
}

Expand All @@ -30,7 +30,7 @@
{
$initialize = $this->initialization ?? $class->getMethod('initialize');

foreach ($this->config->messages as $name => $text) {

Check failure on line 33 in src/Bridges/FormsDI/FormsExtension.php

View workflow job for this annotation

GitHub Actions / PHPStan

Cannot access property $messages on array|object.
if (defined('Nette\Forms\Form::' . $name)) {
$initialize->addBody('Nette\Forms\Validator::$messages[Nette\Forms\Form::?] = ?;', [$name, $text]);
} elseif (defined($name)) {
Expand Down
34 changes: 16 additions & 18 deletions src/Bridges/FormsLatte/FormMacros.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@
* - {formContainer name} ... {/formContainer}
* - {formContext name} ... {/formContext}
*/
final class FormMacros extends MacroSet

Check failure on line 29 in src/Bridges/FormsLatte/FormMacros.php

View workflow job for this annotation

GitHub Actions / PHPStan

Class Nette\Bridges\FormsLatte\FormMacros extends unknown class Latte\Macros\MacroSet.
{
public static function install(Latte\Compiler $compiler): void

Check failure on line 31 in src/Bridges/FormsLatte/FormMacros.php

View workflow job for this annotation

GitHub Actions / PHPStan

Parameter $compiler of method Nette\Bridges\FormsLatte\FormMacros::install() has invalid type Latte\Compiler.
{
$me = new static($compiler);

Check failure on line 33 in src/Bridges/FormsLatte/FormMacros.php

View workflow job for this annotation

GitHub Actions / PHPStan

Class Nette\Bridges\FormsLatte\FormMacros does not have a constructor and must be instantiated without any parameters.
$me->addMacro('form', [$me, 'macroForm'], 'echo Nette\Bridges\FormsLatte\Runtime::renderFormEnd(array_pop($this->global->formsStack));');
$me->addMacro('form', [$me, 'macroForm'], 'echo Nette\Bridges\FormsLatte\Runtime2::renderFormEnd(array_pop($this->global->formsStack));');

Check failure on line 34 in src/Bridges/FormsLatte/FormMacros.php

View workflow job for this annotation

GitHub Actions / PHPStan

Call to an undefined method Nette\Bridges\FormsLatte\FormMacros::addMacro().
$me->addMacro('formContext', [$me, 'macroFormContext'], 'array_pop($this->global->formsStack);');

Check failure on line 35 in src/Bridges/FormsLatte/FormMacros.php

View workflow job for this annotation

GitHub Actions / PHPStan

Call to an undefined method Nette\Bridges\FormsLatte\FormMacros::addMacro().
$me->addMacro('formContainer', [$me, 'macroFormContainer'], 'array_pop($this->global->formsStack); $formContainer = end($this->global->formsStack)');

Check failure on line 36 in src/Bridges/FormsLatte/FormMacros.php

View workflow job for this annotation

GitHub Actions / PHPStan

Call to an undefined method Nette\Bridges\FormsLatte\FormMacros::addMacro().
$me->addMacro('label', [$me, 'macroLabel'], [$me, 'macroLabelEnd'], null, self::AUTO_EMPTY);

Check failure on line 37 in src/Bridges/FormsLatte/FormMacros.php

View workflow job for this annotation

GitHub Actions / PHPStan

Access to undefined constant Nette\Bridges\FormsLatte\FormMacros::AUTO_EMPTY.

Check failure on line 37 in src/Bridges/FormsLatte/FormMacros.php

View workflow job for this annotation

GitHub Actions / PHPStan

Call to an undefined method Nette\Bridges\FormsLatte\FormMacros::addMacro().
$me->addMacro('input', [$me, 'macroInput']);

Check failure on line 38 in src/Bridges/FormsLatte/FormMacros.php

View workflow job for this annotation

GitHub Actions / PHPStan

Call to an undefined method Nette\Bridges\FormsLatte\FormMacros::addMacro().
$me->addMacro('name', [$me, 'macroName'], [$me, 'macroNameEnd'], [$me, 'macroNameAttr']);
$me->addMacro('inputError', [$me, 'macroInputError']);
$me->addMacro('formPrint', [$me, 'macroFormPrint']);
Expand Down Expand Up @@ -67,12 +67,12 @@
$node->replaced = true;
$node->tokenizer->reset();
return $writer->write(
'echo Nette\Bridges\FormsLatte\Runtime::renderFormBegin($form = $this->global->formsStack[] = '
'echo Nette\Bridges\FormsLatte\Runtime2::renderFormBegin($form = $this->global->formsStack[] = '
. ($name[0] === '$'
? 'is_object($ʟ_tmp = %node.word) ? $ʟ_tmp : $this->global->uiControl[$ʟ_tmp]'
: '$this->global->uiControl[%node.word]')
. ', %node.array)'
. " /* line $node->startLine */;"
. " /* line $node->startLine */;",
);
}

Expand Down Expand Up @@ -101,7 +101,7 @@
. ($name[0] === '$'
? 'is_object($ʟ_tmp = %node.word) ? $ʟ_tmp : $this->global->uiControl[$ʟ_tmp]'
: '$this->global->uiControl[%node.word]')
. " /* line $node->startLine */;"
. " /* line $node->startLine */;",
);
}

Expand All @@ -126,7 +126,7 @@
. ($name[0] === '$'
? 'is_object($ʟ_tmp = %node.word) ? $ʟ_tmp : end($this->global->formsStack)[$ʟ_tmp]'
: 'end($this->global->formsStack)[%node.word]')
. " /* line $node->startLine */;"
. " /* line $node->startLine */;",
);
}

Expand Down Expand Up @@ -155,7 +155,7 @@
. '->%1.raw) echo $ʟ_label'
. ($node->tokenizer->isNext() ? '->addAttributes(%node.array)' : ''),
$name,
$words ? ('getLabelPart(' . implode(', ', array_map([$writer, 'formatWord'], $words)) . ')') : 'getLabel()'
$words ? ('getLabelPart(' . implode(', ', array_map([$writer, 'formatWord'], $words)) . ')') : 'getLabel()',
);
}

Expand Down Expand Up @@ -196,7 +196,7 @@
. ($node->tokenizer->isNext() ? '->addAttributes(%node.array)' : '')
. " /* line $node->startLine */;",
$name,
$words ? 'getControlPart(' . implode(', ', array_map([$writer, 'formatWord'], $words)) . ')' : 'getControl()'
$words ? 'getControlPart(' . implode(', ', array_map([$writer, 'formatWord'], $words)) . ')' : 'getControl()',
);
}

Expand Down Expand Up @@ -227,11 +227,11 @@
? 'is_object($ʟ_tmp = %0.word) ? $ʟ_tmp : $this->global->uiControl[$ʟ_tmp]'
: '$this->global->uiControl[%0.word]')
. " /* line $node->startLine */; ?>",
$name
$name,
);
return $writer->write(
'echo Nette\Bridges\FormsLatte\Runtime::renderFormBegin(end($this->global->formsStack), %0.var, false)',
array_fill_keys($definedHtmlAttributes, null)
'echo Nette\Bridges\FormsLatte\Runtime2::renderFormBegin(end($this->global->formsStack), %0.var, false)',
array_fill_keys($definedHtmlAttributes, null),
);
} else {
$method = $tagName === 'label' ? 'getLabel' : 'getControl';
Expand All @@ -245,7 +245,7 @@
. " /* line $node->startLine */;",
$name,
$method . 'Part(' . implode(', ', array_map([$writer, 'formatWord'], $words)) . ')',
array_fill_keys($definedHtmlAttributes, null)
array_fill_keys($definedHtmlAttributes, null),
);
}
}
Expand All @@ -265,7 +265,7 @@
{
$tagName = strtolower($node->htmlNode->name);
if ($tagName === 'form') {
$node->innerContent .= '<?php echo Nette\Bridges\FormsLatte\Runtime::renderFormEnd(array_pop($this->global->formsStack), false)'
$node->innerContent .= '<?php echo Nette\Bridges\FormsLatte\Runtime2::renderFormEnd(array_pop($this->global->formsStack), false)'
. " /* line $node->startLine */; ?>";
} elseif ($tagName === 'label') {
if ($node->htmlNode->empty) {
Expand Down Expand Up @@ -298,7 +298,7 @@
return $writer->write(
'$ʟ_input = is_object($ʟ_tmp = %0.word) ? $ʟ_tmp : end($this->global->formsStack)[$ʟ_tmp];'
. "echo %escape(\$ʟ_input->getError()) /* line $node->startLine */;",
$name
$name,
);
} else {
return $writer->write("echo %escape(end(\$this->global->formsStack)[%0.word]->getError()) /* line $node->startLine */;", $name);
Expand All @@ -319,11 +319,9 @@

$node->tokenizer->reset();
return $writer->write(
'Nette\Bridges\FormsLatte\Runtime::render' . $node->name . '('
. ($name[0] === '$'
? 'is_object($ʟ_tmp = %node.word) ? $ʟ_tmp : $this->global->uiControl[$ʟ_tmp]'
: '$this->global->uiControl[%node.word]')
. '); exit;'
'Nette\Bridges\FormsLatte\Runtime2::render' . $node->name . '('
. ($name[0] === '$' ? 'is_object(%node.word) ? %node.word : ' : '')
. '$this->global->uiControl[%node.word]); exit;',
);
}
}
8 changes: 7 additions & 1 deletion src/Bridges/FormsLatte/FormsExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,13 @@ public function getTags(): array
public function getProviders(): array
{
return [
'formsStack' => [],
'forms' => new Runtime,
];
}


public function getCacheKey(Latte\Engine $engine): array
{
return ['version' => 2];
}
}
2 changes: 1 addition & 1 deletion src/Bridges/FormsLatte/Nodes/FieldNNameNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ private function init(Tag $tag)
$elName = strtolower($el->name);

$tag->replaceNAttribute(new AuxiliaryNode(fn(PrintContext $context) => $context->format(
'echo ($ʟ_input = Nette\Bridges\FormsLatte\Runtime::item(%node, $this->global))'
'echo ($ʟ_input = $this->global->forms->item(%node))'
. ($elName === 'label' ? '->getLabelPart(%node)' : '->getControlPart(%node)')
. ($usedAttributes ? '->addAttributes(%dump)' : '')
. '->attributes() %3.line;',
Expand Down
4 changes: 2 additions & 2 deletions src/Bridges/FormsLatte/Nodes/FormContainerNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ public static function create(Tag $tag): \Generator
public function print(PrintContext $context): string
{
return $context->format(
'$this->global->formsStack[] = $formContainer = Nette\Bridges\FormsLatte\Runtime::item(%node, $this->global) %line; '
'$this->global->forms->begin($formContainer = $this->global->forms->item(%node)) %line; '
. '%node '
. 'array_pop($this->global->formsStack); $formContainer = end($this->global->formsStack);'
. '$this->global->forms->end(); $formContainer = $this->global->forms->current();'
. "\n\n",
$this->name,
$this->position,
Expand Down
Loading
Loading