Skip to content

Commit

Permalink
style: tweaks constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Mar 16, 2024
1 parent ab77655 commit c2c40ba
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,17 @@
final class AutoRouteCollector
{
/**
* @param string $namespace namespace to search
* @param string $namespace namespace to search
* @param list<class-string> $protectedControllers List of controllers in Defined
* Routes that should not be accessed via Auto-Routing.
* @param string $prefix URI prefix for Module Routing
*/
public function __construct(
private readonly string $namespace,
private readonly string $defaultController,
private readonly string $defaultMethod,
private readonly array $httpMethods,
/**
* List of controllers in Defined Routes that should not be accessed via Auto-Routing.
*
* @var list<class-string>
*/
private readonly array $protectedControllers,
/**
* @var string URI prefix for Module Routing
*/
private string $prefix = ''
) {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ final class ControllerMethodReader
private readonly bool $translateUriToCamelCase;

/**
* @param string $namespace the default namespace
* @param string $namespace the default namespace
* @param list<string> $httpMethods
*/
public function __construct(private readonly string $namespace, /**
* @var list<string>
*/
private readonly array $httpMethods)
{
public function __construct(
private readonly string $namespace,
private readonly array $httpMethods
) {
$config = config(Routing::class);
$this->translateURIDashes = $config->translateURIDashes;
$this->translateUriToCamelCase = $config->translateUriToCamelCase;
Expand Down
5 changes: 3 additions & 2 deletions system/Commands/Utilities/Routes/ControllerFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ final class ControllerFinder
/**
* @param string $namespace namespace to search
*/
public function __construct(private readonly string $namespace)
{
public function __construct(
private readonly string $namespace
) {
$this->locator = service('locator');
}

Expand Down
8 changes: 2 additions & 6 deletions system/DataCaster/DataCaster.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,13 @@ final class DataCaster
/**
* @param array<string, class-string>|null $castHandlers Custom convert handlers
* @param array<string, string>|null $types [field => type]
* @param object|null $helper Helper object.
* @param bool $strict Strict mode? Set to false for casts for Entity.
*/
public function __construct(
?array $castHandlers = null,
?array $types = null,
/**
* Helper object.
*/
private readonly ?object $helper = null,
/**
* Strict mode? Set to false for casts for Entity.
*/
private readonly bool $strict = true
) {
$this->castHandlers = array_merge($this->castHandlers, $castHandlers);
Expand Down

0 comments on commit c2c40ba

Please sign in to comment.