Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F6004057
CustomPropertyMatcher.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
910 B
Referenced Files
None
Subscribers
None
CustomPropertyMatcher.php
View Options
<?php
/**
* @file
* @license https://opensource.org/licenses/Apache-2.0 Apache-2.0
*/
namespace
Wikimedia\CSS\Grammar
;
use
Wikimedia\CSS\Objects\ComponentValueList
;
use
Wikimedia\CSS\Objects\Token
;
/**
* Matcher that matches a custom property (a CSS variable) example --name-of-variable
*
* This utilises regex to match the custom property --[a-zA-Z][a-zA-Z0-9-] without any input validation.
*
* @see https://www.w3.org/TR/2022/CR-css-variables-1-20220616/#custom-property
*/
class
CustomPropertyMatcher
extends
Matcher
{
/** @inheritDoc */
protected
function
generateMatches
(
ComponentValueList
$values
,
$start
,
array
$options
)
{
$cv
=
$values
[
$start
]
??
null
;
if
(
$cv
instanceof
Token
&&
$cv
->
type
()
===
Token
::
T_IDENT
&&
preg_match
(
'/^
\-\-
[a-zA-Z][a-zA-Z0-9-]*$/'
,
$cv
->
value
()
)
)
{
yield
$this
->
makeMatch
(
$values
,
$start
,
$this
->
next
(
$values
,
$start
,
$options
)
);
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Oct 4 2026, 07:24 (5 w, 2 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
09/ee/8ff9e2ed33102ba657caa26b7b2f
Default Alt Text
CustomPropertyMatcher.php (910 B)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment