Skip to content

Commit 580086f

Browse files
committed
SubmitButton::setValidationScope() accepts ?array; replace FALSE with [] (BC break)
1 parent ccef713 commit 580086f

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/Forms/Controls/SubmitButton.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ public function isSubmittedBy(): bool
6565
* Sets the validation scope. Clicking the button validates only the controls within the specified scope.
6666
* @return static
6767
*/
68-
public function setValidationScope(/*array*/$scope = NULL)
68+
public function setValidationScope(?array $scope)
6969
{
70-
if ($scope === NULL || $scope === TRUE) {
70+
if ($scope === NULL) {
7171
$this->validationScope = NULL;
7272
} else {
7373
$this->validationScope = [];

tests/Forms/Controls.Button.render.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ test(function () { // SubmitButton
8484

8585
test(function () { // SubmitButton with scope
8686
$form = new Form;
87-
$input = $form->addSubmit('button', 'Caption')->setValidationScope(FALSE);
87+
$input = $form->addSubmit('button', 'Caption')->setValidationScope([]);
8888

8989
Assert::same('<input type="submit" name="button" value="Caption" formnovalidate>', (string) $input->getControl());
9090
});

tests/Forms/Forms.validationScope.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ foreach ($datasets as $case) {
3838
$details->addText('age2')->setRequired('age2');
3939

4040
$form->addSubmit('send1');
41-
$form->addSubmit('send2')->setValidationScope(FALSE);
41+
$form->addSubmit('send2')->setValidationScope([]);
4242
$form->addSubmit('send3')->setValidationScope([$form['name']]);
4343
$form->addSubmit('send4')->setValidationScope([$form['details']['age']]);
4444
$form->addSubmit('send5')->setValidationScope([$form['details']]);

0 commit comments

Comments
 (0)