Skip to content

Commit 5646599

Browse files
committed
php 7 syntax
1 parent 18c3d28 commit 5646599

1 file changed

Lines changed: 12 additions & 30 deletions

File tree

src/HTMLValidator.php

Lines changed: 12 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -16,48 +16,29 @@ class HTMLValidator
1616
*/
1717
protected $options;
1818

19-
/**
20-
* @param Options $options
21-
*/
2219
public function __construct(Options $options = null)
2320
{
24-
$this->setOptions($options === null ? new Options() : $options);
21+
$this->setOptions($options ?: new Options());
2522
}
2623

27-
/**
28-
* @return Options
29-
*/
30-
public function getOptions()
24+
public function getOptions(): Options
3125
{
3226
return $this->options;
3327
}
3428

35-
/**
36-
* @param Options $options
37-
*
38-
* @return HTMLValidator
39-
*/
40-
public function setOptions(Options $options)
29+
public function setOptions(Options $options): self
4130
{
4231
$this->options = $options;
4332

4433
return $this;
4534
}
4635

47-
/**
48-
* @return string
49-
*/
50-
public function getValidatorUri()
36+
public function getValidatorUri(): string
5137
{
5238
return $this->validatorUri;
5339
}
5440

55-
/**
56-
* @param string $validatorUri
57-
*
58-
* @return HTMLValidator
59-
*/
60-
public function setValidatorUri($validatorUri)
41+
public function setValidatorUri(string $validatorUri): self
6142
{
6243
$this->validatorUri = $validatorUri;
6344

@@ -71,7 +52,7 @@ public function setValidatorUri($validatorUri)
7152
* @throws Exception
7253
* @return string
7354
*/
74-
protected function sendRequest($uri, $context = null)
55+
protected function sendRequest(string $uri, $context = null): string
7556
{
7657
$data = \file_get_contents($uri, null, $context);
7758
if ($data === false) {
@@ -89,9 +70,10 @@ protected function sendRequest($uri, $context = null)
8970
*
9071
* @param string $uri The address to the page to validate ex: http://example.com/
9172
*
73+
* @throws Exception
9274
* @return Response object HTMLValidator\Response
9375
*/
94-
public function validateUri($uri)
76+
public function validateUri(string $uri): Response
9577
{
9678
$query = \http_build_query(\array_merge(
9779
$this->getOptions()->buildOptions(),
@@ -118,10 +100,9 @@ public function validateUri($uri)
118100
* @param string $file file to be validated.
119101
*
120102
* @throws Exception
121-
*
122103
* @return Response object HTMLValidator\Response
123104
*/
124-
public function validateFile($file)
105+
public function validateFile(string $file): Response
125106
{
126107
if (\file_exists($file) !== true) {
127108
throw new Exception('File not found');
@@ -143,9 +124,10 @@ public function validateFile($file)
143124
*
144125
* @param string $html full html document fragment
145126
*
127+
* @throws Exception
146128
* @return Response object HTMLValidator\Response
147129
*/
148-
public function validateFragment($html)
130+
public function validateFragment(string $html): Response
149131
{
150132
$query = \http_build_query(\array_merge(
151133
$this->getOptions()->buildOptions(),
@@ -176,7 +158,7 @@ public function validateFragment($html)
176158
* @return Response object HTMLValidator\Response
177159
*
178160
*/
179-
protected function parseSOAP12Response($xml)
161+
protected function parseSOAP12Response(string $xml): Response
180162
{
181163
$doc = new \DOMDocument('1.0', 'UTF-8');
182164

0 commit comments

Comments
 (0)