Skip to content

Commit

Permalink
minor CS fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Sep 4, 2022
1 parent 12f1f94 commit 38a76be
Show file tree
Hide file tree
Showing 12 changed files with 17 additions and 22 deletions.
2 changes: 1 addition & 1 deletion demos/_includes/Flyers.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ protected function init(): void

$this->addField('first_name');
$this->addField('last_name');
$this->addField('age', ['values' => ['1' => 'From months to 2 years old', '2' => 'From 3 to 17 years old', '3' => '18 years or more']]);
$this->addField('age', ['values' => [1 => 'From months to 2 years old', 2 => 'From 3 to 17 years old', 3 => '18 years or more']]);
}
}
2 changes: 1 addition & 1 deletion demos/form/form.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
$group->addControl('gender', [Form\Control\Dropdown::class, 'values' => ['Female', 'Male']]);

// testing 0 value
$values = [0 => 'noob', 1 => 'pro', 2 => 'dev'];
$values = ['noob', 'pro', 'dev'];
$form->addControl('description', [Form\Control\Textarea::class])->set(0);
$form->addControl('no_description', [Form\Control\Textarea::class])->set(null);
$form->addControl('status_optional', [Form\Control\Dropdown::class, 'values' => $values]);
Expand Down
2 changes: 1 addition & 1 deletion demos/layout/layout-panel.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
$panel2->onOpen(function (Panel\Content $p) {
$form = Form::addTo($p);
$form->addHeader('Settings');
$form->addControl('name', [Form\Control\Dropdown::class, 'values' => ['1' => 'Option 1', '2' => 'Option 2']])
$form->addControl('name', [Form\Control\Dropdown::class, 'values' => [1 => 'Option 1', 2 => 'Option 2']])
->set('1')
->onChange($p->getOwner()->jsDisplayWarning(true));

Expand Down
2 changes: 1 addition & 1 deletion docs/form.rst
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ There are 3 ways to define Data form control using 'string', 'json' or 'object':
class MyBoolean extends \Atk4\Data\Field
{
public ?string $type = 'boolean';
public $enum = ['N', 'Y'];
public ?array $enum = ['N', 'Y'];
}
$form->addControl('test2', [], new MyBoolean());

Expand Down
2 changes: 1 addition & 1 deletion docs/js.rst
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ The template language for JsExpression is super-simple:
So the following lines are identical::

$sum = new JsExpression('[] + []', [$h1, $h2]);
$sum = new JsExpression('[0] + [1]', [0 => $h1, 1 => $h2]);
$sum = new JsExpression('[0] + [1]', [$h1, $h2]);
$sum = new JsExpression('[a] + [b]', ['a' => $h1, 'b' => $h2]);

.. important::
Expand Down
8 changes: 4 additions & 4 deletions docs/template.rst
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ You can use the following code to manipulate the template above::
$template->loadFromFile('envelope'); // templates/envelope.html

// Split into multiple objects for processing
$sender = $template->cloneRegion('Sender');
$sender = $template->cloneRegion('Sender');
$recipient = $template->cloneRegion('Recipient');

// Set data to each sub-template separately
Expand All @@ -414,7 +414,7 @@ Same thing using Agile Toolkit Views::

$envelope = \Atk4\Ui\View::addTo($this, [], [null], null, ['envelope']);

$sender = \Atk4\Ui\View::addTo($envelope, [], [null], 'Sender', 'Sender');
$sender = \Atk4\Ui\View::addTo($envelope, [], [null], 'Sender', 'Sender');
$recipient = \Atk4\Ui\View::addTo($envelope, [], [null], 'Recipient', 'Recipient');

$sender->template->set($sender_data);
Expand Down Expand Up @@ -644,9 +644,9 @@ under ``$template->template`::

// template property:
array (
0 => 'Hello ',
'Hello ',
'subject#0' => array (
0 => 'world',
'world',
),
1 => '!!',
)
Expand Down
2 changes: 1 addition & 1 deletion src/Behat/Context.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ protected function assertNoDuplicateId(): void
}

/**
* @return array{0: 'css'|'xpath', 1: string}
* @return array{'css'|'xpath', string}
*/
protected function parseSelector(string $selector): array
{
Expand Down
1 change: 0 additions & 1 deletion src/Form/Control/Dropdown.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Atk4\Ui\Form\Control;

use Atk4\Data\Model;
use Atk4\Ui\JsExpression;
use Atk4\Ui\JsExpressionable;
use Atk4\Ui\JsFunction;
Expand Down
4 changes: 0 additions & 4 deletions src/Label.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ class Label extends View
/**
* Icon to the right of the label.
*
* @see $icon
*
* @var View|array|string
*/
public $iconRight;
Expand All @@ -39,8 +37,6 @@ class Label extends View
/**
* Image to the right of the label.
*
* @see $image
*
* @var View|array|string
*/
public $imageRight;
Expand Down
8 changes: 4 additions & 4 deletions src/Table/Column/KeyValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
* 'caption' => __('Payment Status'),
* 'default' => 0,
* 'values' => [
* 0 => __('not invoiceable'),
* 1 => __('ready to invoice'),
* 2 => __('invoiced'),
* 3 => __('paid'),
* __('not invoiceable'),
* __('ready to invoice'),
* __('invoiced'),
* __('paid'),
* ],
* 'ui' => [
* 'form' => [Form\Control\Dropdown::class],
Expand Down
4 changes: 2 additions & 2 deletions src/Table/Column/Labels.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
*/
class Labels extends Table\Column
{
/** @var array|null Allowed values, prioritized over ->values */
public $values;
/** @var array|null Allowed values, prioritized over Field::$values */
public ?array $values = null;

public function getHtmlTags(Model $row, ?Field $field): array
{
Expand Down
2 changes: 1 addition & 1 deletion tests/FormTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public function testSubmitError(): void
{
$m = new Model();

$options = ['0' => 'yes please', '1' => 'woot'];
$options = ['yes please', 'woot'];

$m->addField('opt1', ['values' => $options]);
$m->addField('opt2', ['values' => $options]);
Expand Down

0 comments on commit 38a76be

Please sign in to comment.