feat: improve grammar

This commit is contained in:
Nuno Maduro
2023-06-03 00:37:28 +01:00
parent e2ccc9deac
commit ac13a288fb

View File

@ -432,6 +432,14 @@ final class Expectation
);
}
/**
* Asserts that the given expectation targets are traits.
*/
public function toBeTraits(): ArchExpectation
{
return $this->toBeTrait();
}
/**
* Asserts that the given expectation target is abstract.
*/
@ -462,6 +470,14 @@ final class Expectation
);
}
/**
* Asserts that the given expectation targets are enums.
*/
public function toBeEnums(): ArchExpectation
{
return $this->toBeEnum();
}
/**
* Asserts that the given expectation target is interface.
*/
@ -477,6 +493,14 @@ final class Expectation
);
}
/**
* Asserts that the given expectation targets are interfaces.
*/
public function toBeInterfaces(): ArchExpectation
{
return $this->toBeInterface();
}
/**
* Asserts that the given expectation target to be subclass of the given class.
*
@ -526,6 +550,8 @@ final class Expectation
/**
* Asserts that the given expectation target to only implement the given interfaces.
*
* @param array<int, class-string>|class-string $interfaces
*/
public function toOnlyImplement(array|string $interfaces): ArchExpectation
{
@ -535,7 +561,7 @@ final class Expectation
$this,
fn (ObjectDescription $object): bool => count($interfaces) === count($object->reflectionClass->getInterfaceNames())
&& array_diff($interfaces, $object->reflectionClass->getInterfaceNames()) === [],
"to only implement '".implode("', '", (array) $interfaces)."'",
"to only implement '".implode("', '", $interfaces)."'",
FileLineFinder::where(function (string $line): bool {
return str_contains($line, 'class');
}),
@ -574,6 +600,8 @@ final class Expectation
/**
* Asserts that the given expectation target to implement the given interfaces.
*
* @param array<int, class-string>|class-string $interfaces
*/
public function toImplement(array|string $interfaces): ArchExpectation
{
@ -590,7 +618,7 @@ final class Expectation
return true;
},
"to implement '".implode("', '", (array) $interfaces)."'",
"to implement '".implode("', '", $interfaces)."'",
FileLineFinder::where(function (string $line): bool {
return str_contains($line, 'class');
}),