1 | <?php |
||
24 | class SassEngine implements AssetEngineInterface |
||
25 | { |
||
26 | private $fileSourceMap = false; |
||
27 | private $configuration; |
||
28 | /** @var PageManager */ |
||
29 | private $pageManager; |
||
30 | private $compiler; |
||
31 | private $options = []; |
||
32 | |||
33 | 7 | public function __construct(Configuration $configuration) |
|
38 | |||
39 | 7 | public function getConfigurationNamespace() |
|
43 | |||
44 | 7 | public function getDefaultConfiguration() |
|
45 | { |
||
46 | return [ |
||
47 | 7 | 'style' => 'compressed', |
|
48 | 7 | 'sourcemap' => false, |
|
49 | 7 | ]; |
|
50 | } |
||
51 | |||
52 | 7 | public function getFolder() |
|
56 | |||
57 | 7 | public function getExtensions() |
|
61 | |||
62 | /** |
||
63 | * @param string $content |
||
64 | * @param $options = [ |
||
65 | * 'pageview' => new StaticPageView() |
||
66 | * ] |
||
67 | * |
||
68 | * @return string |
||
69 | */ |
||
70 | 7 | public function parse($content, array $options = []) |
|
71 | { |
||
72 | $sourceMapOptions = [ |
||
73 | 7 | 'sourceMapBasepath' => Service::getWorkingDirectory(), |
|
74 | 7 | ]; |
|
75 | |||
76 | 7 | $this->handleThemeImports($content); |
|
77 | |||
78 | // We don't need to write the source map to a file |
||
79 | 7 | if (!$this->fileSourceMap) |
|
80 | 7 | { |
|
81 | 6 | $this->compiler->setSourceMapOptions($sourceMapOptions); |
|
82 | |||
83 | 6 | return $this->compiler->compile($content); |
|
84 | } |
||
85 | |||
86 | /** @var StaticPageView $pageView */ |
||
87 | 1 | $pageView = $options['pageview']; |
|
88 | |||
89 | // Always put our source map next to the respective CSS file |
||
90 | 1 | $sourceMapTargetPath = $this->getSourceMapTargetFile($pageView); |
|
91 | 1 | $sourceMapFilename = fs::getFilename($sourceMapTargetPath); |
|
92 | |||
93 | 1 | $sourceMapOptions = array_merge($sourceMapOptions, [ |
|
94 | 1 | 'sourceMapFilename' => $sourceMapFilename, |
|
95 | 1 | 'sourceMapURL' => $pageView->getPermalink() . '.map', |
|
96 | 1 | 'sourceMapWriteTo' => $sourceMapTargetPath, |
|
97 | 1 | ]); |
|
98 | |||
99 | 1 | $sourceMapGenerator = new SourceMapGenerator($sourceMapOptions); |
|
100 | 1 | $this->compiler->setSourceMap($sourceMapGenerator); |
|
|
|||
101 | |||
102 | 1 | $sass = $this->compiler->compile($content); |
|
103 | |||
104 | 1 | $sourceMapPageView = BasePageView::createVirtual([ |
|
105 | 1 | 'permalink' => $pageView->getPermalink() . '.map', |
|
106 | 1 | ], $sourceMapGenerator->getSourceMapContents()); |
|
107 | |||
108 | 1 | $this->pageManager->trackNewPageView($sourceMapPageView); |
|
109 | |||
110 | 1 | return $sass; |
|
111 | } |
||
112 | |||
113 | 7 | public function setOptions(array $options) |
|
121 | |||
122 | 1 | public function setPageManager(PageManager $pageManager) |
|
126 | |||
127 | 7 | private function configureImportPath() |
|
131 | |||
132 | 7 | private function configureOutputStyle() |
|
138 | |||
139 | 7 | private function configureSourceMap() |
|
157 | |||
158 | 1 | private function getSourceMapTargetFile(StaticPageView $pageView) |
|
165 | |||
166 | 7 | private function handleThemeImports(&$content) |
|
174 | |||
175 | public static function stringToFormatter($format) |
||
192 | } |
||
193 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: