Skip to content

Commit 26605ef

Browse files
calcinaibighappyface
authored andcommitted
Return points, spelling and dead code (#304)
* Clarity and consistency of return points * Spelling * Removed unused declarations and vars * Updated tests * Reverted return point change and updated test
1 parent 2128f9d commit 26605ef

File tree

7 files changed

+9
-8
lines changed

7 files changed

+9
-8
lines changed

bin/validate-json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ function getUrlFromPath($path)
6565
/**
6666
* Take a HTTP header value and split it up into parts.
6767
*
68+
* @param $headerValue
6869
* @return array Key "_value" contains the main value, all others
6970
* as given in the header value
7071
*/

src/JsonSchema/Constraints/EnumConstraint.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
*/
99

1010
namespace JsonSchema\Constraints;
11-
use JsonSchema\Validator;
1211
use JsonSchema\Entity\JsonPointer;
1312

1413
/**

src/JsonSchema/Constraints/ObjectConstraint.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public function validateElement($element, $matches, $objectDefinition = null, Js
117117
*
118118
* @param \stdClass $element Element to validate
119119
* @param \stdClass $objectDefinition ObjectConstraint definition
120-
* @param JsoinPointer|null $path Path?
120+
* @param JsonPointer|null $path Path?
121121
*/
122122
public function validateDefinition($element, $objectDefinition = null, JsonPointer $path = null)
123123
{

src/JsonSchema/Constraints/TypeConstraint.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,9 @@ public function check($value = null, $schema = null, JsonPointer $path = null, $
7171
*
7272
* @param mixed $value Value to validate
7373
* @param array $type TypeConstraints to check agains
74-
* @param array $wording An array of wordings of the valid types of the array $type
74+
* @param array $validTypesWording An array of wordings of the valid types of the array $type
7575
* @param boolean $isValid The current validation value
76+
* @param $path
7677
*/
7778
protected function validateTypesArray($value, array $type, &$validTypesWording, &$isValid,
7879
$path) {
@@ -111,10 +112,10 @@ protected function validateTypesArray($value, array $type, &$validTypesWording,
111112
*/
112113
protected function implodeWith(array $elements, $delimiter = ', ', $listEnd = false) {
113114
if ($listEnd === false || !isset($elements[1])) {
114-
return implode(', ', $elements);
115+
return implode($delimiter, $elements);
115116
}
116117
$lastElement = array_slice($elements, -1);
117-
$firsElements = join(', ', array_slice($elements, 0, -1));
118+
$firsElements = join($delimiter, array_slice($elements, 0, -1));
118119
$implodedElements = array_merge(array($firsElements), $lastElement);
119120
return join(" $listEnd ", $implodedElements);
120121
}

src/JsonSchema/Uri/Retrievers/AbstractRetriever.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
/**
99
* AbstractRetriever implements the default shared behavior
10-
* that all decendant Retrievers should inherit
10+
* that all descendant Retrievers should inherit
1111
* @author Steven Garcia <webwhammy@gmail.com>
1212
*/
1313
abstract class AbstractRetriever implements UriRetrieverInterface

src/JsonSchema/Uri/Retrievers/FileGetContents.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
namespace JsonSchema\Uri\Retrievers;
1111

1212
use JsonSchema\Exception\ResourceNotFoundException;
13-
use JsonSchema\Validator;
1413

1514
/**
1615
* Tries to retrieve JSON schemas from a URI using file_get_contents()
@@ -83,5 +82,7 @@ protected static function getContentTypeMatchInHeader($header)
8382
if (0 < preg_match("/Content-Type:(\V*)/ims", $header, $match)) {
8483
return trim($match[1]);
8584
}
85+
86+
return null;
8687
}
8788
}

src/JsonSchema/Validator.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
namespace JsonSchema;
1111

12-
use JsonSchema\Constraints\SchemaConstraint;
1312
use JsonSchema\Constraints\Constraint;
1413
use JsonSchema\Entity\JsonPointer;
1514

0 commit comments

Comments
 (0)