summaryrefslogtreecommitdiffstats
path: root/php-kukulich-fshl-php71.patch
blob: 63fb55e13d46a25ced15de9457f80312042fb8a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
From ae00651ce648c576ba37b79755a804801b592604 Mon Sep 17 00:00:00 2001
From: Remi Collet <fedora@famillecollet.com>
Date: Thu, 16 Feb 2017 12:08:34 +0100
Subject: [PATCH 1/2] workaround PHP 7.1 issue, fixed #12

---
 FSHL/Highlighter.php | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/FSHL/Highlighter.php b/FSHL/Highlighter.php
index 04e7b42..d3c9e38 100644
--- a/FSHL/Highlighter.php
+++ b/FSHL/Highlighter.php
@@ -250,7 +250,7 @@ public function highlight($text, Lexer $lexer = null)
 			}
 
 			// Switches between lexers (transition to embedded language)
-			if ($this->lexer->flags[$newState] & Generator::STATE_FLAG_NEWLEXER) {
+			if ((int)$this->lexer->flags[$newState] & Generator::STATE_FLAG_NEWLEXER) {
 				if ($newState === $this->lexer->quitState) {
 					// Returns to the previous lexer
 					if ($item = $this->popState()) {
@@ -275,7 +275,7 @@ public function highlight($text, Lexer $lexer = null)
 			}
 
 			// If newState is marked with recursion flag (alias call), push current state to the context stack
-			if (($this->lexer->flags[$newState] & Generator::STATE_FLAG_RECURSION) && $state !== $newState) {
+			if (((int)$this->lexer->flags[$newState] & Generator::STATE_FLAG_RECURSION) && $state !== $newState) {
 				$this->pushState($lexerName, $state);
 			}
 
@@ -434,7 +434,7 @@ private function generateCache(Lexer $lexer)
 	 */
 	private function template($part, $state)
 	{
-		if ($this->lexer->flags[$state] & Generator::STATE_FLAG_KEYWORD) {
+		if ((int)$this->lexer->flags[$state] & Generator::STATE_FLAG_KEYWORD) {
 			$normalized = Generator::CASE_SENSITIVE === $this->lexer->keywords[Generator::KEYWORD_INDEX_CASE_SENSITIVE] ? $part : strtolower($part);
 
 			if (isset($this->lexer->keywords[Generator::KEYWORD_INDEX_LIST][$normalized])) {

From 213824a607741ef08cffd0d2b7dfa112f2e6ae9d Mon Sep 17 00:00:00 2001
From: Remi Collet <fedora@famillecollet.com>
Date: Thu, 16 Feb 2017 12:09:59 +0100
Subject: [PATCH 2/2] enable more versions in travis

---
 .travis.yml | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/.travis.yml b/.travis.yml
index 901bf6a..66db7f9 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,6 +3,10 @@ language: php
 php:
   - 5.3
   - 5.4
+  - 5.5
+  - 5.6
+  - 7.0
+  - 7.1
 
 branches:
   only:
@@ -13,4 +17,4 @@ notifications:
   email:
     - kontakt@kukulich.cz
 
-script: phpunit tests/FSHL
\ No newline at end of file
+script: phpunit tests/FSHL