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

Minor CS changes #363

Merged
merged 1 commit into from
Sep 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 6 additions & 6 deletions docs/container.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Example::

protected $fields = [];

public function addField($name, $seed = null)
public function addField(string $name, $seed = [])
{
$seed = Factory::mergeSeeds($seed, [FieldMock::class]);

Expand All @@ -82,17 +82,17 @@ Example::
return $this->_addIntoCollection($name, $field, 'fields');
}

public function hasField($name): bool
public function hasField(string $name): bool
{
return $this->_hasInCollection($name, 'fields');
}

public function getField($name)
public function getField(string $name)
{
return $this->_getFromCollection($name, 'fields');
}

public function removeField($name)
public function removeField(string $name)
{
$this->_removeFromCollection($name, 'fields');
}
Expand All @@ -105,9 +105,9 @@ Methods

Adds a new element into collection::

public function addField($name, $definition)
public function addField(string $name, $seed = [])
{
$field = Factory::factory($definition, []);
$field = Factory::factory($seed);

return $this->_addIntoCollection($name, $field, 'fields');
}
Expand Down
2 changes: 1 addition & 1 deletion docs/exception.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ problem.
.. php:method:: getHtml()

Will return nice HTML-formatted exception that will rely on a presence of
Semantic UI. This will include the error, parameters and backtrace. The code
Fomantic-UI. This will include the error, parameters and backtrace. The code
will also make an attempt to locate and highlight the code that have caused the
problem.

Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ to create necessary methods with minimum code footprint::

public $fields = [];

public function addField($name, $seed = null)
public function addField(string $name, $seed = [])
{
$seed = Factory::mergeSeeds($seed, [FieldMock::class]);

Expand Down
2 changes: 1 addition & 1 deletion src/Exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function getColorfulText(): string
}

/**
* Return exception message using HTML block and Semantic UI formatting. It's your job
* Return exception message using HTML block and Fomantic-UI formatting. It's your job
* to put it inside boilerplate HTML and output, e.g:.
*
* $app = new \Atk4\Ui\App();
Expand Down
6 changes: 3 additions & 3 deletions src/StaticAddToTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ private static function _addToAdd(object $parent, object $object, array $addArgs
* $crud = $app->add(['Crud', 'displayFields' => ['name']]);
* but the first one design pattern is strongly recommended as it supports refactoring.
*
* @param array<mixed> $seed
* @param array<mixed> $defaults
* @param array<mixed> $addArgs
*
* @return static
*/
public static function addTo(object $parent, array $seed = [], array $addArgs = [], bool $skipAdd = false)// :static supported by PHP8+
public static function addTo(object $parent, array $defaults = [], array $addArgs = [], bool $skipAdd = false)// :static supported by PHP8+
{
$object = static::fromSeed([static::class], $seed);
$object = static::fromSeed([static::class], $defaults);

self::_addToAdd($parent, $object, $addArgs, $skipAdd);

Expand Down
4 changes: 1 addition & 3 deletions src/Translator/Translator.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@ class Translator
/** Default language of translations */
protected string $defaultLocale = 'en';

/**
* Singleton no public constructor.
*/
private function __construct()
{
// singleton
}

public function setDefaultLocale(string $locale): self
Expand Down