From 3310c2efe495907880d80ac61d505f04d0499695 Mon Sep 17 00:00:00 2001 From: azjezz Date: Sun, 3 Oct 2021 16:04:00 +0100 Subject: [PATCH 1/2] bug(shell): include stdout/stderr output in exception message Signed-off-by: azjezz --- .../Exception/FailedExecutionException.php | 22 +++++++++++++++++-- .../FailedExecutionExceptionTest.php | 12 +++++++++- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/src/Psl/Shell/Exception/FailedExecutionException.php b/src/Psl/Shell/Exception/FailedExecutionException.php index 5ef2ed89..daae4ae2 100644 --- a/src/Psl/Shell/Exception/FailedExecutionException.php +++ b/src/Psl/Shell/Exception/FailedExecutionException.php @@ -6,7 +6,9 @@ use Psl\Str; -final class FailedExecutionException extends RuntimeException implements ExceptionInterface +use const PHP_EOL; + +final class FailedExecutionException extends RuntimeException { private string $command; @@ -15,7 +17,23 @@ final class FailedExecutionException extends RuntimeException implements Excepti public function __construct(string $command, string $stdout_content, string $stderr_content, int $code) { - $message = Str\format('Shell command "%s" returned an exit code of "%d".', $command, $code); + $message = Str\format( + <<getMessage()); + $message = <<getMessage()); static::assertSame('foo', $exception->getCommand()); static::assertSame('bar', $exception->getOutput()); static::assertSame('baz', $exception->getErrorOutput()); From 9ad8118ff423598d1c645892a9f4ebf2af699226 Mon Sep 17 00:00:00 2001 From: azjezz Date: Sun, 3 Oct 2021 16:06:55 +0100 Subject: [PATCH 2/2] chore(coding-standards): fix coding standards Signed-off-by: azjezz --- docs/component/collection.md | 2 +- .../AccessibleCollectionInterface.php | 37 ++++++++-------- src/Psl/Collection/CollectionInterface.php | 24 +++++----- src/Psl/Collection/Map.php | 24 +++++----- src/Psl/Collection/MapInterface.php | 22 +++++----- .../MutableAccessibleCollectionInterface.php | 44 +++++++++---------- .../Collection/MutableCollectionInterface.php | 36 ++++++++------- src/Psl/Collection/MutableMap.php | 21 ++++----- src/Psl/Collection/MutableMapInterface.php | 24 +++++----- src/Psl/Collection/MutableVector.php | 2 +- src/Psl/Collection/MutableVectorInterface.php | 4 +- src/Psl/Collection/Vector.php | 2 +- src/Psl/Collection/VectorInterface.php | 2 +- .../Exception/FailedExecutionException.php | 5 ++- src/Psl/Str/Byte/words.php | 2 +- 15 files changed, 129 insertions(+), 122 deletions(-) diff --git a/docs/component/collection.md b/docs/component/collection.md index 54e293fa..f6dfb7f2 100644 --- a/docs/component/collection.md +++ b/docs/component/collection.md @@ -25,7 +25,7 @@ #### `Classes` -- [Map](./../../src/Psl/Collection/Map.php#L20) +- [Map](./../../src/Psl/Collection/Map.php#L18) - [MutableMap](./../../src/Psl/Collection/MutableMap.php#L18) - [MutableVector](./../../src/Psl/Collection/MutableVector.php#L17) - [Vector](./../../src/Psl/Collection/Vector.php#L17) diff --git a/src/Psl/Collection/AccessibleCollectionInterface.php b/src/Psl/Collection/AccessibleCollectionInterface.php index 7cf85426..4b19dda6 100644 --- a/src/Psl/Collection/AccessibleCollectionInterface.php +++ b/src/Psl/Collection/AccessibleCollectionInterface.php @@ -50,7 +50,7 @@ public function keys(): AccessibleCollectionInterface; * `AccessibleCollectionInterface` values. * * @return AccessibleCollectionInterface A `AccessibleCollectionInterface` containing the values - * after a user-specified condition is applied. + * after a user-specified condition is applied. */ public function filter(callable $fn): AccessibleCollectionInterface; @@ -69,8 +69,8 @@ public function filter(callable $fn): AccessibleCollectionInterface; * `AccessibleCollectionInterface` keys and values. * * @return AccessibleCollectionInterface A `AccessibleCollectionInterface` containing the values - * after a user-specified condition is applied to the keys and values - * of the current `AccessibleCollectionInterface`. + * after a user-specified condition is applied to the keys and values + * of the current `AccessibleCollectionInterface`. */ public function filterWithKey(callable $fn): AccessibleCollectionInterface; @@ -90,7 +90,7 @@ public function filterWithKey(callable $fn): AccessibleCollectionInterface; * `AccessibleCollectionInterface` values. * * @return AccessibleCollectionInterface A `AccessibleCollectionInterface` containing key/value - * pairs after a user-specified operation is applied. + * pairs after a user-specified operation is applied. */ public function map(callable $fn): AccessibleCollectionInterface; @@ -111,8 +111,8 @@ public function map(callable $fn): AccessibleCollectionInterface; * `AccessibleCollectionInterface` keys and values. * * @return AccessibleCollectionInterface A `AccessibleCollectionInterface` containing the values - * after a user-specified operation on the current - * `AccessibleCollectionInterface`'s keys and values is applied. + * after a user-specified operation on the current + * `AccessibleCollectionInterface`'s keys and values is applied. */ public function mapWithKey(callable $fn): AccessibleCollectionInterface; @@ -185,8 +185,9 @@ public function linearSearch(mixed $search_value): int|string|null; * elements of this `AccessibleCollectionInterface`. * * @return AccessibleCollectionInterface The `AccessibleCollectionInterface` that - * combines the values of the current `AccessibleCollectionInterface` - * with the provided `iterable`. + * combines the values of the current + * `AccessibleCollectionInterface` + * with the provided `iterable`. * * @psalm-mutation-free */ @@ -205,8 +206,8 @@ public function zip(iterable $iterable): AccessibleCollectionInterface; * `AccessibleCollectionInterface`. * * @return AccessibleCollectionInterface A `AccessibleCollectionInterface` that is a proper - * subset of the current `AccessibleCollectionInterface` up - * to `n` elements. + * subset of the current `AccessibleCollectionInterface` up + * to `n` elements. * * @psalm-mutation-free */ @@ -224,8 +225,8 @@ public function take(int $n): AccessibleCollectionInterface; * condition. * * @return AccessibleCollectionInterface A `AccessibleCollectionInterface` that is a proper subset - * of the current `AccessibleCollectionInterface` up until - * the callback returns `false`. + * of the current `AccessibleCollectionInterface` up until + * the callback returns `false`. */ public function takeWhile(callable $fn): AccessibleCollectionInterface; @@ -242,8 +243,8 @@ public function takeWhile(callable $fn): AccessibleCollectionInterface; * first one in the returned `AccessibleCollectionInterface`. * * @return AccessibleCollectionInterface A `AccessibleCollectionInterface` that is a proper subset - * of the current `AccessibleCollectionInterface` containing values - * after the specified `n`-th element. + * of the current `AccessibleCollectionInterface` containing values + * after the specified `n`-th element. * * @psalm-mutation-free */ @@ -261,8 +262,8 @@ public function drop(int $n): AccessibleCollectionInterface; * returned `AccessibleCollectionInterface`. * * @return AccessibleCollectionInterface A `AccessibleCollectionInterface` that is a proper subset - * of the current `AccessibleCollectionInterface` starting after - * the callback returns `true`. + * of the current `AccessibleCollectionInterface` starting after + * the callback returns `true`. */ public function dropWhile(callable $fn): AccessibleCollectionInterface; @@ -282,8 +283,8 @@ public function dropWhile(callable $fn): AccessibleCollectionInterface; * @param int $length The length of the returned `AccessibleCollectionInterface` * * @return AccessibleCollectionInterface A `AccessibleCollectionInterface` that is a proper subset - * of the current `AccessibleCollectionInterface` starting at `$start` - * up to but not including the element `$start + $length`. + * of the current `AccessibleCollectionInterface` starting at `$start` + * up to but not including the element `$start + $length`. * * @psalm-mutation-free */ diff --git a/src/Psl/Collection/CollectionInterface.php b/src/Psl/Collection/CollectionInterface.php index d051c6ee..c5a92803 100644 --- a/src/Psl/Collection/CollectionInterface.php +++ b/src/Psl/Collection/CollectionInterface.php @@ -66,7 +66,7 @@ public function jsonSerialize(): array; * `CollectionInterface` values. * * @return CollectionInterface A CollectionInterface containing the values after a user-specified - * condition is applied. + * condition is applied. */ public function filter(callable $fn): CollectionInterface; @@ -85,7 +85,8 @@ public function filter(callable $fn): CollectionInterface; * `CollectionInterface` keys and values. * * @return CollectionInterface A `CollectionInterface` containing the values after a user-specified - * condition is applied to the keys and values of the current `CollectionInterface`. + * condition is applied to the keys and values of + * the current `CollectionInterface`. */ public function filterWithKey(callable $fn): CollectionInterface; @@ -105,7 +106,7 @@ public function filterWithKey(callable $fn): CollectionInterface; * `CollectionInterface` values. * * @return CollectionInterface A `CollectionInterface` containing key/value pairs after - * a user-specified operation is applied. + * a user-specified operation is applied. */ public function map(callable $fn): CollectionInterface; @@ -126,7 +127,7 @@ public function map(callable $fn): CollectionInterface; * `CollectionInterface` keys and values. * * @return CollectionInterface A `CollectionInterface` containing the values after a user-specified - * operation on the current `CollectionInterface`'s keys and values is applied. + * operation on the current `CollectionInterface`'s keys and values is applied. */ public function mapWithKey(callable $fn): CollectionInterface; @@ -145,7 +146,8 @@ public function mapWithKey(callable $fn): CollectionInterface; * elements of this `CollectionInterface`. * * @return CollectionInterface The `CollectionInterface` that combines - * the values of the current `CollectionInterface` with the provided `iterable`. + * the values of the current `CollectionInterface` + * with the provided `iterable`. * * @psalm-mutation-free */ @@ -164,7 +166,7 @@ public function zip(iterable $iterable): CollectionInterface; * `CollectionInterface`. * * @return CollectionInterface A `CollectionInterface` that is a proper subset of the current - * `CollectionInterface` up to `n` elements. + * `CollectionInterface` up to `n` elements. * * @psalm-mutation-free */ @@ -182,7 +184,7 @@ public function take(int $n): CollectionInterface; * condition. * * @return CollectionInterface A `CollectionInterface` that is a proper subset of the current - * `CollectionInterface` up until the callback returns `false`. + * `CollectionInterface` up until the callback returns `false`. */ public function takeWhile(callable $fn): CollectionInterface; @@ -199,7 +201,7 @@ public function takeWhile(callable $fn): CollectionInterface; * first one in the returned `CollectionInterface`. * * @return CollectionInterface A `CollectionInterface` that is a proper subset of the current - * `CollectionInterface` containing values after the specified `n`-th element. + * `CollectionInterface` containing values after the specified `n`-th element. * * @psalm-mutation-free */ @@ -217,7 +219,7 @@ public function drop(int $n): CollectionInterface; * returned `CollectionInterface`. * * @return CollectionInterface A `CollectionInterface` that is a proper subset of the current - * `CollectionInterface` starting after the callback returns `true`. + * `CollectionInterface` starting after the callback returns `true`. */ public function dropWhile(callable $fn): CollectionInterface; @@ -237,8 +239,8 @@ public function dropWhile(callable $fn): CollectionInterface; * @param int $length The length of the returned `CollectionInterface`. * * @return CollectionInterface A `CollectionInterface` that is a proper subset of the current - * `CollectionInterface` starting at `$start` up to but not including - * the element `$start + $length`. + * `CollectionInterface` starting at `$start` up to but not including + * the element `$start + $length`. * * @psalm-mutation-free */ diff --git a/src/Psl/Collection/Map.php b/src/Psl/Collection/Map.php index 30f835ce..807b99d5 100644 --- a/src/Psl/Collection/Map.php +++ b/src/Psl/Collection/Map.php @@ -9,8 +9,6 @@ use Psl\Iter; use Psl\Vec; -use function count; - /** * @template Tk of array-key * @template Tv @@ -272,7 +270,7 @@ public function keys(): Vector * `Map` values. * * @return Map A Map containing the values after a user-specified condition - * is applied. + * is applied. */ public function filter(callable $fn): Map { @@ -294,7 +292,7 @@ public function filter(callable $fn): Map * `Map` keys and values. * * @return Map A `Map` containing the values after a user-specified - * condition is applied to the keys and values of the current `Map`. + * condition is applied to the keys and values of the current `Map`. */ public function filterWithKey(callable $fn): Map { @@ -317,7 +315,7 @@ public function filterWithKey(callable $fn): Map * `Map` values. * * @return Map A `Map` containing key/value pairs after a user-specified - * operation is applied. + * operation is applied. */ public function map(callable $fn): Map { @@ -341,7 +339,7 @@ public function map(callable $fn): Map * `Map` keys and values. * * @return Map A `Map` containing the values after a user-specified - * operation on the current `Map`'s keys and values is applied. + * operation on the current `Map`'s keys and values is applied. */ public function mapWithKey(callable $fn): Map { @@ -363,7 +361,7 @@ public function mapWithKey(callable $fn): Map * elements of this `Map`. * * @return Map The `Map` that combines the values of the current - * `Map` with the provided `iterable`. + * `Map` with the provided `iterable`. * * @psalm-mutation-free */ @@ -412,7 +410,7 @@ public function zip(iterable $iterable): Map * @throws Psl\Exception\InvariantViolationException If $n is negative. * * @return Map A `Map` that is a proper subset of the current - * `Map` up to `n` elements. + * `Map` up to `n` elements. * * @psalm-mutation-free */ @@ -433,7 +431,7 @@ public function take(int $n): Map * condition. * * @return Map A `Map` that is a proper subset of the current - * `Map` up until the callback returns `false`. + * `Map` up until the callback returns `false`. */ public function takeWhile(callable $fn): Map { @@ -455,7 +453,7 @@ public function takeWhile(callable $fn): Map * @throws Psl\Exception\InvariantViolationException If $n is negative. * * @return Map A `Map` that is a proper subset of the current - * `Map` containing values after the specified `n`-th element. + * `Map` containing values after the specified `n`-th element. * * @psalm-mutation-free */ @@ -476,7 +474,7 @@ public function drop(int $n): Map * returned `Map`. * * @return Map A `Map` that is a proper subset of the current - * `Map` starting after the callback returns `true`. + * `Map` starting after the callback returns `true`. */ public function dropWhile(callable $fn): Map { @@ -499,8 +497,8 @@ public function dropWhile(callable $fn): Map * * @throws Psl\Exception\InvariantViolationException If $start or $length are negative. * - * @return Map A `Map` that is a proper subset of the current - * `Map` starting at `$start` up to but not including the element `$start + $length`. + * @return Map A `Map` that is a proper subset of the current + * `Map` starting at `$start` up to but not including the element `$start + $length`. * * @psalm-mutation-free */ diff --git a/src/Psl/Collection/MapInterface.php b/src/Psl/Collection/MapInterface.php index 8722f021..67ddde67 100644 --- a/src/Psl/Collection/MapInterface.php +++ b/src/Psl/Collection/MapInterface.php @@ -45,7 +45,7 @@ public function keys(): VectorInterface; * `MapInterface` values. * * @return MapInterface A MapInterface containing the values after a user-specified condition - * is applied. + * is applied. */ public function filter(callable $fn): MapInterface; @@ -64,7 +64,7 @@ public function filter(callable $fn): MapInterface; * `MapInterface` keys and values. * * @return MapInterface A `MapInterface` containing the values after a user-specified - * condition is applied to the keys and values of the current `MapInterface`. + * condition is applied to the keys and values of the current `MapInterface`. */ public function filterWithKey(callable $fn): MapInterface; @@ -84,7 +84,7 @@ public function filterWithKey(callable $fn): MapInterface; * `MapInterface` values. * * @return MapInterface A `MapInterface` containing key/value pairs after a user-specified - * operation is applied. + * operation is applied. */ public function map(callable $fn): MapInterface; @@ -105,7 +105,7 @@ public function map(callable $fn): MapInterface; * `MapInterface` keys and values. * * @return MapInterface A `MapInterface` containing the values after a user-specified - * operation on the current `MapInterface`'s keys and values is applied. + * operation on the current `MapInterface`'s keys and values is applied. */ public function mapWithKey(callable $fn): MapInterface; @@ -178,7 +178,7 @@ public function linearSearch(mixed $search_value): int|string|null; * elements of this `MapInterface`. * * @return MapInterface - The `MapInterface` that combines the values of the current - * `MapInterface` with the provided `iterable`. + * `MapInterface` with the provided `iterable`. * * @psalm-mutation-free */ @@ -197,7 +197,7 @@ public function zip(iterable $iterable): MapInterface; * `MapInterface`. * * @return MapInterface A `MapInterface` that is a proper subset of the current - * `MapInterface` up to `n` elements. + * `MapInterface` up to `n` elements. * * @psalm-mutation-free */ @@ -215,7 +215,7 @@ public function take(int $n): MapInterface; * condition. * * @return MapInterface A `MapInterface` that is a proper subset of the current - * `MapInterface` up until the callback returns `false`. + * `MapInterface` up until the callback returns `false`. */ public function takeWhile(callable $fn): MapInterface; @@ -232,7 +232,7 @@ public function takeWhile(callable $fn): MapInterface; * first one in the returned `MapInterface`. * * @return MapInterface - A `MapInterface` that is a proper subset of the current - * `MapInterface` containing values after the specified `n`-th element. + * `MapInterface` containing values after the specified `n`-th element. * * @psalm-mutation-free */ @@ -250,7 +250,7 @@ public function drop(int $n): MapInterface; * returned `MapInterface`. * * @return MapInterface A `MapInterface` that is a proper subset of the current - * `MapInterface` starting after the callback returns `true`. + * `MapInterface` starting after the callback returns `true`. */ public function dropWhile(callable $fn): MapInterface; @@ -270,8 +270,8 @@ public function dropWhile(callable $fn): MapInterface; * @param int $length The length of the returned `MapInterface` * * @return MapInterface - A `MapInterface` that is a proper subset of the current - * `MapInterface` starting at `$start` up to but not including - * the element `$start + $length`. + * `MapInterface` starting at `$start` up to but not including + * the element `$start + $length`. * * @psalm-mutation-free */ diff --git a/src/Psl/Collection/MutableAccessibleCollectionInterface.php b/src/Psl/Collection/MutableAccessibleCollectionInterface.php index 4737cfe4..ac47a545 100644 --- a/src/Psl/Collection/MutableAccessibleCollectionInterface.php +++ b/src/Psl/Collection/MutableAccessibleCollectionInterface.php @@ -56,7 +56,7 @@ public function keys(): MutableAccessibleCollectionInterface; * `MutableAccessibleCollectionInterface` values. * * @return MutableAccessibleCollectionInterface A `MutableAccessibleCollectionInterface` containing - * the values after a user-specified condition is applied. + * the values after a user-specified condition is applied. */ public function filter(callable $fn): MutableAccessibleCollectionInterface; @@ -75,9 +75,9 @@ public function filter(callable $fn): MutableAccessibleCollectionInterface; * `MutableAccessibleCollectionInterface` keys and values. * * @return MutableAccessibleCollectionInterface A `MutableAccessibleCollectionInterface` containing - * the values after a user-specified condition is applied - * to the keys and values of the current - * `MutableAccessibleCollectionInterface`. + * the values after a user-specified condition is applied + * to the keys and values of the current + * `MutableAccessibleCollectionInterface`. */ public function filterWithKey(callable $fn): MutableAccessibleCollectionInterface; @@ -97,7 +97,7 @@ public function filterWithKey(callable $fn): MutableAccessibleCollectionInterfac * `MutableAccessibleCollectionInterface` values. * * @return MutableAccessibleCollectionInterface A `MutableAccessibleCollectionInterface` containing - * key/value pairs after a user-specified operation is applied. + * key/value pairs after a user-specified operation is applied. */ public function map(callable $fn): MutableAccessibleCollectionInterface; @@ -118,9 +118,9 @@ public function map(callable $fn): MutableAccessibleCollectionInterface; * `MutableAccessibleCollectionInterface` keys and values. * * @return MutableAccessibleCollectionInterface A `MutableAccessibleCollectionInterface` containing - * the values after a user-specified operation on the current - * `MutableAccessibleCollectionInterface`'s keys and values is - * applied. + * the values after a user-specified operation on the current + * `MutableAccessibleCollectionInterface`'s keys and values is + * applied. */ public function mapWithKey(callable $fn): MutableAccessibleCollectionInterface; @@ -195,9 +195,9 @@ public function clear(): MutableAccessibleCollectionInterface; * elements of this `MutableAccessibleCollectionInterface`. * * @return MutableAccessibleCollectionInterface The `MutableAccessibleCollectionInterface` - * that combines the values of the current - * `MutableAccessibleCollectionInterface` with the provided - * `iterable`. + * that combines the values of the current + * `MutableAccessibleCollectionInterface` with + * the provided `iterable`. * * @psalm-mutation-free */ @@ -215,8 +215,8 @@ public function zip(iterable $iterable): MutableAccessibleCollectionInterface; * @param int $n The last element that will be included in the returned `MutableAccessibleCollectionInterface`. * * @return MutableAccessibleCollectionInterface A `MutableAccessibleCollectionInterface` that is a proper - * subset of the current `MutableAccessibleCollectionInterface` - * up to `n` elements. + * subset of the current `MutableAccessibleCollectionInterface` + * up to `n` elements. * * @psalm-mutation-free */ @@ -234,8 +234,8 @@ public function take(int $n): MutableAccessibleCollectionInterface; * condition. * * @return MutableAccessibleCollectionInterface A `MutableAccessibleCollectionInterface` that is a proper - * subset of the current `MutableAccessibleCollectionInterface` - * up until the callback returns `false`. + * subset of the current `MutableAccessibleCollectionInterface` + * up until the callback returns `false`. */ public function takeWhile(callable $fn): MutableAccessibleCollectionInterface; @@ -252,8 +252,8 @@ public function takeWhile(callable $fn): MutableAccessibleCollectionInterface; * first one in the returned `MutableAccessibleCollectionInterface`. * * @return MutableAccessibleCollectionInterface A `MutableAccessibleCollectionInterface` that is a proper - * subset of the current `MutableAccessibleCollectionInterface` - * containing values after the specified `n`-th element. + * subset of the current `MutableAccessibleCollectionInterface` + * containing values after the specified `n`-th element. * * @psalm-mutation-free */ @@ -271,8 +271,8 @@ public function drop(int $n): MutableAccessibleCollectionInterface; * returned `MutableAccessibleCollectionInterface`. * * @return MutableAccessibleCollectionInterface A `MutableAccessibleCollectionInterface` that is a proper - * subset of the current `MutableAccessibleCollectionInterface` - * starting after the callback returns `true`. + * subset of the current `MutableAccessibleCollectionInterface` + * starting after the callback returns `true`. */ public function dropWhile(callable $fn): MutableAccessibleCollectionInterface; @@ -291,9 +291,9 @@ public function dropWhile(callable $fn): MutableAccessibleCollectionInterface; * @param int $length The length of the returned `MutableAccessibleCollectionInterface` * * @return MutableAccessibleCollectionInterface A `MutableAccessibleCollectionInterface` that is a proper - * subset of the current `MutableAccessibleCollectionInterface` - * starting at `$start` up to but not including the element - * `$start + $length`. + * subset of the current `MutableAccessibleCollectionInterface` + * starting at `$start` up to but not including the element + * `$start + $length`. * * @psalm-mutation-free */ diff --git a/src/Psl/Collection/MutableCollectionInterface.php b/src/Psl/Collection/MutableCollectionInterface.php index 832e56e8..2fb0f3f1 100644 --- a/src/Psl/Collection/MutableCollectionInterface.php +++ b/src/Psl/Collection/MutableCollectionInterface.php @@ -33,7 +33,7 @@ interface MutableCollectionInterface extends CollectionInterface * `MutableCollectionInterface` values. * * @return MutableCollectionInterface A `MutableCollectionInterface` containing the values - * after a user-specified condition is applied. + * after a user-specified condition is applied. */ public function filter(callable $fn): MutableCollectionInterface; @@ -52,8 +52,8 @@ public function filter(callable $fn): MutableCollectionInterface; * `MutableCollectionInterface` keys and values. * * @return MutableCollectionInterface A `MutableCollectionInterface` containing the values after - * a user-specified condition is applied to the keys and values of - * the current `MutableCollectionInterface`. + * a user-specified condition is applied to the keys and values of + * the current `MutableCollectionInterface`. */ public function filterWithKey(callable $fn): MutableCollectionInterface; @@ -73,7 +73,7 @@ public function filterWithKey(callable $fn): MutableCollectionInterface; * `MutableCollectionInterface` values. * * @return MutableCollectionInterface A `MutableCollectionInterface` containing key/value pairs - * after a user-specified operation is applied. + * after a user-specified operation is applied. */ public function map(callable $fn): MutableCollectionInterface; @@ -94,8 +94,8 @@ public function map(callable $fn): MutableCollectionInterface; * `MutableCollectionInterface` keys and values. * * @return MutableCollectionInterface A `MutableCollectionInterface` containing the values - * after a user-specified operation on the current - * `MutableCollectionInterface`'s keys and values is applied. + * after a user-specified operation on the current + * `MutableCollectionInterface`'s keys and values is applied. */ public function mapWithKey(callable $fn): MutableCollectionInterface; @@ -114,8 +114,9 @@ public function mapWithKey(callable $fn): MutableCollectionInterface; * elements of this `MutableCollectionInterface`. * * @return MutableCollectionInterface The `MutableCollectionInterface` that - * combines the values of the current `MutableCollectionInterface` with - * the provided `iterable`. + * combines the values of the current + * `MutableCollectionInterface` with + * the provided `iterable`. * * @psalm-mutation-free */ @@ -133,7 +134,7 @@ public function zip(iterable $iterable): MutableCollectionInterface; * @param int $n The last element that will be included in the returned `MutableCollectionInterface`. * * @return MutableCollectionInterface A `MutableCollectionInterface` that is a proper - * subset of the current `MutableCollectionInterface` up to `n` elements. + * subset of the current `MutableCollectionInterface` up to `n` elements. * * @psalm-mutation-free */ @@ -151,8 +152,8 @@ public function take(int $n): MutableCollectionInterface; * condition. * * @return MutableCollectionInterface A `MutableCollectionInterface` that is a proper - * subset of the current `MutableCollectionInterface` up until - * the callback returns `false`. + * subset of the current `MutableCollectionInterface` up until + * the callback returns `false`. */ public function takeWhile(callable $fn): MutableCollectionInterface; @@ -169,8 +170,8 @@ public function takeWhile(callable $fn): MutableCollectionInterface; * first one in the returned `MutableCollectionInterface`. * * @return MutableCollectionInterface A `MutableCollectionInterface` that is a proper - * subset of the current `MutableCollectionInterface` containing values - * after the specified `n`-th element. + * subset of the current `MutableCollectionInterface` containing values + * after the specified `n`-th element. * * @psalm-mutation-free */ @@ -188,7 +189,8 @@ public function drop(int $n): MutableCollectionInterface; * returned `MutableCollectionInterface`. * * @return MutableCollectionInterface A `MutableCollectionInterface` that is a proper subset of the current - * `MutableCollectionInterface` starting after the callback returns `true`. + * `MutableCollectionInterface` starting after the callback returns + * `true`. */ public function dropWhile(callable $fn): MutableCollectionInterface; @@ -208,13 +210,13 @@ public function dropWhile(callable $fn): MutableCollectionInterface; * @param int $length The length of the returned `MutableCollectionInterface`. * * @return MutableCollectionInterface A `MutableCollectionInterface` that is a proper - * subset of the current `MutableCollectionInterface` starting - * at `$start` up to but not including the element `$start + $length`. + * subset of the current `MutableCollectionInterface` starting + * at `$start` up to but not including the element `$start + $length`. * * @psalm-mutation-free */ public function slice(int $start, int $length): MutableCollectionInterface; - + /** * Removes all items from the collection. * diff --git a/src/Psl/Collection/MutableMap.php b/src/Psl/Collection/MutableMap.php index 31652e4b..99474208 100644 --- a/src/Psl/Collection/MutableMap.php +++ b/src/Psl/Collection/MutableMap.php @@ -268,7 +268,7 @@ public function keys(): MutableVector * `MutableMap` values. * * @return MutableMap A MutableMap containing the values after a user-specified condition - * is applied. + * is applied. */ public function filter(callable $fn): MutableMap { @@ -290,7 +290,7 @@ public function filter(callable $fn): MutableMap * `MutableMap` keys and values. * * @return MutableMap A `MutableMap` containing the values after a user-specified - * condition is applied to the keys and values of the current `MutableMap`. + * condition is applied to the keys and values of the current `MutableMap`. */ public function filterWithKey(callable $fn): MutableMap { @@ -313,7 +313,7 @@ public function filterWithKey(callable $fn): MutableMap * `MutableMap` values. * * @return MutableMap A `MutableMap` containing key/value pairs after a user-specified - * operation is applied. + * operation is applied. */ public function map(callable $fn): MutableMap { @@ -337,7 +337,7 @@ public function map(callable $fn): MutableMap * `MutableMap` keys and values. * * @return MutableMap A `MutableMap` containing the values after a user-specified - * operation on the current `MutableMap`'s keys and values is applied. + * operation on the current `MutableMap`'s keys and values is applied. */ public function mapWithKey(callable $fn): MutableMap { @@ -359,7 +359,7 @@ public function mapWithKey(callable $fn): MutableMap * elements of this `MutableMap`. * * @return MutableMap A `MutableMap` that combines the values of the current - * `MutableMap` with the provided `iterable`. + * `MutableMap` with the provided `iterable`. * * @psalm-mutation-free */ @@ -405,7 +405,7 @@ public function zip(iterable $iterable): MutableMap * @throws Psl\Exception\InvariantViolationException If $n is negative. * * @return MutableMap A `MutableMap` that is a proper subset of the current - * `MutableMap` up to `n` elements. + * `MutableMap` up to `n` elements. * * @psalm-mutation-free */ @@ -426,7 +426,7 @@ public function take(int $n): MutableMap * condition. * * @return MutableMap A `MutableMap` that is a proper subset of the current - * `MutableMap` up until the callback returns `false`. + * `MutableMap` up until the callback returns `false`. */ public function takeWhile(callable $fn): MutableMap { @@ -448,7 +448,7 @@ public function takeWhile(callable $fn): MutableMap * @throws Psl\Exception\InvariantViolationException If $n is negative. * * @return MutableMap A `MutableMap` that is a proper subset of the current - * `MutableMap` containing values after the specified `n`-th element. + * `MutableMap` containing values after the specified `n`-th element. * * @psalm-mutation-free */ @@ -470,7 +470,7 @@ public function drop(int $n): MutableMap * returned `MutableMap`. * * @return MutableMap A `MutableMap` that is a proper subset of the current - * `MutableMap` starting after the callback returns `true`. + * `MutableMap` starting after the callback returns `true`. */ public function dropWhile(callable $fn): MutableMap { @@ -495,7 +495,8 @@ public function dropWhile(callable $fn): MutableMap * @throws Psl\Exception\InvariantViolationException If $start or $len are negative. * * @return MutableMap A `MutableMap` that is a proper subset of the current - * `MutableMap` starting at `$start` up to but not including the element `$start + $length`. + * `MutableMap` starting at `$start` up to but not including + * the element `$start + $length`. * * @psalm-mutation-free */ diff --git a/src/Psl/Collection/MutableMapInterface.php b/src/Psl/Collection/MutableMapInterface.php index 3d82eb1f..75fab009 100644 --- a/src/Psl/Collection/MutableMapInterface.php +++ b/src/Psl/Collection/MutableMapInterface.php @@ -46,7 +46,7 @@ public function keys(): MutableVectorInterface; * `MutableMapInterface` values. * * @return MutableMapInterface - a MutableMapInterface containing the values after a user-specified - * condition is applied. + * condition is applied. */ public function filter(callable $fn): MutableMapInterface; @@ -65,7 +65,8 @@ public function filter(callable $fn): MutableMapInterface; * the current `MutableMapInterface` keys and values. * * @return MutableMapInterface - a `MutableMapInterface` containing the values after a user-specified - * condition is applied to the keys and values of the current `MutableMapInterface`. + * condition is applied to the keys and values of the current + * `MutableMapInterface`. */ public function filterWithKey(callable $fn): MutableMapInterface; @@ -85,7 +86,7 @@ public function filterWithKey(callable $fn): MutableMapInterface; * `MutableMapInterface` values. * * @return MutableMapInterface - a `MutableMapInterface` containing key/value pairs after - * a user-specified operation is applied. + * a user-specified operation is applied. */ public function map(callable $fn): MutableMapInterface; @@ -106,7 +107,7 @@ public function map(callable $fn): MutableMapInterface; * `MutableMapInterface` keys and values. * * @return MutableMapInterface A `MutableMapInterface` containing the values after a user-specified - * operation on the current `MutableMapInterface`'s keys and values is applied. + * operation on the current `MutableMapInterface`'s keys and values is applied. */ public function mapWithKey(callable $fn): MutableMapInterface; @@ -179,7 +180,8 @@ public function linearSearch(mixed $search_value): int|string|null; * elements of this `MutableMapInterface`. * * @return MutableMapInterface - The `MutableMapInterface` that combines - * the values of the current `MutableMapInterface` with the provided `iterable`. + * the values of the current `MutableMapInterface` + * with the provided `iterable`. * * @psalm-mutation-free */ @@ -197,7 +199,7 @@ public function zip(iterable $iterable): MutableMapInterface; * @param int $n The last element that will be included in the returned `MutableMapInterface`. * * @return MutableMapInterface A `MutableMapInterface` that is a proper subset of the current - * `MutableMapInterface` up to `n` elements. + * `MutableMapInterface` up to `n` elements. * * @psalm-mutation-free */ @@ -214,7 +216,7 @@ public function take(int $n): MutableMapInterface; * @param (callable(Tv): bool) $fn The callback that is used to determine the stopping condition. * * @return MutableMapInterface A `MutableMapInterface` that is a proper subset of the current - * `MutableMapInterface` up until the callback returns `false`. + * `MutableMapInterface` up until the callback returns `false`. */ public function takeWhile(callable $fn): MutableMapInterface; @@ -231,7 +233,7 @@ public function takeWhile(callable $fn): MutableMapInterface; * the returned `MutableMapInterface`. * * @return MutableMapInterface A `MutableMapInterface` that is a proper subset of the current - * `MutableMapInterface` containing values after the specified `n`-th element. + * `MutableMapInterface` containing values after the specified `n`-th element. * * @psalm-mutation-free */ @@ -249,7 +251,7 @@ public function drop(int $n): MutableMapInterface; * returned `MutableMapInterface`. * * @return MutableMapInterface A `MutableMapInterface` that is a proper subset of the current - * `MutableMapInterface` starting after the callback returns `true`. + * `MutableMapInterface` starting after the callback returns `true`. */ public function dropWhile(callable $fn): MutableMapInterface; @@ -269,8 +271,8 @@ public function dropWhile(callable $fn): MutableMapInterface; * @param int $length The length of the returned `MutableMapInterface`. * * @return MutableMapInterface - A `MutableMapInterface` that is a proper subset of the current - * `MutableMapInterface` starting at `$start` up to but not including - * the element `$start + $length`. + * `MutableMapInterface` starting at `$start` up to but not including + * the element `$start + $length`. * * @psalm-mutation-free */ diff --git a/src/Psl/Collection/MutableVector.php b/src/Psl/Collection/MutableVector.php index f07772ad..f80da5ed 100644 --- a/src/Psl/Collection/MutableVector.php +++ b/src/Psl/Collection/MutableVector.php @@ -482,7 +482,7 @@ public function mapWithKey(callable $fn): MutableVector * elements of this `MutableVector`. * * @return MutableVector The `MutableVector` that combines the values of the current - * `MutableVector` with the provided `iterable`. + * `MutableVector` with the provided `iterable`. * * @psalm-mutation-free */ diff --git a/src/Psl/Collection/MutableVectorInterface.php b/src/Psl/Collection/MutableVectorInterface.php index 0c22bfaa..6dddd6e4 100644 --- a/src/Psl/Collection/MutableVectorInterface.php +++ b/src/Psl/Collection/MutableVectorInterface.php @@ -189,8 +189,8 @@ public function linearSearch(mixed $search_value): ?int; * elements of this `MutableVectorInterface`. * * @return MutableVectorInterface - The `MutableVectorInterface` that combines the - * values of the current `MutableVectorInterface` with the provided - * `iterable`. + * values of the current `MutableVectorInterface` with + * the provided `iterable`. * * @psalm-mutation-free */ diff --git a/src/Psl/Collection/Vector.php b/src/Psl/Collection/Vector.php index 8ed2b60e..c1c05bd5 100644 --- a/src/Psl/Collection/Vector.php +++ b/src/Psl/Collection/Vector.php @@ -364,7 +364,7 @@ public function mapWithKey(callable $fn): Vector * elements of this `VectorInterface`. * * @return Vector The `Vector` that combines the values of the current - * `Vector` with the provided `iterable`. + * `Vector` with the provided `iterable`. * * @psalm-mutation-free */ diff --git a/src/Psl/Collection/VectorInterface.php b/src/Psl/Collection/VectorInterface.php index 59f70cc1..0945a656 100644 --- a/src/Psl/Collection/VectorInterface.php +++ b/src/Psl/Collection/VectorInterface.php @@ -217,7 +217,7 @@ public function linearSearch(mixed $search_value): ?int; * elements of this `VectorInterface`. * * @return VectorInterface The `VectorInterface` that combines the values - * of the current `VectorInterface` with the provided `iterable`. + * of the current `VectorInterface` with the provided `iterable`. * * @psalm-mutation-free */ diff --git a/src/Psl/Shell/Exception/FailedExecutionException.php b/src/Psl/Shell/Exception/FailedExecutionException.php index daae4ae2..c8f851ab 100644 --- a/src/Psl/Shell/Exception/FailedExecutionException.php +++ b/src/Psl/Shell/Exception/FailedExecutionException.php @@ -15,6 +15,9 @@ final class FailedExecutionException extends RuntimeException private string $stdoutContent; private string $stderrContent; + /** + * @psalm-suppress MissingThrowsDocblock + */ public function __construct(string $command, string $stdout_content, string $stderr_content, int $code) { $message = Str\format( @@ -29,9 +32,7 @@ public function __construct(string $command, string $stdout_content, string $std MESSAGE, $command, $code, - /** @psalm-suppress MissingThrowsDocblock */ Str\replace($stdout_content, PHP_EOL, PHP_EOL . " "), - /** @psalm-suppress MissingThrowsDocblock */ Str\replace($stderr_content, PHP_EOL, PHP_EOL . " "), ); diff --git a/src/Psl/Str/Byte/words.php b/src/Psl/Str/Byte/words.php index 78eb280c..27335075 100644 --- a/src/Psl/Str/Byte/words.php +++ b/src/Psl/Str/Byte/words.php @@ -12,7 +12,7 @@ * @param string|null $characters_list A list of additional characters which will be considered as 'word' * * @return array a dict, where the key is the numeric position of - * the word inside the string and the value is the actual word itself + * the word inside the string and the value is the actual word itself * * @pure */