Skip to content

Commit f9ab4c7

Browse files
authored
Merge pull request #24 from Paneon/develop
Use DOMNodeList->length instead of count() to support PHP 7.1
2 parents 12986fc + 751ca77 commit f9ab4c7

File tree

3 files changed

+24
-4
lines changed

3 files changed

+24
-4
lines changed

src/Compiler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public function convert(): string
9191
$this->registerProperties($scriptElement);
9292
}
9393

94-
if($twigBlocks->count()){
94+
if($twigBlocks->length){
9595
foreach($twigBlocks as $twigBlock){
9696
/** @var DOMText $twigBlock */
9797
$this->rawBlocks[] = trim($twigBlock->textContent);
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
<div>
22
{% if variable >= 1 %}
3-
<div>
4-
<h1>Headline</h1>
5-
</div>
3+
<div>
4+
<h1>Headline</h1>
5+
</div>
66
{% elseif variable < 100 and variable >= 1 %}
77
<div>
88
<h1>Headline</h1>
99
</div>
1010
{% endif %}
11+
{% if showIcon %}
12+
<span>Oh no.</span>
13+
{% endif %}
1114
</div>

tests/fixtures/vue-if/if-with-statement.vue

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,22 @@
66
<div v-else-if="variable < 100 && variable >= 1">
77
<h1>Headline</h1>
88
</div>
9+
<span v-if="showIcon">Oh no.</span>
910
</div>
1011
</template>
12+
13+
<script>
14+
export default {
15+
props: {
16+
show: {
17+
type: Boolean,
18+
default: false,
19+
},
20+
},
21+
computed: {
22+
showIcon() {
23+
return true;
24+
},
25+
},
26+
};
27+
</script>

0 commit comments

Comments
 (0)