Skip to content

Commit c76bf90

Browse files
committed
Add type annotations for Selector
1 parent ddf0daa commit c76bf90

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

src/Property/Selector.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,30 @@ class Selector
6060
)$
6161
/ux';
6262

63+
/**
64+
* @var string
65+
*/
6366
private $sSelector;
6467

68+
/**
69+
* @var int|null
70+
*/
6571
private $iSpecificity;
6672

73+
/**
74+
* @param string $sSelector
75+
*
76+
* @return bool
77+
*/
6778
public static function isValid($sSelector)
6879
{
6980
return preg_match(static::SELECTOR_VALIDATION_RX, $sSelector);
7081
}
7182

83+
/**
84+
* @param string $sSelector
85+
* @param bool $bCalculateSpecificity
86+
*/
7287
public function __construct($sSelector, $bCalculateSpecificity = false)
7388
{
7489
$this->setSelector($sSelector);
@@ -77,22 +92,36 @@ public function __construct($sSelector, $bCalculateSpecificity = false)
7792
}
7893
}
7994

95+
/**
96+
* @return string
97+
*/
8098
public function getSelector()
8199
{
82100
return $this->sSelector;
83101
}
84102

103+
/**
104+
* @param string $sSelector
105+
*
106+
* @return void
107+
*/
85108
public function setSelector($sSelector)
86109
{
87110
$this->sSelector = trim($sSelector);
88111
$this->iSpecificity = null;
89112
}
90113

114+
/**
115+
* @return string
116+
*/
91117
public function __toString()
92118
{
93119
return $this->getSelector();
94120
}
95121

122+
/**
123+
* @return int
124+
*/
96125
public function getSpecificity()
97126
{
98127
if ($this->iSpecificity === null) {

0 commit comments

Comments
 (0)