From 699462f0c97e1ec51bde9bc3a606db9119e3ea3a Mon Sep 17 00:00:00 2001 From: Benedikt Franke Date: Thu, 20 Feb 2020 12:41:30 +0000 Subject: [PATCH] Apply fixes from StyleCI --- src/Email.php | 4 ---- src/JSON.php | 12 ------------ src/Mixed.php | 10 ---------- src/Regex.php | 19 ------------------- src/StringScalar.php | 20 -------------------- src/utils.php | 11 ----------- tests/MixedTest.php | 12 ------------ tests/MyRegex.php | 2 -- tests/MyStringScalar.php | 4 ---- tests/RegexTest.php | 26 -------------------------- tests/StringScalarTest.php | 30 ------------------------------ 11 files changed, 150 deletions(-) diff --git a/src/Email.php b/src/Email.php index 3f06c68..84bba77 100644 --- a/src/Email.php +++ b/src/Email.php @@ -18,10 +18,6 @@ class Email extends StringScalar /** * Check if the given string is a valid email. - * - * @param string $stringValue - * - * @return bool */ protected function isValid(string $stringValue): bool { diff --git a/src/JSON.php b/src/JSON.php index c82356f..5dc8298 100644 --- a/src/JSON.php +++ b/src/JSON.php @@ -22,10 +22,6 @@ class JSON extends ScalarType /** * Serializes an internal value to include in a response. - * - * @param mixed $value - * - * @return string */ public function serialize($value): string { @@ -37,11 +33,8 @@ public function serialize($value): string * * In the case of an invalid value this method must throw an Exception * - * @param mixed $value * * @throws Error - * - * @return mixed */ public function parseValue($value) { @@ -57,8 +50,6 @@ public function parseValue($value) * @param mixed[]|null $variables * * @throws Exception - * - * @return mixed */ public function parseLiteral($valueNode, ?array $variables = null) { @@ -74,11 +65,8 @@ public function parseLiteral($valueNode, ?array $variables = null) /** * Try to decode a user-given value into JSON. * - * @param mixed $value * * @throws Error - * - * @return mixed */ protected function decodeJSON($value) { diff --git a/src/Mixed.php b/src/Mixed.php index eba437e..be6f99e 100644 --- a/src/Mixed.php +++ b/src/Mixed.php @@ -23,10 +23,6 @@ class Mixed extends ScalarType /** * Serializes an internal value to include in a response. - * - * @param mixed $value - * - * @return mixed */ public function serialize($value) { @@ -37,10 +33,6 @@ public function serialize($value) * Parses an externally provided value (query variable) to use as an input. * * In the case of an invalid value this method must throw an Exception - * - * @param mixed $value - * - * @return mixed */ public function parseValue($value) { @@ -56,8 +48,6 @@ public function parseValue($value) * @param mixed[]|null $variables * * @throws \Exception - * - * @return mixed */ public function parseLiteral($valueNode, ?array $variables = null) { diff --git a/src/Regex.php b/src/Regex.php index e88283d..b8c7e81 100644 --- a/src/Regex.php +++ b/src/Regex.php @@ -49,17 +49,11 @@ public static function regex(): string /** * Return the Regex that the values are validated against. - * - * @return string */ abstract public static function regex(): string; /** * Serializes an internal value to include in a response. - * - * @param mixed $value - * - * @return string */ public function serialize($value): string { @@ -76,10 +70,6 @@ public function serialize($value): string /** * Determine if the given string matches the regex defined in this class. - * - * @param string $value - * - * @return bool */ protected static function matchesRegex(string $value): bool { @@ -94,11 +84,8 @@ protected static function matchesRegex(string $value): bool /** * Parses an externally provided value (query variable) to use as an input. * - * @param mixed $value * * @throws Error - * - * @return string */ public function parseValue($value): string { @@ -120,8 +107,6 @@ public function parseValue($value): string * @param mixed[]|null $variables * * @throws Error - * - * @return string */ public function parseLiteral($valueNode, ?array $variables = null): string { @@ -139,10 +124,6 @@ public function parseLiteral($valueNode, ?array $variables = null): string /** * Construct the error message that occurs when the given string does not match the regex. - * - * @param string $value - * - * @return string */ public static function unmatchedRegexMessage(string $value): string { diff --git a/src/StringScalar.php b/src/StringScalar.php index 1497a50..67b5ae5 100644 --- a/src/StringScalar.php +++ b/src/StringScalar.php @@ -31,10 +31,6 @@ public static function make(string $name, ?string $description, callable $isVali /** * Check if the given string is a valid email. - * - * @param string $stringValue - * - * @return bool */ protected function isValid(string $stringValue): bool { @@ -51,21 +47,14 @@ protected function isValid(string $stringValue): bool /** * Check if the given string is valid. - * - * @param string $stringValue - * - * @return bool */ abstract protected function isValid(string $stringValue): bool; /** * Serializes an internal value to include in a response. * - * @param mixed $value * * @throws InvariantViolation - * - * @return string */ public function serialize($value): string { @@ -82,10 +71,6 @@ public function serialize($value): string /** * Construct an error message that occurs when an invalid string is passed. - * - * @param string $stringValue - * - * @return string */ public function invalidStringMessage(string $stringValue): string { @@ -97,11 +82,8 @@ public function invalidStringMessage(string $stringValue): string /** * Parses an externally provided value (query variable) to use as an input. * - * @param mixed $value * * @throws Error - * - * @return string */ public function parseValue($value): string { @@ -128,8 +110,6 @@ public function parseValue($value): string * @param mixed[]|null $variables * * @throws Error - * - * @return string */ public function parseLiteral($valueNode, ?array $variables = null): string { diff --git a/src/utils.php b/src/utils.php index fc1bd1c..4f29f25 100644 --- a/src/utils.php +++ b/src/utils.php @@ -10,10 +10,6 @@ /** * Check if a value can be serialized to a string. - * - * @param mixed $value - * - * @return bool */ function canBeString($value): bool { @@ -25,11 +21,8 @@ function canBeString($value): bool /** * Get the underlying string from a GraphQL literal and throw if Literal is not a string. * - * @param mixed $valueNode * * @throws Error - * - * @return string */ function extractStringFromLiteral($valueNode): string { @@ -45,12 +38,8 @@ function extractStringFromLiteral($valueNode): string /** * Convert the value to a string and throw an exception if it is not possible. * - * @param mixed $value - * @param string $exceptionClass * * @throws \Exception of type $exceptionClass - * - * @return string */ function coerceToString($value, string $exceptionClass): string { diff --git a/tests/MixedTest.php b/tests/MixedTest.php index d839a20..a5913fa 100644 --- a/tests/MixedTest.php +++ b/tests/MixedTest.php @@ -97,8 +97,6 @@ public function singleValues(): array /** * @dataProvider literalToPhpMap * - * @param string $graphQLLiteral - * @param string $jsonLiteral * @param mixed $expected */ public function testCastsValuesIntoAppropriatePhpValue(string $graphQLLiteral, string $jsonLiteral, $expected): void @@ -165,11 +163,6 @@ public function literalToPhpMap(): array ]; } - /** - * @param string $literal - * - * @return ExecutionResult - */ protected function executeQueryWithLiteral(string $literal): ExecutionResult { $query = " @@ -184,11 +177,6 @@ protected function executeQueryWithLiteral(string $literal): ExecutionResult ); } - /** - * @param string $jsonLiteral - * - * @return ExecutionResult - */ protected function executeQueryWithJsonVariable(string $jsonLiteral): ExecutionResult { $query = ' diff --git a/tests/MyRegex.php b/tests/MyRegex.php index b2859c3..567c3dc 100644 --- a/tests/MyRegex.php +++ b/tests/MyRegex.php @@ -15,8 +15,6 @@ class MyRegex extends Regex /** * Return the Regex that the values are validated against. - * - * @return string */ public static function regex(): string { diff --git a/tests/MyStringScalar.php b/tests/MyStringScalar.php index 0d27e8c..00ca231 100644 --- a/tests/MyStringScalar.php +++ b/tests/MyStringScalar.php @@ -15,10 +15,6 @@ class MyStringScalar extends StringScalar /** * Check if the given string is exactly "foo". - * - * @param string $stringValue - * - * @return bool */ protected function isValid(string $stringValue): bool { diff --git a/tests/RegexTest.php b/tests/RegexTest.php index dc4b309..c3217fd 100644 --- a/tests/RegexTest.php +++ b/tests/RegexTest.php @@ -32,8 +32,6 @@ public function regexClassProvider(): array * Return the Regex that the values are validated against. * * Must be a valid - * - * @return string */ public static function regex(): string { @@ -47,8 +45,6 @@ public static function regex(): string * Return the Regex that the values are validated against. * * Must be a valid - * - * @return string */ public static function regex(): string { @@ -67,8 +63,6 @@ public static function regex(): string /** * @dataProvider regexClassProvider - * - * @param Regex $regex */ public function testCreateNamedRegexClass(Regex $regex): void { @@ -78,8 +72,6 @@ public function testCreateNamedRegexClass(Regex $regex): void /** * @dataProvider regexClassProvider - * - * @param Regex $regex */ public function testSerializeThrowsIfUnserializableValueIsGiven(Regex $regex): void { @@ -93,8 +85,6 @@ public function testSerializeThrowsIfUnserializableValueIsGiven(Regex $regex): v /** * @dataProvider regexClassProvider - * - * @param Regex $regex */ public function testSerializeThrowsIfRegexIsNotMatched(Regex $regex): void { @@ -106,8 +96,6 @@ public function testSerializeThrowsIfRegexIsNotMatched(Regex $regex): void /** * @dataProvider regexClassProvider - * - * @param Regex $regex */ public function testSerializePassesWhenRegexMatches(Regex $regex): void { @@ -118,8 +106,6 @@ public function testSerializePassesWhenRegexMatches(Regex $regex): void /** * @dataProvider regexClassProvider - * - * @param Regex $regex */ public function testSerializePassesForStringableObject(Regex $regex): void { @@ -138,8 +124,6 @@ public function __toString(): string /** * @dataProvider regexClassProvider * - * @param Regex $regex - * * @throws Error */ public function testParseValueThrowsIfValueCantBeString(Regex $regex): void @@ -154,8 +138,6 @@ public function testParseValueThrowsIfValueCantBeString(Regex $regex): void /** * @dataProvider regexClassProvider * - * @param Regex $regex - * * @throws Error */ public function testParseValueThrowsIfValueDoesNotMatch(Regex $regex): void @@ -169,8 +151,6 @@ public function testParseValueThrowsIfValueDoesNotMatch(Regex $regex): void /** * @dataProvider regexClassProvider * - * @param Regex $regex - * * @throws Error */ public function testParseValuePassesOnMatch(Regex $regex): void @@ -184,8 +164,6 @@ public function testParseValuePassesOnMatch(Regex $regex): void /** * @dataProvider regexClassProvider * - * @param Regex $regex - * * @throws Error */ public function testParseLiteralThrowsIfNotString(Regex $regex): void @@ -199,8 +177,6 @@ public function testParseLiteralThrowsIfNotString(Regex $regex): void /** * @dataProvider regexClassProvider * - * @param Regex $regex - * * @throws Error */ public function testParseLiteralThrowsIfValueDoesNotMatch(Regex $regex): void @@ -214,8 +190,6 @@ public function testParseLiteralThrowsIfValueDoesNotMatch(Regex $regex): void /** * @dataProvider regexClassProvider * - * @param Regex $regex - * * @throws Error */ public function testParseLiteralPassesOnMatch(Regex $regex): void diff --git a/tests/StringScalarTest.php b/tests/StringScalarTest.php index 9695fdc..3b4e862 100644 --- a/tests/StringScalarTest.php +++ b/tests/StringScalarTest.php @@ -30,10 +30,6 @@ public function stringClassProvider(): array /** * Check if the given string is a valid email. - * - * @param string $stringValue - * - * @return bool */ protected function isValid(string $stringValue): bool { @@ -45,10 +41,6 @@ protected function isValid(string $stringValue): bool new class(['name' => 'MyStringScalar', 'description' => 'Bar']) extends StringScalar { /** * Check if the given string is a valid email. - * - * @param string $stringValue - * - * @return bool */ protected function isValid(string $stringValue): bool { @@ -73,8 +65,6 @@ function (string $string) { /** * @dataProvider stringClassProvider - * - * @param StringScalar $stringScalar */ public function testCreateNamedStringScalarClass(StringScalar $stringScalar): void { @@ -84,8 +74,6 @@ public function testCreateNamedStringScalarClass(StringScalar $stringScalar): vo /** * @dataProvider stringClassProvider - * - * @param StringScalar $stringScalar */ public function testSerializeThrowsIfUnserializableValueIsGiven(StringScalar $stringScalar): void { @@ -99,8 +87,6 @@ public function testSerializeThrowsIfUnserializableValueIsGiven(StringScalar $st /** * @dataProvider stringClassProvider - * - * @param StringScalar $stringScalar */ public function testSerializeThrowsIfStringScalarIsNotValid(StringScalar $stringScalar): void { @@ -112,8 +98,6 @@ public function testSerializeThrowsIfStringScalarIsNotValid(StringScalar $string /** * @dataProvider stringClassProvider - * - * @param StringScalar $stringScalar */ public function testSerializePassesWhenStringIsValid(StringScalar $stringScalar): void { @@ -124,8 +108,6 @@ public function testSerializePassesWhenStringIsValid(StringScalar $stringScalar) /** * @dataProvider stringClassProvider - * - * @param StringScalar $stringScalar */ public function testSerializePassesForStringableObject(StringScalar $stringScalar): void { @@ -144,8 +126,6 @@ public function __toString(): string /** * @dataProvider stringClassProvider * - * @param StringScalar $stringScalar - * * @throws Error */ public function testParseValueThrowsIfValueCantBeString(StringScalar $stringScalar): void @@ -160,8 +140,6 @@ public function testParseValueThrowsIfValueCantBeString(StringScalar $stringScal /** * @dataProvider stringClassProvider * - * @param StringScalar $stringScalar - * * @throws Error */ public function testParseValueThrowsIfValueDoesNotMatch(StringScalar $stringScalar): void @@ -175,8 +153,6 @@ public function testParseValueThrowsIfValueDoesNotMatch(StringScalar $stringScal /** * @dataProvider stringClassProvider * - * @param StringScalar $stringScalar - * * @throws Error */ public function testParseValuePassesOnMatch(StringScalar $stringScalar): void @@ -190,8 +166,6 @@ public function testParseValuePassesOnMatch(StringScalar $stringScalar): void /** * @dataProvider stringClassProvider * - * @param StringScalar $stringScalar - * * @throws Error */ public function testParseLiteralThrowsIfNotString(StringScalar $stringScalar): void @@ -205,8 +179,6 @@ public function testParseLiteralThrowsIfNotString(StringScalar $stringScalar): v /** * @dataProvider stringClassProvider * - * @param StringScalar $stringScalar - * * @throws Error */ public function testParseLiteralThrowsIfValueDoesNotMatch(StringScalar $stringScalar): void @@ -220,8 +192,6 @@ public function testParseLiteralThrowsIfValueDoesNotMatch(StringScalar $stringSc /** * @dataProvider stringClassProvider * - * @param StringScalar $stringScalar - * * @throws Error */ public function testParseLiteralPassesOnMatch(StringScalar $stringScalar): void