From 2bab944c23f3366ca3f99b0c7e6760f2b97e42df Mon Sep 17 00:00:00 2001 From: Oliver Klee Date: Tue, 13 Feb 2024 10:17:04 +0100 Subject: [PATCH] [TASK] Add visibility to all class/interface constants This is a pre-patch to switching to the PER2 coding standard. --- CHANGELOG.md | 2 ++ src/Parsing/ParserState.php | 2 +- src/Property/AtRule.php | 4 ++-- src/Property/KeyframeSelector.php | 2 +- src/Property/Selector.php | 6 +++--- src/Value/CalcFunction.php | 4 ++-- src/Value/Size.php | 6 +++--- tests/OutputFormatTest.php | 2 +- 8 files changed, 15 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1dc542d6..eeddf48e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ This project adheres to [Semantic Versioning](https://semver.org/). ### Changed +- Add visibility to all class/interface constants (#469) + ### Deprecated ### Removed diff --git a/src/Parsing/ParserState.php b/src/Parsing/ParserState.php index 7a99f327..b60e0e06 100644 --- a/src/Parsing/ParserState.php +++ b/src/Parsing/ParserState.php @@ -10,7 +10,7 @@ class ParserState /** * @var null */ - const EOF = null; + public const EOF = null; /** * @var Settings diff --git a/src/Property/AtRule.php b/src/Property/AtRule.php index 9536ff5e..df09b5fa 100644 --- a/src/Property/AtRule.php +++ b/src/Property/AtRule.php @@ -13,14 +13,14 @@ interface AtRule extends Renderable, Commentable * * @var string */ - const BLOCK_RULES = 'media/document/supports/region-style/font-feature-values'; + public const BLOCK_RULES = 'media/document/supports/region-style/font-feature-values'; /** * … and more font-specific ones (to be used inside font-feature-values) * * @var string */ - const SET_RULES = 'font-face/counter-style/page/swash/styleset/annotation'; + public const SET_RULES = 'font-face/counter-style/page/swash/styleset/annotation'; /** * @return string|null diff --git a/src/Property/KeyframeSelector.php b/src/Property/KeyframeSelector.php index 14ea5ebb..e44df1f9 100644 --- a/src/Property/KeyframeSelector.php +++ b/src/Property/KeyframeSelector.php @@ -9,7 +9,7 @@ class KeyframeSelector extends Selector * * @var string */ - const SELECTOR_VALIDATION_RX = '/ + public const SELECTOR_VALIDATION_RX = '/ ^( (?: [a-zA-Z0-9\x{00A0}-\x{FFFF}_^$|*="\'~\[\]()\-\s\.:#+>]* # any sequence of valid unescaped characters diff --git a/src/Property/Selector.php b/src/Property/Selector.php index 70c9b2fd..4fc734e9 100644 --- a/src/Property/Selector.php +++ b/src/Property/Selector.php @@ -13,7 +13,7 @@ class Selector * * @var string */ - const NON_ID_ATTRIBUTES_AND_PSEUDO_CLASSES_RX = '/ + private const NON_ID_ATTRIBUTES_AND_PSEUDO_CLASSES_RX = '/ (\.[\w]+) # classes | \[(\w+) # attributes @@ -37,7 +37,7 @@ class Selector * * @var string */ - const ELEMENTS_AND_PSEUDO_ELEMENTS_RX = '/ + private const ELEMENTS_AND_PSEUDO_ELEMENTS_RX = '/ ((^|[\s\+\>\~]+)[\w]+ # elements | \:{1,2}( # pseudo-elements @@ -50,7 +50,7 @@ class Selector * * @var string */ - const SELECTOR_VALIDATION_RX = '/ + public const SELECTOR_VALIDATION_RX = '/ ^( (?: [a-zA-Z0-9\x{00A0}-\x{FFFF}_^$|*="\'~\[\]()\-\s\.:#+>]* # any sequence of valid unescaped characters diff --git a/src/Value/CalcFunction.php b/src/Value/CalcFunction.php index 5ffd071f..f06d9b7e 100644 --- a/src/Value/CalcFunction.php +++ b/src/Value/CalcFunction.php @@ -11,12 +11,12 @@ class CalcFunction extends CSSFunction /** * @var int */ - const T_OPERAND = 1; + private const T_OPERAND = 1; /** * @var int */ - const T_OPERATOR = 2; + private const T_OPERATOR = 2; /** * @param ParserState $oParserState diff --git a/src/Value/Size.php b/src/Value/Size.php index 36a32381..0ef18e24 100644 --- a/src/Value/Size.php +++ b/src/Value/Size.php @@ -17,17 +17,17 @@ class Size extends PrimitiveValue * * @var array */ - const ABSOLUTE_SIZE_UNITS = ['px', 'cm', 'mm', 'mozmm', 'in', 'pt', 'pc', 'vh', 'vw', 'vmin', 'vmax', 'rem']; + private const ABSOLUTE_SIZE_UNITS = ['px', 'cm', 'mm', 'mozmm', 'in', 'pt', 'pc', 'vh', 'vw', 'vmin', 'vmax', 'rem']; /** * @var array */ - const RELATIVE_SIZE_UNITS = ['%', 'em', 'ex', 'ch', 'fr']; + private const RELATIVE_SIZE_UNITS = ['%', 'em', 'ex', 'ch', 'fr']; /** * @var array */ - const NON_SIZE_UNITS = ['deg', 'grad', 'rad', 's', 'ms', 'turn', 'Hz', 'kHz']; + private const NON_SIZE_UNITS = ['deg', 'grad', 'rad', 's', 'ms', 'turn', 'Hz', 'kHz']; /** * @var array>|null diff --git a/tests/OutputFormatTest.php b/tests/OutputFormatTest.php index dc991cab..66843eae 100644 --- a/tests/OutputFormatTest.php +++ b/tests/OutputFormatTest.php @@ -16,7 +16,7 @@ final class OutputFormatTest extends TestCase /** * @var string */ - const TEST_CSS = <<