GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Pull Request — master (#9)
by no
09:19
created
src/TagMatcher.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
 abstract class TagMatcher extends TypeSafeDiagnosingMatcher {
8 8
 
9 9
 	public function __construct() {
10
-		parent::__construct( self::TYPE_OBJECT, \DOMElement::class );
10
+		parent::__construct(self::TYPE_OBJECT, \DOMElement::class);
11 11
 	}
12 12
 
13 13
 }
Please login to merge, or discard this patch.
src/RootElementMatcher.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -18,19 +18,19 @@  discard block
 block discarded – undo
18 18
 	 *
19 19
 	 * @return static
20 20
 	 */
21
-	public static function havingRootElement( Matcher $tagMatcher = null ) {
22
-		return new static( $tagMatcher );
21
+	public static function havingRootElement(Matcher $tagMatcher = null) {
22
+		return new static($tagMatcher);
23 23
 	}
24 24
 
25
-	public function __construct( Matcher $tagMatcher = null ) {
26
-		parent::__construct( self::TYPE_OBJECT, \DOMDocument::class );
25
+	public function __construct(Matcher $tagMatcher = null) {
26
+		parent::__construct(self::TYPE_OBJECT, \DOMDocument::class);
27 27
 		$this->tagMatcher = $tagMatcher;
28 28
 	}
29 29
 
30
-	public function describeTo( Description $description ) {
31
-		$description->appendText( 'having root element ' );
32
-		if ( $this->tagMatcher ) {
33
-			$description->appendDescriptionOf( $this->tagMatcher );
30
+	public function describeTo(Description $description) {
31
+		$description->appendText('having root element ');
32
+		if ($this->tagMatcher) {
33
+			$description->appendDescriptionOf($this->tagMatcher);
34 34
 		}
35 35
 	}
36 36
 
@@ -40,27 +40,27 @@  discard block
 block discarded – undo
40 40
 	 *
41 41
 	 * @return bool
42 42
 	 */
43
-	protected function matchesSafelyWithDiagnosticDescription( $item, Description $mismatchDescription ) {
44
-		$DOMNodeList = iterator_to_array( $item->documentElement->childNodes );
43
+	protected function matchesSafelyWithDiagnosticDescription($item, Description $mismatchDescription) {
44
+		$DOMNodeList = iterator_to_array($item->documentElement->childNodes);
45 45
 
46
-		$body = array_shift( $DOMNodeList );
47
-		$DOMNodeList = iterator_to_array( $body->childNodes );
48
-		if ( count( $DOMNodeList ) > 1 ) {
46
+		$body = array_shift($DOMNodeList);
47
+		$DOMNodeList = iterator_to_array($body->childNodes);
48
+		if (count($DOMNodeList) > 1) {
49 49
 			// TODO Test this description
50
-			$mismatchDescription->appendText( 'having ' . count( $DOMNodeList ) . ' root elements ' );
50
+			$mismatchDescription->appendText('having ' . count($DOMNodeList) . ' root elements ');
51 51
 			return false;
52 52
 		}
53 53
 
54
-		$target = array_shift( $DOMNodeList );
55
-		if ( !$target ) {
54
+		$target = array_shift($DOMNodeList);
55
+		if (!$target) {
56 56
 			// TODO Reproduce?
57
-			$mismatchDescription->appendText( 'having no root elements ' );
57
+			$mismatchDescription->appendText('having no root elements ');
58 58
 			return false;
59 59
 		}
60
-		if ( $this->tagMatcher ) {
61
-			$mismatchDescription->appendText( 'root element ' );
62
-			$this->tagMatcher->describeMismatch( $target, $mismatchDescription );
63
-			return $this->tagMatcher->matches( $target );
60
+		if ($this->tagMatcher) {
61
+			$mismatchDescription->appendText('root element ');
62
+			$this->tagMatcher->describeMismatch($target, $mismatchDescription);
63
+			return $this->tagMatcher->matches($target);
64 64
 		}
65 65
 
66 66
 		return (bool)$target;
Please login to merge, or discard this patch.
src/DirectChildElementMatcher.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -13,19 +13,19 @@  discard block
 block discarded – undo
13 13
 	 */
14 14
 	private $matcher;
15 15
 
16
-	public static function havingDirectChild( Matcher $elementMatcher = null ) {
17
-		return new static( $elementMatcher );
16
+	public static function havingDirectChild(Matcher $elementMatcher = null) {
17
+		return new static($elementMatcher);
18 18
 	}
19 19
 
20
-	public function __construct( Matcher $matcher = null ) {
21
-		parent::__construct( \DOMNode::class );
20
+	public function __construct(Matcher $matcher = null) {
21
+		parent::__construct(\DOMNode::class);
22 22
 		$this->matcher = $matcher;
23 23
 	}
24 24
 
25
-	public function describeTo( Description $description ) {
26
-		$description->appendText( 'having direct child ' );
27
-		if ( $this->matcher ) {
28
-			$description->appendDescriptionOf( $this->matcher );
25
+	public function describeTo(Description $description) {
26
+		$description->appendText('having direct child ');
27
+		if ($this->matcher) {
28
+			$description->appendDescriptionOf($this->matcher);
29 29
 		}
30 30
 	}
31 31
 
@@ -35,36 +35,36 @@  discard block
 block discarded – undo
35 35
 	 *
36 36
 	 * @return bool
37 37
 	 */
38
-	protected function matchesSafelyWithDiagnosticDescription( $item, Description $mismatchDescription ) {
39
-		if ( $item instanceof \DOMDocument ) {
40
-			$directChildren = iterator_to_array( $item->documentElement->childNodes );
38
+	protected function matchesSafelyWithDiagnosticDescription($item, Description $mismatchDescription) {
39
+		if ($item instanceof \DOMDocument) {
40
+			$directChildren = iterator_to_array($item->documentElement->childNodes);
41 41
 
42
-			$body = array_shift( $directChildren );
42
+			$body = array_shift($directChildren);
43 43
 			$directChildren = $body->childNodes;
44 44
 		} else {
45 45
 			$directChildren = $item->childNodes;
46 46
 		}
47 47
 
48
-		if ( $directChildren->length === 0 ) {
49
-			$mismatchDescription->appendText( 'with no direct children' );
48
+		if ($directChildren->length === 0) {
49
+			$mismatchDescription->appendText('with no direct children');
50 50
 			return false;
51 51
 		}
52 52
 
53 53
 		$childWord = $directChildren->length === 1 ? 'child' : 'children';
54 54
 
55
-		$mismatchDescription->appendText( "with direct {$childWord} " );
55
+		$mismatchDescription->appendText("with direct {$childWord} ");
56 56
 
57
-		if ( !$this->matcher ) {
58
-			return count( $directChildren ) !== 0;
57
+		if (!$this->matcher) {
58
+			return count($directChildren) !== 0;
59 59
 		}
60 60
 
61
-		foreach ( $directChildren as $child ) {
62
-			if ( $this->matcher && $this->matcher->matches( $child ) ) {
61
+		foreach ($directChildren as $child) {
62
+			if ($this->matcher && $this->matcher->matches($child)) {
63 63
 				return true;
64 64
 			}
65 65
 		}
66 66
 
67
-		$this->matcher->describeMismatch( $child, $mismatchDescription );
67
+		$this->matcher->describeMismatch($child, $mismatchDescription);
68 68
 
69 69
 		return false;
70 70
 	}
Please login to merge, or discard this patch.
src/XmlNodeRecursiveIterator.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -4,9 +4,9 @@  discard block
 block discarded – undo
4 4
 
5 5
 class XmlNodeRecursiveIterator extends \ArrayIterator {
6 6
 
7
-	public function __construct( \DOMNodeList $nodeList ) {
8
-		$queue = $this->addElementsToQueue( [], $nodeList );
9
-		parent::__construct( $queue );
7
+	public function __construct(\DOMNodeList $nodeList) {
8
+		$queue = $this->addElementsToQueue([], $nodeList);
9
+		parent::__construct($queue);
10 10
 	}
11 11
 
12 12
 	/**
@@ -15,12 +15,12 @@  discard block
 block discarded – undo
15 15
 	 *
16 16
 	 * @return \DOMNode[] New queue
17 17
 	 */
18
-	private function addElementsToQueue( array $queue, \DOMNodeList $nodeList ) {
18
+	private function addElementsToQueue(array $queue, \DOMNodeList $nodeList) {
19 19
 		/** @var \DOMNode $node */
20
-		foreach ( $nodeList as $node ) {
20
+		foreach ($nodeList as $node) {
21 21
 			$queue[] = $node;
22
-			if ( $node->childNodes !== null ) {
23
-				$queue = $this->addElementsToQueue( $queue, $node->childNodes );
22
+			if ($node->childNodes !== null) {
23
+				$queue = $this->addElementsToQueue($queue, $node->childNodes);
24 24
 			}
25 25
 		}
26 26
 
Please login to merge, or discard this patch.
src/HtmlMatcher.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -24,61 +24,61 @@  discard block
 block discarded – undo
24 24
 	 *
25 25
 	 * @return self
26 26
 	 */
27
-	public static function htmlPiece( Matcher $elementMatcher = null ) {
28
-		return new static( $elementMatcher );
27
+	public static function htmlPiece(Matcher $elementMatcher = null) {
28
+		return new static($elementMatcher);
29 29
 	}
30 30
 
31
-	private function __construct( Matcher $elementMatcher = null ) {
31
+	private function __construct(Matcher $elementMatcher = null) {
32 32
 		$this->elementMatcher = $elementMatcher;
33 33
 	}
34 34
 
35
-	public function describeTo( Description $description ) {
36
-		$description->appendText( 'valid html piece ' );
37
-		if ( $this->elementMatcher ) {
38
-			$description->appendDescriptionOf( $this->elementMatcher );
35
+	public function describeTo(Description $description) {
36
+		$description->appendText('valid html piece ');
37
+		if ($this->elementMatcher) {
38
+			$description->appendDescriptionOf($this->elementMatcher);
39 39
 		}
40 40
 	}
41 41
 
42
-	protected function matchesWithDiagnosticDescription( $html, Description $mismatchDescription ) {
43
-		$internalErrors = libxml_use_internal_errors( true );
42
+	protected function matchesWithDiagnosticDescription($html, Description $mismatchDescription) {
43
+		$internalErrors = libxml_use_internal_errors(true);
44 44
 		$document = new \DOMDocument();
45 45
 
46
-		$html = $this->escapeScriptTagContents( $html );
46
+		$html = $this->escapeScriptTagContents($html);
47 47
 
48
-		if ( !@$document->loadHTML( mb_convert_encoding( $html, 'HTML-ENTITIES', 'UTF-8' ) ) ) {
49
-			$mismatchDescription->appendText( 'there was some parsing error' );
48
+		if (!@$document->loadHTML(mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8'))) {
49
+			$mismatchDescription->appendText('there was some parsing error');
50 50
 			return false;
51 51
 		}
52 52
 
53 53
 		$errors = libxml_get_errors();
54 54
 		libxml_clear_errors();
55
-		libxml_use_internal_errors( $internalErrors );
55
+		libxml_use_internal_errors($internalErrors);
56 56
 
57 57
 		$result = true;
58 58
 		/** @var \LibXMLError $error */
59
-		foreach ( $errors as $error ) {
60
-			if ( $this->isUnknownTagError( $error ) ) {
59
+		foreach ($errors as $error) {
60
+			if ($this->isUnknownTagError($error)) {
61 61
 				continue;
62 62
 			}
63 63
 
64
-			$mismatchDescription->appendText( 'there was parsing error: ' )
65
-				->appendText( trim( $error->message ) )
66
-				->appendText( ' on line ' )
67
-				->appendText( $error->line );
64
+			$mismatchDescription->appendText('there was parsing error: ')
65
+				->appendText(trim($error->message))
66
+				->appendText(' on line ')
67
+				->appendText($error->line);
68 68
 			$result = false;
69 69
 		}
70 70
 
71
-		if ( $result === false ) {
71
+		if ($result === false) {
72 72
 			return $result;
73 73
 		}
74
-		$mismatchDescription->appendText( 'valid html piece ' );
74
+		$mismatchDescription->appendText('valid html piece ');
75 75
 
76
-		if ( $this->elementMatcher ) {
77
-			$result = $this->elementMatcher->matches( $document );
78
-			$this->elementMatcher->describeMismatch( $document, $mismatchDescription );
76
+		if ($this->elementMatcher) {
77
+			$result = $this->elementMatcher->matches($document);
78
+			$this->elementMatcher->describeMismatch($document, $mismatchDescription);
79 79
 		}
80 80
 
81
-		$mismatchDescription->appendText( "\nActual html:\n" )->appendText( $html );
81
+		$mismatchDescription->appendText("\nActual html:\n")->appendText($html);
82 82
 
83 83
 		return $result;
84 84
 	}
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	 *
89 89
 	 * @return bool
90 90
 	 */
91
-	private function isUnknownTagError( \LibXMLError $error ) {
91
+	private function isUnknownTagError(\LibXMLError $error) {
92 92
 		return $error->code === self::XML_UNKNOWN_TAG_ERROR_CODE;
93 93
 	}
94 94
 
@@ -97,10 +97,10 @@  discard block
 block discarded – undo
97 97
 	 *
98 98
 	 * @return string HTML
99 99
 	 */
100
-	private function escapeScriptTagContents( $html ) {
101
-		return preg_replace_callback( '#(<script.*>)(.*)(</script>)#isU', function ( $matches ) {
102
-			return $matches[1] . str_replace( '</', '<\/', $matches[2] ) . $matches[3];
103
-		}, $html );
100
+	private function escapeScriptTagContents($html) {
101
+		return preg_replace_callback('#(<script.*>)(.*)(</script>)#isU', function($matches) {
102
+			return $matches[1] . str_replace('</', '<\/', $matches[2]) . $matches[3];
103
+		}, $html);
104 104
 	}
105 105
 
106 106
 }
Please login to merge, or discard this patch.
src/functions.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -2,88 +2,88 @@
 block discarded – undo
2 2
 
3 3
 use Hamcrest\Matcher;
4 4
 
5
-if ( !function_exists( 'htmlPiece' ) ) {
5
+if (!function_exists('htmlPiece')) {
6 6
 	/**
7 7
 	 * @param Matcher|null $elementMatcher
8 8
 	 *
9 9
 	 * @return \WMDE\HamcrestHtml\HtmlMatcher
10 10
 	 */
11
-	function htmlPiece( Matcher $elementMatcher = null ) {
12
-		return \WMDE\HamcrestHtml\HtmlMatcher::htmlPiece( $elementMatcher );
11
+	function htmlPiece(Matcher $elementMatcher = null) {
12
+		return \WMDE\HamcrestHtml\HtmlMatcher::htmlPiece($elementMatcher);
13 13
 	}
14 14
 }
15 15
 
16
-if ( !function_exists( 'havingRootElement' ) ) {
17
-	function havingRootElement( Matcher $matcher = null ) {
18
-		return \WMDE\HamcrestHtml\RootElementMatcher::havingRootElement( $matcher );
16
+if (!function_exists('havingRootElement')) {
17
+	function havingRootElement(Matcher $matcher = null) {
18
+		return \WMDE\HamcrestHtml\RootElementMatcher::havingRootElement($matcher);
19 19
 	}
20 20
 }
21 21
 
22
-if ( !function_exists( 'havingDirectChild' ) ) {
23
-	function havingDirectChild( Matcher $elementMatcher = null ) {
24
-		return \WMDE\HamcrestHtml\DirectChildElementMatcher::havingDirectChild( $elementMatcher );
22
+if (!function_exists('havingDirectChild')) {
23
+	function havingDirectChild(Matcher $elementMatcher = null) {
24
+		return \WMDE\HamcrestHtml\DirectChildElementMatcher::havingDirectChild($elementMatcher);
25 25
 	}
26 26
 }
27 27
 
28
-if ( !function_exists( 'havingChild' ) ) {
29
-	function havingChild( Matcher $elementMatcher = null ) {
30
-		return \WMDE\HamcrestHtml\ChildElementMatcher::havingChild( $elementMatcher );
28
+if (!function_exists('havingChild')) {
29
+	function havingChild(Matcher $elementMatcher = null) {
30
+		return \WMDE\HamcrestHtml\ChildElementMatcher::havingChild($elementMatcher);
31 31
 	}
32 32
 }
33 33
 
34
-if ( !function_exists( 'withTagName' ) ) {
34
+if (!function_exists('withTagName')) {
35 35
 	/**
36 36
 	 * @param Matcher|string $tagName
37 37
 	 *
38 38
 	 * @return \WMDE\HamcrestHtml\TagNameMatcher
39 39
 	 */
40
-	function withTagName( $tagName ) {
41
-		return \WMDE\HamcrestHtml\TagNameMatcher::withTagName( $tagName );
40
+	function withTagName($tagName) {
41
+		return \WMDE\HamcrestHtml\TagNameMatcher::withTagName($tagName);
42 42
 	}
43 43
 }
44 44
 
45
-if ( !function_exists( 'withAttribute' ) ) {
45
+if (!function_exists('withAttribute')) {
46 46
 	/**
47 47
 	 * @param Matcher|string $attributeName
48 48
 	 *
49 49
 	 * @return \WMDE\HamcrestHtml\AttributeMatcher
50 50
 	 */
51
-	function withAttribute( $attributeName ) {
52
-		return \WMDE\HamcrestHtml\AttributeMatcher::withAttribute( $attributeName );
51
+	function withAttribute($attributeName) {
52
+		return \WMDE\HamcrestHtml\AttributeMatcher::withAttribute($attributeName);
53 53
 	}
54 54
 }
55 55
 
56
-if ( !function_exists( 'withClass' ) ) {
56
+if (!function_exists('withClass')) {
57 57
 	/**
58 58
 	 * @param Matcher|string $class
59 59
 	 *
60 60
 	 * @return \WMDE\HamcrestHtml\ClassMatcher
61 61
 	 */
62
-	function withClass( $class ) {
62
+	function withClass($class) {
63 63
 		// TODO don't allow to call with empty string
64 64
 
65
-		return \WMDE\HamcrestHtml\ClassMatcher::withClass( $class );
65
+		return \WMDE\HamcrestHtml\ClassMatcher::withClass($class);
66 66
 	}
67 67
 }
68 68
 
69
-if ( !function_exists( 'havingTextContents' ) ) {
69
+if (!function_exists('havingTextContents')) {
70 70
 	/**
71 71
 	 * @param Matcher|string $text
72 72
 	 *
73 73
 	 * @return \WMDE\HamcrestHtml\TextContentsMatcher
74 74
 	 */
75
-	function havingTextContents( $text ) {
76
-		return \WMDE\HamcrestHtml\TextContentsMatcher::havingTextContents( $text );
75
+	function havingTextContents($text) {
76
+		return \WMDE\HamcrestHtml\TextContentsMatcher::havingTextContents($text);
77 77
 	}
78 78
 }
79 79
 
80
-if ( !function_exists( 'tagMatchingOutline' ) ) {
80
+if (!function_exists('tagMatchingOutline')) {
81 81
 	/**
82 82
 	 * @param string $htmlOutline
83 83
 	 *
84 84
 	 * @return \WMDE\HamcrestHtml\ComplexTagMatcher
85 85
 	 */
86
-	function tagMatchingOutline( $htmlOutline ) {
87
-		return \WMDE\HamcrestHtml\ComplexTagMatcher::tagMatchingOutline( $htmlOutline );
86
+	function tagMatchingOutline($htmlOutline) {
87
+		return \WMDE\HamcrestHtml\ComplexTagMatcher::tagMatchingOutline($htmlOutline);
88 88
 	}
89 89
 }
Please login to merge, or discard this patch.
src/ClassMatcher.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -17,24 +17,24 @@  discard block
 block discarded – undo
17 17
 	 *
18 18
 	 * @return self
19 19
 	 */
20
-	public static function withClass( $class ) {
21
-		return new static( $class );
20
+	public static function withClass($class) {
21
+		return new static($class);
22 22
 	}
23 23
 
24 24
 	/**
25 25
 	 * @param Matcher|string $class
26 26
 	 */
27
-	public function __construct( $class ) {
27
+	public function __construct($class) {
28 28
 		parent::__construct();
29 29
 		$this->classMatcher = $class;
30 30
 	}
31 31
 
32
-	public function describeTo( Description $description ) {
33
-		$description->appendText( 'with class ' );
34
-		if ( $this->classMatcher instanceof Matcher ) {
35
-			$description->appendDescriptionOf( $this->classMatcher );
32
+	public function describeTo(Description $description) {
33
+		$description->appendText('with class ');
34
+		if ($this->classMatcher instanceof Matcher) {
35
+			$description->appendDescriptionOf($this->classMatcher);
36 36
 		} else {
37
-			$description->appendValue( $this->classMatcher );
37
+			$description->appendValue($this->classMatcher);
38 38
 		}
39 39
 	}
40 40
 
@@ -44,19 +44,19 @@  discard block
 block discarded – undo
44 44
 	 *
45 45
 	 * @return bool
46 46
 	 */
47
-	protected function matchesSafelyWithDiagnosticDescription( $item, Description $mismatchDescription ) {
48
-		$classAttribute = $item->getAttribute( 'class' );
47
+	protected function matchesSafelyWithDiagnosticDescription($item, Description $mismatchDescription) {
48
+		$classAttribute = $item->getAttribute('class');
49 49
 
50
-		if ( $this->classMatcher instanceof Matcher ) {
51
-			$classes = preg_split( '/\s+/u', $classAttribute );
52
-			foreach ( $classes as $class ) {
53
-				if ( $this->classMatcher->matches( $class ) ) {
50
+		if ($this->classMatcher instanceof Matcher) {
51
+			$classes = preg_split('/\s+/u', $classAttribute);
52
+			foreach ($classes as $class) {
53
+				if ($this->classMatcher->matches($class)) {
54 54
 					return true;
55 55
 				}
56 56
 			}
57 57
 			return false;
58 58
 		} else {
59
-			return (bool)preg_match( '/(^|\s)' . preg_quote( $this->classMatcher, '/' ) . '(\s|$)/u', $classAttribute );
59
+			return (bool)preg_match('/(^|\s)' . preg_quote($this->classMatcher, '/') . '(\s|$)/u', $classAttribute);
60 60
 		}
61 61
 	}
62 62
 
Please login to merge, or discard this patch.
src/AttributeMatcher.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -22,14 +22,14 @@  discard block
 block discarded – undo
22 22
 	 *
23 23
 	 * @return self
24 24
 	 */
25
-	public static function withAttribute( $attributeName ) {
26
-		return new static( $attributeName );
25
+	public static function withAttribute($attributeName) {
26
+		return new static($attributeName);
27 27
 	}
28 28
 
29 29
 	/**
30 30
 	 * @param Matcher|string $attributeNameMatcher
31 31
 	 */
32
-	public function __construct( $attributeNameMatcher ) {
32
+	public function __construct($attributeNameMatcher) {
33 33
 		parent::__construct();
34 34
 
35 35
 		$this->attributeNameMatcher = $attributeNameMatcher;
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	 *
41 41
 	 * @return AttributeMatcher
42 42
 	 */
43
-	public function havingValue( $value ) {
43
+	public function havingValue($value) {
44 44
 		// TODO: Throw exception if value is set
45 45
 		$result = clone $this;
46 46
 		$result->valueMatcher = $value;
@@ -48,19 +48,19 @@  discard block
 block discarded – undo
48 48
 		return $result;
49 49
 	}
50 50
 
51
-	public function describeTo( Description $description ) {
52
-		$description->appendText( 'with attribute ' );
53
-		if ( $this->attributeNameMatcher instanceof Matcher ) {
54
-			$description->appendDescriptionOf( $this->attributeNameMatcher );
51
+	public function describeTo(Description $description) {
52
+		$description->appendText('with attribute ');
53
+		if ($this->attributeNameMatcher instanceof Matcher) {
54
+			$description->appendDescriptionOf($this->attributeNameMatcher);
55 55
 		} else {
56
-			$description->appendValue( $this->attributeNameMatcher );
56
+			$description->appendValue($this->attributeNameMatcher);
57 57
 		}
58
-		if ( $this->valueMatcher !== null ) {
59
-			$description->appendText( ' having value ' );
60
-			if ( $this->attributeNameMatcher instanceof Matcher ) {
61
-				$description->appendDescriptionOf( $this->valueMatcher );
58
+		if ($this->valueMatcher !== null) {
59
+			$description->appendText(' having value ');
60
+			if ($this->attributeNameMatcher instanceof Matcher) {
61
+				$description->appendDescriptionOf($this->valueMatcher);
62 62
 			} else {
63
-				$description->appendValue( $this->valueMatcher );
63
+				$description->appendValue($this->valueMatcher);
64 64
 			}
65 65
 		}
66 66
 	}
@@ -71,33 +71,33 @@  discard block
 block discarded – undo
71 71
 	 *
72 72
 	 * @return bool
73 73
 	 */
74
-	protected function matchesSafelyWithDiagnosticDescription( $item, Description $mismatchDescription ) {
75
-		if ( $this->valueMatcher === null ) {
76
-			if ( $this->attributeNameMatcher instanceof Matcher ) {
74
+	protected function matchesSafelyWithDiagnosticDescription($item, Description $mismatchDescription) {
75
+		if ($this->valueMatcher === null) {
76
+			if ($this->attributeNameMatcher instanceof Matcher) {
77 77
 				/** @var \DOMAttr $attribute */
78
-				foreach ( $item->attributes as $attribute ) {
79
-					if ( $this->attributeNameMatcher->matches( $attribute->name ) ) {
78
+				foreach ($item->attributes as $attribute) {
79
+					if ($this->attributeNameMatcher->matches($attribute->name)) {
80 80
 						return true;
81 81
 					}
82 82
 				}
83 83
 			} else {
84
-				return $item->hasAttribute( $this->attributeNameMatcher );
84
+				return $item->hasAttribute($this->attributeNameMatcher);
85 85
 			}
86 86
 		} else {
87
-			if ( $this->attributeNameMatcher instanceof Matcher ) {
88
-				if ( $this->valueMatcher instanceof Matcher ) {
87
+			if ($this->attributeNameMatcher instanceof Matcher) {
88
+				if ($this->valueMatcher instanceof Matcher) {
89 89
 					/** @var \DOMAttr $attribute */
90
-					foreach ( $item->attributes as $attribute ) {
91
-						if ( $this->attributeNameMatcher->matches( $attribute->name )
92
-							&& $this->valueMatcher->matches( $attribute->value )
90
+					foreach ($item->attributes as $attribute) {
91
+						if ($this->attributeNameMatcher->matches($attribute->name)
92
+							&& $this->valueMatcher->matches($attribute->value)
93 93
 						) {
94 94
 							return true;
95 95
 						}
96 96
 					}
97 97
 				} else {
98 98
 					/** @var \DOMAttr $attribute */
99
-					foreach ( $item->attributes as $attribute ) {
100
-						if ( $this->attributeNameMatcher->matches( $attribute->name )
99
+					foreach ($item->attributes as $attribute) {
100
+						if ($this->attributeNameMatcher->matches($attribute->name)
101 101
 							&& $attribute->value === $this->valueMatcher
102 102
 						) {
103 103
 							return true;
@@ -105,11 +105,11 @@  discard block
 block discarded – undo
105 105
 					}
106 106
 				}
107 107
 			} else {
108
-				if ( $this->valueMatcher instanceof Matcher ) {
109
-					return $item->hasAttribute( $this->attributeNameMatcher )
110
-						&& $this->valueMatcher->matches( $item->getAttribute( $this->attributeNameMatcher ) );
108
+				if ($this->valueMatcher instanceof Matcher) {
109
+					return $item->hasAttribute($this->attributeNameMatcher)
110
+						&& $this->valueMatcher->matches($item->getAttribute($this->attributeNameMatcher));
111 111
 				} else {
112
-					return $item->getAttribute( $this->attributeNameMatcher ) === $this->valueMatcher;
112
+					return $item->getAttribute($this->attributeNameMatcher) === $this->valueMatcher;
113 113
 				}
114 114
 			}
115 115
 		}
Please login to merge, or discard this patch.
src/TagNameMatcher.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -17,24 +17,24 @@  discard block
 block discarded – undo
17 17
 	 *
18 18
 	 * @return self
19 19
 	 */
20
-	public static function withTagName( $tagName ) {
21
-		return new static( $tagName );
20
+	public static function withTagName($tagName) {
21
+		return new static($tagName);
22 22
 	}
23 23
 
24 24
 	/**
25 25
 	 * @param Matcher|string $tagNameMatcher
26 26
 	 */
27
-	public function __construct( $tagNameMatcher ) {
27
+	public function __construct($tagNameMatcher) {
28 28
 		parent::__construct();
29 29
 		$this->tagNameMatcher = $tagNameMatcher;
30 30
 	}
31 31
 
32
-	public function describeTo( Description $description ) {
33
-		$description->appendText( 'with tag name ' );
34
-		if ( $this->tagNameMatcher instanceof Matcher ) {
35
-			$description->appendDescriptionOf( $this->tagNameMatcher );
32
+	public function describeTo(Description $description) {
33
+		$description->appendText('with tag name ');
34
+		if ($this->tagNameMatcher instanceof Matcher) {
35
+			$description->appendDescriptionOf($this->tagNameMatcher);
36 36
 		} else {
37
-			$description->appendValue( $this->tagNameMatcher );
37
+			$description->appendValue($this->tagNameMatcher);
38 38
 		}
39 39
 	}
40 40
 
@@ -44,22 +44,22 @@  discard block
 block discarded – undo
44 44
 	 *
45 45
 	 * @return bool
46 46
 	 */
47
-	protected function matchesSafelyWithDiagnosticDescription( $item, Description $mismatchDescription ) {
48
-		if ( $this->tagNameMatcher instanceof Matcher ) {
49
-			if ( $this->tagNameMatcher->matches( $item->tagName ) ) {
47
+	protected function matchesSafelyWithDiagnosticDescription($item, Description $mismatchDescription) {
48
+		if ($this->tagNameMatcher instanceof Matcher) {
49
+			if ($this->tagNameMatcher->matches($item->tagName)) {
50 50
 				return true;
51 51
 			}
52 52
 		} else {
53
-			if ( $item->tagName === $this->tagNameMatcher ) {
53
+			if ($item->tagName === $this->tagNameMatcher) {
54 54
 				return true;
55 55
 			}
56 56
 		}
57 57
 
58
-		$mismatchDescription->appendText( 'tag name ' );
59
-		if ( $this->tagNameMatcher instanceof Matcher ) {
60
-			$this->tagNameMatcher->describeMismatch( $item->tagName, $mismatchDescription );
58
+		$mismatchDescription->appendText('tag name ');
59
+		if ($this->tagNameMatcher instanceof Matcher) {
60
+			$this->tagNameMatcher->describeMismatch($item->tagName, $mismatchDescription);
61 61
 		} else {
62
-			$mismatchDescription->appendText( 'was ' )->appendValue( $item->tagName );
62
+			$mismatchDescription->appendText('was ')->appendValue($item->tagName);
63 63
 		}
64 64
 		return false;
65 65
 	}
Please login to merge, or discard this patch.