Skip to content

Commit 8d43daf

Browse files
use static arrays instead of const arrays as HHVM do not support arrays in constants yet
1 parent 3059099 commit 8d43daf

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/Container/File.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class File
1111
const TYPE_SASS = 'sass';
1212
const TYPE_SCSS = 'scss';
1313
const TYPE_LESS = 'less';
14-
const SUPPORTED_TYPES = [
14+
static $supportedTypes = [
1515
self::TYPE_COMPASS,
1616
self::TYPE_SASS,
1717
self::TYPE_SCSS,
@@ -179,7 +179,7 @@ protected function detectSourceTypeFromPath($path)
179179
{
180180
$extension = strtolower(pathinfo($path, PATHINFO_EXTENSION));
181181

182-
return in_array($extension, static::SUPPORTED_TYPES)
182+
return in_array($extension, static::$supportedTypes)
183183
? $extension
184184
: static::TYPE_UNKNOWN;
185185
}

src/Processor/Processor.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class Processor
1616
const FORMATTER_EXPANDED = 'expanded';
1717
const FORMATTER_NESTED = 'nested';
1818
const FORMATTER_COMPACT = 'compact';
19-
const SUPPORTED_FORMATTERS = [
19+
static $supportedFormatters = [
2020
self::FORMATTER_COMPRESSED,
2121
self::FORMATTER_CRUNCHED,
2222
self::FORMATTER_EXPANDED,
@@ -167,8 +167,8 @@ public function processFile(File $file)
167167
*/
168168
protected function getFormatterClass($formatter)
169169
{
170-
if (!in_array($formatter, static::SUPPORTED_FORMATTERS)) {
171-
throw new \InvalidArgumentException('unknown formatter, available options are: ' . print_r(static::SUPPORTED_FORMATTERS, true));
170+
if (!in_array($formatter, static::$supportedFormatters)) {
171+
throw new \InvalidArgumentException('unknown formatter, available options are: ' . print_r(static::$supportedFormatters, true));
172172
}
173173

174174
return 'Leafo\\ScssPhp\\Formatter\\' . ucfirst($formatter);

tests/phpunit/ProcessorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function processFileExpectedException()
9393
*/
9494
public function getFormatterClass()
9595
{
96-
foreach (Processor::SUPPORTED_FORMATTERS as $formatter) {
96+
foreach (Processor::$supportedFormatters as $formatter) {
9797
$expected = 'Leafo\\ScssPhp\\Formatter\\' . ucfirst($formatter);
9898

9999
$this->assertEquals(

0 commit comments

Comments
 (0)