Completed
Push — chore/php-8-migration ( 09d054...95d009 )
by Vladimir
05:18
created
src/Event/CompilerPostRenderTrait.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,8 @@
 block discarded – undo
25 25
      */
26 26
     public function setCompiledOutput($compiledOutput): void
27 27
     {
28
-        if (!StrUtils::canBeCastedToString($compiledOutput)) {
28
+        if (!StrUtils::canBeCastedToString($compiledOutput))
29
+        {
29 30
             @trigger_error('CompileProcessPostRenderPageView :: Value cannot be set to something that cannot be cast into a string.', E_USER_WARNING);
30 31
 
31 32
             return;
Please login to merge, or discard this patch.
src/Templating/TemplateInterface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
      *
23 23
      * @return false|self returns false when template is not extending anything
24 24
      */
25
-    public function getParentTemplate(): false|self;
25
+    public function getParentTemplate(): false | self;
26 26
 
27 27
     /**
28 28
      * Render the template with the given context.
Please login to merge, or discard this patch.
src/Templating/Twig/Extension/AbstractFilesystemTwigExtension.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,11 +22,13 @@
 block discarded – undo
22 22
         $this->dir = fs::getFolderPath(Service::getOption('currentTemplate'));
23 23
         $this->path = fs::appendPath($this->dir, $location);
24 24
 
25
-        if (is_file($this->path)) {
25
+        if (is_file($this->path))
26
+        {
26 27
             $this->path = realpath($this->path);
27 28
         }
28 29
 
29
-        if (!str_starts_with((string)$this->path, (string)Service::getWorkingDirectory())) {
30
+        if (!str_starts_with((string)$this->path, (string)Service::getWorkingDirectory()))
31
+        {
30 32
             throw new FileNotFoundException(sprintf(
31 33
                 "The '%s' file could not be found or is outside the website working directory",
32 34
                 $location
Please login to merge, or discard this patch.
src/Templating/Twig/Extension/AnchorsFilter.php 1 patch
Braces   +28 added lines, -13 removed lines patch added patch discarded remove patch
@@ -32,13 +32,15 @@  discard block
 block discarded – undo
32 32
      */
33 33
     public static function filter($html, $beforeHeading = false, $anchorAttrs = [], $anchorBody = '', $anchorClass = '', $anchorTitle = '', $hMin = 1, $hMax = 6): string
34 34
     {
35
-        if (!function_exists('simplexml_load_string')) {
35
+        if (!function_exists('simplexml_load_string'))
36
+        {
36 37
             trigger_error('XML support is not available with the current PHP installation.', E_USER_WARNING);
37 38
 
38 39
             return $html;
39 40
         }
40 41
 
41
-        if ($anchorClass) {
42
+        if ($anchorClass)
43
+        {
42 44
             $anchorAttrs['class'] = $anchorClass;
43 45
         }
44 46
 
@@ -47,16 +49,19 @@  discard block
 block discarded – undo
47 49
         $headings = HtmlUtils::htmlXPath($dom, $html, '//h1|//h2|//h3|//h4|//h5|//h6');
48 50
 
49 51
         /** @var DOMElement $heading */
50
-        foreach ($headings as $heading) {
52
+        foreach ($headings as $heading)
53
+        {
51 54
             $headingID = $heading->attributes->getNamedItem('id');
52 55
 
53
-            if ($headingID === null) {
56
+            if ($headingID === null)
57
+            {
54 58
                 continue;
55 59
             }
56 60
 
57 61
             sscanf($heading->tagName, 'h%u', $currLvl);
58 62
 
59
-            if (!($hMin <= $currLvl && $currLvl <= $hMax)) {
63
+            if (!($hMin <= $currLvl && $currLvl <= $hMax))
64
+            {
60 65
                 continue;
61 66
             }
62 67
 
@@ -67,35 +72,45 @@  discard block
 block discarded – undo
67 72
                 '{heading}' => $heading->textContent,
68 73
             ]);
69 74
 
70
-            if (str_starts_with($body, '<')) {
75
+            if (str_starts_with($body, '<'))
76
+            {
71 77
                 $domAnchorBody = new DOMDocument();
72 78
                 $loaded = @$domAnchorBody->loadHTML($body, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);
73 79
 
74
-                if ($loaded) {
80
+                if ($loaded)
81
+                {
75 82
                     /** @var DOMElement $childNode */
76
-                    foreach ($domAnchorBody->childNodes as $childNode) {
83
+                    foreach ($domAnchorBody->childNodes as $childNode)
84
+                    {
77 85
                         $node = $anchor->ownerDocument->importNode($childNode->cloneNode(true), true);
78 86
                         $anchor->appendChild($node);
79 87
                     }
80 88
                 }
81
-            } else {
89
+            }
90
+            else
91
+            {
82 92
                 $anchor->nodeValue = $body;
83 93
             }
84 94
 
85
-            if ($anchorTitle) {
95
+            if ($anchorTitle)
96
+            {
86 97
                 $anchorAttrs['title'] = strtr($anchorTitle, [
87 98
                     '{heading}' => $heading->textContent,
88 99
                 ]);
89 100
             }
90 101
 
91
-            foreach ($anchorAttrs as $attrName => $attrValue) {
102
+            foreach ($anchorAttrs as $attrName => $attrValue)
103
+            {
92 104
                 $anchor->setAttribute($attrName, $attrValue);
93 105
             }
94 106
 
95
-            if ($beforeHeading) {
107
+            if ($beforeHeading)
108
+            {
96 109
                 $heading->insertBefore($dom->createTextNode(' '), $heading->childNodes[0]);
97 110
                 $heading->insertBefore($anchor, $heading->childNodes[0]);
98
-            } else {
111
+            }
112
+            else
113
+            {
99 114
                 $heading->appendChild($dom->createTextNode(' '));
100 115
                 $heading->appendChild($anchor);
101 116
             }
Please login to merge, or discard this patch.
src/Templating/Twig/Extension/OrderFilter.php 1 patch
Braces   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -14,24 +14,29 @@
 block discarded – undo
14 14
 {
15 15
     public function __invoke($array, $key, $order = 'ASC', $case_insensitive = false)
16 16
     {
17
-        if (!is_array($array)) {
17
+        if (!is_array($array))
18
+        {
18 19
             return $array;
19 20
         }
20 21
 
21
-        usort($array, function ($a, $b) use ($key, $order, $case_insensitive) {
22
+        usort($array, function ($a, $b) use ($key, $order, $case_insensitive)
23
+        {
22 24
             $aValue = __::get($a, $key);
23 25
             $bValue = __::get($b, $key);
24 26
 
25
-            if ($case_insensitive) {
27
+            if ($case_insensitive)
28
+            {
26 29
                 $aValue = strtolower($aValue);
27 30
                 $bValue = strtolower($bValue);
28 31
             }
29 32
 
30
-            if ($aValue == $bValue) {
33
+            if ($aValue == $bValue)
34
+            {
31 35
                 return 0;
32 36
             }
33 37
 
34
-            if (strtolower((string)$order) === 'desc') {
38
+            if (strtolower((string)$order) === 'desc')
39
+            {
35 40
                 return ($aValue < $bValue) ? 1 : -1;
36 41
             }
37 42
 
Please login to merge, or discard this patch.
src/Templating/Twig/Extension/SelectFilter.php 1 patch
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -16,19 +16,23 @@
 block discarded – undo
16 16
     {
17 17
         $results = [];
18 18
 
19
-        foreach ($array as $item) {
19
+        foreach ($array as $item)
20
+        {
20 21
             $results[] = __::get($item, $key);
21 22
         }
22 23
 
23
-        if ($flatten) {
24
+        if ($flatten)
25
+        {
24 26
             $results = __::flatten($results);
25 27
 
26
-            if ($distinct) {
28
+            if ($distinct)
29
+            {
27 30
                 $results = array_values(array_unique($results));
28 31
             }
29 32
         }
30 33
 
31
-        if ($ignore_null) {
34
+        if ($ignore_null)
35
+        {
32 36
             $results = array_values(array_filter($results));
33 37
         }
34 38
 
Please login to merge, or discard this patch.
src/Templating/Twig/Extension/SummaryFilter.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,7 +15,8 @@  discard block
 block discarded – undo
15 15
 {
16 16
     public function __invoke($value, $paragraphCount = 1)
17 17
     {
18
-        if (!extension_loaded('dom')) {
18
+        if (!extension_loaded('dom'))
19
+        {
19 20
             @trigger_error('The DOM Extension is not loaded and is necessary for the "summary" Twig filter.', E_WARNING);
20 21
 
21 22
             return $value;
@@ -26,7 +27,8 @@  discard block
 block discarded – undo
26 27
 
27 28
         $summary = '';
28 29
 
29
-        foreach ($paragraphs as $paragraph) {
30
+        foreach ($paragraphs as $paragraph)
31
+        {
30 32
             $summary .= $dom->saveHTML($paragraph);
31 33
         }
32 34
 
Please login to merge, or discard this patch.
src/Templating/Twig/Extension/ZipFilter.php 1 patch
Braces   +15 added lines, -7 removed lines patch added patch discarded remove patch
@@ -17,20 +17,24 @@  discard block
 block discarded – undo
17 17
         $arr1_length = count($array1);
18 18
         $arr2_length = count($array2);
19 19
 
20
-        for ($i = 0; $i < $arr1_length; ++$i) {
21
-            if ($i >= $arr2_length) {
20
+        for ($i = 0; $i < $arr1_length; ++$i)
21
+        {
22
+            if ($i >= $arr2_length)
23
+            {
22 24
                 break;
23 25
             }
24 26
 
25 27
             $rhs = self::safe_get($array1, $i);
26 28
             $lhs = self::safe_get($array2, $i);
27 29
 
28
-            if (empty($rhs)) {
30
+            if (empty($rhs))
31
+            {
29 32
                 $result[] = $lhs;
30 33
 
31 34
                 continue;
32 35
             }
33
-            if (empty($lhs)) {
36
+            if (empty($lhs))
37
+            {
34 38
                 $result[] = $rhs;
35 39
 
36 40
                 continue;
@@ -39,10 +43,14 @@  discard block
 block discarded – undo
39 43
             $result[] = self::safe_get($array1, $i) . $glue . self::safe_get($array2, $i);
40 44
         }
41 45
 
42
-        if (!$strict) {
43
-            if ($arr2_length > $arr1_length) {
46
+        if (!$strict)
47
+        {
48
+            if ($arr2_length > $arr1_length)
49
+            {
44 50
                 $result = array_merge($result, array_slice($array2, $arr1_length));
45
-            } else {
51
+            }
52
+            else
53
+            {
46 54
                 $result = array_merge($result, array_slice($array1, $arr2_length));
47 55
             }
48 56
         }
Please login to merge, or discard this patch.
src/Templating/Twig/Extension/WordWrapFilter.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,8 +30,10 @@
 block discarded – undo
30 30
         $pieces = mb_split((string)$separator, (string)$value);
31 31
         mb_regex_encoding($previous);
32 32
 
33
-        foreach ($pieces as $piece) {
34
-            while (!$preserve && mb_strlen((string)$piece, $env->getCharset()) > $length) {
33
+        foreach ($pieces as $piece)
34
+        {
35
+            while (!$preserve && mb_strlen((string)$piece, $env->getCharset()) > $length)
36
+            {
35 37
                 $sentences[] = mb_substr((string)$piece, 0, $length, $env->getCharset());
36 38
                 $piece = mb_substr((string)$piece, $length, 2048, $env->getCharset());
37 39
             }
Please login to merge, or discard this patch.