Skip to content

Commit 95aea67

Browse files
committed
minor #21537 Static code analysis with Php Inspections (EA Extended) (kalessil)
This PR was squashed before being merged into the 2.7 branch (closes #21537). Discussion ---------- Static code analysis with Php Inspections (EA Extended) | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | -- | License | MIT | Doc PR | -- - Unnecessary proxy methods and methods duplicating parents ones removed; - Type casings instead of PHP4 functions; - Usage of copy instead of file combining file get/put contents; - One time use variables cleaned up; - Superfluous functions calls in loop termination conditions fixed; Commits ------- 3feeca74d0 Static code analysis with Php Inspections (EA Extended)
2 parents 034d7d5 + b3706f4 commit 95aea67

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Templating/Helper/CodeHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public function fileExcerpt($file, $line)
132132
$code = @highlight_file($file, true);
133133
// remove main code/span tags
134134
$code = preg_replace('#^<code.*?>\s*<span.*?>(.*)</span>\s*</code>#s', '\\1', $code);
135-
$content = preg_split('#<br />#', $code);
135+
$content = explode('<br />', $code);
136136

137137
$lines = array();
138138
for ($i = max($line - 3, 1), $max = min($line + 3, count($content)); $i <= $max; ++$i) {

Tests/Fixtures/Resources/views/translation.html.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@
4646

4747
<?php echo $view['translator']->trans('typecast', ['a' => (int) '123'], 'not_messages'); ?>
4848
<?php echo $view['translator']->transChoice('msg1', 10 + 1, [], 'not_messages'); ?>
49-
<?php echo $view['translator']->transChoice('msg2', intval(4.5), [], 'not_messages'); ?>
49+
<?php echo $view['translator']->transChoice('msg2', ceil(4.5), [], 'not_messages'); ?>

0 commit comments

Comments
 (0)