Skip to content

Commit 647f53d

Browse files
committed
Support PHP 7 by renaming the string class
1 parent c82be3f commit 647f53d

File tree

6 files changed

+18
-16
lines changed

6 files changed

+18
-16
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ php:
44
- "5.3"
55
- "5.5"
66
- "5.6"
7+
- "7.0"
8+
- "nightly"
79
- hhvm
810
script: phpunit .
911

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ If you want to manipulate a `RuleSet`, use the methods `addRule(Rule $oRule)`, `
8888

8989
* `Size` – consists of a numeric `size` value and a unit.
9090
* `Color` – colors can be input in the form #rrggbb, #rgb or schema(val1, val2, …) but are always stored as an array of ('s' => val1, 'c' => val2, 'h' => val3, …) and output in the second form.
91-
* `String` – this is just a wrapper for quoted strings to distinguish them from keywords; always output with double quotes.
91+
* `CSSString` – this is just a wrapper for quoted strings to distinguish them from keywords; always output with double quotes.
9292
* `URL` – URLs in CSS; always output in URL("") notation.
9393

9494
There is another abstract subclass of `Value`, `ValueList`. A `ValueList` represents a lists of `Value`s, separated by some separation character (mostly `,`, whitespace, or `/`). There are two types of `ValueList`s:
@@ -193,8 +193,8 @@ To see what you can do with output formatting, look at the tests in `tests/Sabbe
193193
[0]=>
194194
object(Sabberworm\CSS\Property\Charset)#6 (1) {
195195
["sCharset":"Sabberworm\CSS\Property\Charset":private]=>
196-
object(Sabberworm\CSS\Value\String)#5 (1) {
197-
["sString":"Sabberworm\CSS\Value\String":private]=>
196+
object(Sabberworm\CSS\Value\CSSString)#5 (1) {
197+
["sString":"Sabberworm\CSS\Value\CSSString":private]=>
198198
string(5) "utf-8"
199199
}
200200
}
@@ -211,8 +211,8 @@ To see what you can do with output formatting, look at the tests in `tests/Sabbe
211211
["sRule":"Sabberworm\CSS\Rule\Rule":private]=>
212212
string(11) "font-family"
213213
["mValue":"Sabberworm\CSS\Rule\Rule":private]=>
214-
object(Sabberworm\CSS\Value\String)#9 (1) {
215-
["sString":"Sabberworm\CSS\Value\String":private]=>
214+
object(Sabberworm\CSS\Value\CSSString)#9 (1) {
215+
["sString":"Sabberworm\CSS\Value\CSSString":private]=>
216216
string(10) "CrassRoots"
217217
}
218218
["bIsImportant":"Sabberworm\CSS\Rule\Rule":private]=>
@@ -228,8 +228,8 @@ To see what you can do with output formatting, look at the tests in `tests/Sabbe
228228
["mValue":"Sabberworm\CSS\Rule\Rule":private]=>
229229
object(Sabberworm\CSS\Value\URL)#11 (1) {
230230
["oURL":"Sabberworm\CSS\Value\URL":private]=>
231-
object(Sabberworm\CSS\Value\String)#12 (1) {
232-
["sString":"Sabberworm\CSS\Value\String":private]=>
231+
object(Sabberworm\CSS\Value\CSSString)#12 (1) {
232+
["sString":"Sabberworm\CSS\Value\CSSString":private]=>
233233
string(15) "../media/cr.ttf"
234234
}
235235
}
@@ -469,8 +469,8 @@ To see what you can do with output formatting, look at the tests in `tests/Sabbe
469469
[1]=>
470470
string(9) "Helvetica"
471471
[2]=>
472-
object(Sabberworm\CSS\Value\String)#14 (1) {
473-
["sString":"Sabberworm\CSS\Value\String":private]=>
472+
object(Sabberworm\CSS\Value\CSSString)#14 (1) {
473+
["sString":"Sabberworm\CSS\Value\CSSString":private]=>
474474
string(9) "Gill Sans"
475475
}
476476
[3]=>

lib/Sabberworm/CSS/CSSList/CSSBlockList.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ protected function allValues($oElement, &$aResult, $sSearchString = null, $bSear
5252
}
5353
}
5454
} else {
55-
//Non-List Value or String (CSS identifier)
55+
//Non-List Value or CSSString (CSS identifier)
5656
$aResult[] = $oElement;
5757
}
5858
}

lib/Sabberworm/CSS/Parser.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
use Sabberworm\CSS\Value\Size;
1818
use Sabberworm\CSS\Value\Color;
1919
use Sabberworm\CSS\Value\URL;
20-
use Sabberworm\CSS\Value\String;
20+
use Sabberworm\CSS\Value\CSSString;
2121
use Sabberworm\CSS\Rule\Rule;
2222
use Sabberworm\CSS\Parsing\UnexpectedTokenException;
2323

@@ -139,7 +139,7 @@ private function parseAtRule() {
139139
if ($sPrefix !== null && !is_string($sPrefix)) {
140140
throw new \Exception('Wrong namespace prefix '.$sPrefix);
141141
}
142-
if (!($mUrl instanceof String || $mUrl instanceof URL)) {
142+
if (!($mUrl instanceof CSSString || $mUrl instanceof URL)) {
143143
throw new \Exception('Wrong namespace url of invalid type '.$mUrl);
144144
}
145145
return new CSSNamespace($mUrl, $sPrefix);
@@ -214,7 +214,7 @@ private function parseStringValue() {
214214
}
215215
$this->consume($sQuote);
216216
}
217-
return new String($sResult);
217+
return new CSSString($sResult);
218218
}
219219

220220
private function parseCharacter($bIsForIdentifier) {

lib/Sabberworm/CSS/Value/String.php renamed to lib/Sabberworm/CSS/Value/CSSString.php

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

33
namespace Sabberworm\CSS\Value;
44

5-
class String extends PrimitiveValue {
5+
class CSSString extends PrimitiveValue {
66

77
private $sString;
88

lib/Sabberworm/CSS/Value/URL.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ class URL extends PrimitiveValue {
77

88
private $oURL;
99

10-
public function __construct(String $oURL) {
10+
public function __construct(CSSString $oURL) {
1111
$this->oURL = $oURL;
1212
}
1313

14-
public function setURL(String $oURL) {
14+
public function setURL(CSSString $oURL) {
1515
$this->oURL = $oURL;
1616
}
1717

0 commit comments

Comments
 (0)