Skip to content

Commit

Permalink
Formatted method argument spacing
Browse files Browse the repository at this point in the history
Signed-off-by: Tom Wright <tom@inflatablecookie.com>
  • Loading branch information
betterthanclay committed Nov 3, 2023
1 parent ac0ff85 commit d67f467
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 20 deletions.
5 changes: 3 additions & 2 deletions src/Exceptional/AutoLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ public static function unregister(): void
}
}

public static function loadClass(string $class): void
{
public static function loadClass(
string $class
): void {
if (
!preg_match('/\\\\([a-zA-Z0-9_]*)Exception$/', $class) ||
class_exists($class) ||
Expand Down
8 changes: 6 additions & 2 deletions src/Exceptional/Exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,18 @@ interface Exception extends
/**
* @return $this
*/
public function setData(mixed $data): Exception;
public function setData(
mixed $data
): Exception;

public function getData(): mixed;

/**
* @return $this
*/
public function setHttpStatus(?int $code): Exception;
public function setHttpStatus(
?int $code
): Exception;

public function getHttpStatus(): ?int;
}
10 changes: 6 additions & 4 deletions src/Exceptional/ExceptionTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,9 @@ public function __construct(
/**
* Set arbitrary data
*/
public function setData(mixed $data): Exception
{
public function setData(
mixed $data
): Exception {
$this->data = $data;
return $this;
}
Expand All @@ -107,8 +108,9 @@ public function getData(): mixed
/**
* Associate error with HTTP status code
*/
public function setHttpStatus(?int $code): Exception
{
public function setHttpStatus(
?int $code
): Exception {
$this->http = $code;
return $this;
}
Expand Down
30 changes: 18 additions & 12 deletions src/Exceptional/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,9 @@ protected function prepareTargetNamespace(
*
* @param array<string> $types
*/
protected function importTypes(array $types): void
{
protected function importTypes(
array $types
): void {
foreach ($types as $type) {
$type = trim($type);

Expand Down Expand Up @@ -455,8 +456,9 @@ class_exists($type) &&
*
* @param array<string> $interfaces
*/
protected function importInterfaces(array $interfaces): void
{
protected function importInterfaces(
array $interfaces
): void {
foreach ($interfaces as $interface) {
if (substr($interface, 0, 1) !== '\\') {
$interface = '\\' . $interface;
Expand All @@ -477,8 +479,9 @@ protected function importInterfaces(array $interfaces): void
*
* @param array<string> $traits
*/
protected function importTraits(array $traits): void
{
protected function importTraits(
array $traits
): void {
foreach ($traits as $trait) {
if (substr($trait, 0, 1) !== '\\') {
$trait = '\\' . $trait;
Expand Down Expand Up @@ -530,8 +533,9 @@ public function build(): Exception
/**
* Add interface info to class extend list
*/
protected function indexInterface(string $interface): void
{
protected function indexInterface(
string $interface
): void {
$parts = explode('\\', ltrim($interface, '\\'));
$name = substr((string)array_pop($parts), 0, -9);

Expand Down Expand Up @@ -603,8 +607,9 @@ protected function indexInterface(string $interface): void
*
* @param array<string> $parts
*/
protected function indexNamespaceInterfaces(array $parts): ?string
{
protected function indexNamespaceInterfaces(
array $parts
): ?string {
$set = [];
$first = $last = '\\DecodeLabs\\Exceptional\\Exception';

Expand Down Expand Up @@ -641,8 +646,9 @@ interface_exists($interface)
/**
* Index package interface
*/
protected function indexPackageInterface(string $name): void
{
protected function indexPackageInterface(
string $name
): void {
$standard = static::STANDARD[$name];
$prefix = '\\DecodeLabs\\Exceptional\\';
$interface = $prefix . $name . 'Exception';
Expand Down

0 comments on commit d67f467

Please sign in to comment.