Skip to content

Commit afc7f64

Browse files
authored
Merge pull request #268 from oliverklee/cleanup/phpdoc
2 parents d9ad684 + 36eb510 commit afc7f64

18 files changed

+103
-52
lines changed

src/CSSList/AtRuleBlockList.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use Sabberworm\CSS\Property\AtRule;
77

88
/**
9-
* A BlockList constructed by an unknown @-rule. @media rules are rendered into AtRuleBlockList objects.
9+
* A BlockList constructed by an unknown at-rule. @media rules are rendered into AtRuleBlockList objects.
1010
*/
1111
class AtRuleBlockList extends CSSBlockList implements AtRule
1212
{

src/CSSList/CSSList.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
/**
2525
* A CSSList is the most generic container available. Its contents include RuleSet as well as other CSSList objects.
26-
* Also, it may contain Import and Charset objects stemming from @-rules.
26+
* Also, it may contain Import and Charset objects stemming from at-rules.
2727
*/
2828
abstract class CSSList implements Renderable, Commentable
2929
{
@@ -180,7 +180,7 @@ private static function parseAtRule(ParserState $oParserState)
180180
}
181181
return new CSSNamespace($mUrl, $sPrefix, $iIdentifierLineNum);
182182
} else {
183-
//Unknown other at rule (font-face or such)
183+
// Unknown other at rule (font-face or such)
184184
$sArgs = trim($oParserState->consumeUntil('{', false, true));
185185
if (substr_count($sArgs, "(") != substr_count($sArgs, ")")) {
186186
if ($oParserState->getSettings()->bLenientParsing) {
@@ -282,7 +282,7 @@ public function remove($oItemToRemove)
282282
/**
283283
* Replaces an item from the CSS list.
284284
*
285-
* @param RuleSet|Import|Charset|CSSList $oItemToRemove
285+
* @param RuleSet|Import|Charset|CSSList $oOldItem
286286
* May be a RuleSet (most likely a DeclarationBlock), a Import, a Charset
287287
* or another CSSList (most likely a MediaQuery)
288288
*/

src/CSSList/Document.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
/**
1010
* The root CSSList of a parsed file. Contains all top-level css contents, mostly declaration blocks,
11-
* but also any @-rules encountered.
11+
* but also any at-rules encountered.
1212
*/
1313
class Document extends CSSBlockList
1414
{

src/Comment/Comment.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function getLineNo()
3434
}
3535

3636
/**
37-
* @return string
37+
* @param string $sComment
3838
*/
3939
public function setComment($sComment)
4040
{

src/OutputFormat.php

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,26 @@
1111
class OutputFormat
1212
{
1313
/**
14-
* Value format
14+
* Value format: `"` means double-quote, `'` means single-quote
15+
*
16+
* @var string
1517
*/
16-
// " means double-quote, ' means single-quote
1718
public $sStringQuotingType = '"';
1819

19-
// Output RGB colors in hash notation if possible
20+
/**
21+
* Output RGB colors in hash notation if possible
22+
*
23+
* @var string
24+
*/
2025
public $bRGBHashNotation = true;
2126

2227
/**
2328
* Declaration format
29+
*
30+
* Semicolon after the last rule of a declaration block can be omitted. To do that, set this false.
31+
*
32+
* @var bool
2433
*/
25-
// Semicolon after the last rule of a declaration block can be omitted. To do that, set this false.
2634
public $bSemicolonAfterLastRule = true;
2735

2836
/**
@@ -45,38 +53,57 @@ class OutputFormat
4553

4654
public $sSpaceBetweenBlocks = "\n";
4755

48-
// Content injected in and around @-rule blocks.
56+
/**
57+
* Content injected in and around at-rule blocks.
58+
*
59+
* @var string
60+
*/
4961
public $sBeforeAtRuleBlock = '';
5062

5163
public $sAfterAtRuleBlock = '';
5264

53-
// This is what’s printed before and after the comma if a declaration block contains multiple selectors.
65+
/**
66+
* This is what’s printed before and after the comma if a declaration block contains multiple selectors.
67+
*
68+
* @var string
69+
*/
5470
public $sSpaceBeforeSelectorSeparator = '';
5571

5672
public $sSpaceAfterSelectorSeparator = ' ';
5773

58-
// This is what’s printed after the comma of value lists
74+
/**
75+
* This is what’s printed after the comma of value lists
76+
*
77+
* @var string
78+
*/
5979
public $sSpaceBeforeListArgumentSeparator = '';
6080

6181
public $sSpaceAfterListArgumentSeparator = '';
6282

6383
public $sSpaceBeforeOpeningBrace = ' ';
6484

65-
// Content injected in and around declaration blocks.
85+
/**
86+
* Content injected in and around declaration blocks.
87+
*
88+
* @var string
89+
*/
6690
public $sBeforeDeclarationBlock = '';
6791

6892
public $sAfterDeclarationBlockSelectors = '';
6993

7094
public $sAfterDeclarationBlock = '';
7195

7296
/**
73-
* Indentation
97+
* Indentation character(s) per level. Only applicable if newlines are used in any of the spacing settings.
98+
*
99+
* @var string
74100
*/
75-
// Indentation character(s) per level. Only applicable if newlines are used in any of the spacing settings.
76101
public $sIndentation = "\t";
77102

78103
/**
79104
* Output exceptions.
105+
*
106+
* @var bool
80107
*/
81108
public $bIgnoreExceptions = false;
82109

src/OutputFormatter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,15 @@ public function safely($cCode)
9999
return $cCode();
100100
} catch (OutputException $e) {
101101
return null;
102-
} //Do nothing
102+
} // Do nothing
103103
} else {
104104
// Run the code as-is
105105
return $cCode();
106106
}
107107
}
108108

109109
/**
110-
* Clone of the implode function but calls ->render with the current output format instead of ` __toString()
110+
* Clone of the implode function but calls -> render with the current output format instead of `__toString()`
111111
*/
112112
public function implode($sSeparator, array $aValues, $bIncreaseLevel = false)
113113
{

src/Parser.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ class Parser
1616
private $oParserState;
1717

1818
/**
19-
* Parser constructor.
20-
* Note that that iLineNo starts from 1 and not 0
19+
* Note that that iLineNo starts from 1 and not 0.
2120
*
2221
* @param $sText
2322
* @param Settings|null $oParserSettings

src/Parsing/ParserState.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public function parseCharacter($bIsForIdentifier)
100100
}
101101
$sUnicode = $this->consumeExpression('/^[0-9a-fA-F]{1,6}/u', 6);
102102
if ($this->strlen($sUnicode) < 6) {
103-
//Consume whitespace after incomplete unicode escape
103+
// Consume whitespace after incomplete unicode escape
104104
if (preg_match('/\\s/isSu', $this->peek())) {
105105
if ($this->comes('\r\n')) {
106106
$this->consume(2);

src/Property/AtRule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ interface AtRule extends Renderable, Commentable
1010
// Since there are more set rules than block rules,
1111
// we’re whitelisting the block rules and have anything else be treated as a set rule.
1212
const BLOCK_RULES = 'media/document/supports/region-style/font-feature-values';
13-
// …and more font-specific ones (to be used inside font-feature-values)
13+
// … and more font-specific ones (to be used inside font-feature-values)
1414
const SET_RULES = 'font-face/counter-style/page/swash/styleset/annotation';
1515

1616
/**

src/Property/Import.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use Sabberworm\CSS\Value\URL;
77

88
/**
9-
* Class representing an @import rule.
9+
* Class representing an `@import` rule.
1010
*/
1111
class Import implements AtRule
1212
{

src/Property/KeyframeSelector.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@
44

55
class KeyframeSelector extends Selector
66
{
7-
//Regexes for specificity calculations
8-
7+
/**
8+
* regexp for specificity calculations
9+
*
10+
* @var string
11+
*/
912
const SELECTOR_VALIDATION_RX = '/
1013
^(
1114
(?:

src/Property/Selector.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@
88
*/
99
class Selector
1010
{
11-
//Regexes for specificity calculations
11+
/**
12+
* regexp for specificity calculations
13+
*
14+
* @var string
15+
*/
1216
const NON_ID_ATTRIBUTES_AND_PSEUDO_CLASSES_RX = '/
1317
(\.[\w]+) # classes
1418
|
@@ -28,6 +32,11 @@ class Selector
2832
))
2933
/ix';
3034

35+
/**
36+
* regexp for specificity calculations
37+
*
38+
* @var string
39+
*/
3140
const ELEMENTS_AND_PSEUDO_ELEMENTS_RX = '/
3241
((^|[\s\+\>\~]+)[\w]+ # elements
3342
|
@@ -36,6 +45,11 @@ class Selector
3645
))
3746
/ix';
3847

48+
/**
49+
* regexp for specificity calculations
50+
*
51+
* @var string
52+
*/
3953
const SELECTOR_VALIDATION_RX = '/
4054
^(
4155
(?:

src/Rule/Rule.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public function setValue($mValue)
128128

129129
/**
130130
* @deprecated Old-Style 2-dimensional array given. Retained for (some) backwards-compatibility.
131-
* Use setValue() instead and wrap the value inside a RuleValueList if necessary.
131+
* Use `setValue()` instead and wrap the value inside a RuleValueList if necessary.
132132
*/
133133
public function setValues(array $aSpaceSeparatedValues)
134134
{
@@ -165,7 +165,7 @@ public function setValues(array $aSpaceSeparatedValues)
165165

166166
/**
167167
* @deprecated Old-Style 2-dimensional array returned. Retained for (some) backwards-compatibility.
168-
* Use getValue() instead and check for the existance of a (nested set of) ValueList object(s).
168+
* Use `getValue()` instead and check for the existence of a (nested set of) ValueList object(s).
169169
*/
170170
public function getValues()
171171
{

src/RuleSet/AtRuleSet.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use Sabberworm\CSS\Property\AtRule;
77

88
/**
9-
* A RuleSet constructed by an unknown @-rule. @font-face rules are rendered into AtRuleSet objects.
9+
* A RuleSet constructed by an unknown at-rule. `@font-face` rules are rendered into AtRuleSet objects.
1010
*/
1111
class AtRuleSet extends RuleSet implements AtRule
1212
{

src/RuleSet/DeclarationBlock.php

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,9 @@ public function setSelectors($mSelector, $oList = null)
102102
}
103103
}
104104

105-
// remove one of the selector of the block
105+
/**
106+
* Remove one of the selectors of the block.
107+
*/
106108
public function removeSelector($mSelector)
107109
{
108110
if ($mSelector instanceof Selector) {
@@ -118,15 +120,15 @@ public function removeSelector($mSelector)
118120
}
119121

120122
/**
121-
* @deprecated use getSelectors()
123+
* @deprecated use `getSelectors()`
122124
*/
123125
public function getSelector()
124126
{
125127
return $this->getSelectors();
126128
}
127129

128130
/**
129-
* @deprecated use setSelectors()
131+
* @deprecated use `setSelectors()`
130132
*/
131133
public function setSelector($mSelector, $oList = null)
132134
{
@@ -214,7 +216,7 @@ public function expandBorderShorthand()
214216
} else {
215217
if (in_array($mValue, $aBorderSizes)) {
216218
$sNewRuleName = $sBorderRule . "-width";
217-
} else /* if(in_array($mValue, $aBorderStyles)) */ {
219+
} else {
218220
$sNewRuleName = $sBorderRule . "-style";
219221
}
220222
}
@@ -287,7 +289,7 @@ public function expandDimensionsShorthand()
287289

288290
/**
289291
* Convert shorthand font declarations
290-
* (e.g. <tt>font: 300 italic 11px/14px verdana, helvetica, sans-serif;</tt>)
292+
* (e.g. `font: 300 italic 11px/14px verdana, helvetica, sans-serif;`)
291293
* into their constituent parts.
292294
* */
293295
public function expandFontShorthand()
@@ -351,13 +353,13 @@ public function expandFontShorthand()
351353
$this->removeRule('font');
352354
}
353355

354-
/*
355-
* Convert shorthand background declarations
356-
* (e.g. <tt>background: url("chess.png") gray 50% repeat fixed;</tt>)
356+
/**
357+
* Converts shorthand background declarations
358+
* (e.g. `background: url("chess.png") gray 50% repeat fixed;`)
357359
* into their constituent parts.
360+
*
358361
* @see http://www.w3.org/TR/21/colors.html#propdef-background
359-
* */
360-
362+
*/
361363
public function expandBackgroundShorthand()
362364
{
363365
$aRules = $this->getRulesAssoc();
@@ -572,12 +574,11 @@ public function createBorderShorthand()
572574
$this->createShorthandProperties($aProperties, 'border');
573575
}
574576

575-
/*
577+
/**
576578
* Looks for long format CSS dimensional properties
577579
* (margin, padding, border-color, border-style and border-width)
578580
* and converts them into shorthand CSS properties.
579-
* */
580-
581+
*/
581582
public function createDimensionsShorthand()
582583
{
583584
$aPositions = ['top', 'right', 'bottom', 'left'];
@@ -645,10 +646,11 @@ public function createDimensionsShorthand()
645646
}
646647

647648
/**
648-
* Looks for long format CSS font properties (e.g. <tt>font-weight</tt>) and
649-
* tries to convert them into a shorthand CSS <tt>font</tt> property.
649+
* Looks for long format CSS font properties (e.g. `font-weight`) and
650+
* tries to convert them into a shorthand CSS `font` property.
651+
*
650652
* At least font-size AND font-family must be present in order to create a shorthand declaration.
651-
* */
653+
*/
652654
public function createFontShorthand()
653655
{
654656
$aFontProperties = [

0 commit comments

Comments
 (0)