Skip to content

Commit bd0b492

Browse files
committed
Test for #5527
phpstan/phpstan#5527
1 parent bec4be4 commit bd0b492

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

tests/PHPStan/Analyser/AnalyserIntegrationTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,12 @@ public function testBug5529(): void
432432
$this->assertCount(0, $errors);
433433
}
434434

435+
public function testBug5527(): void
436+
{
437+
$errors = $this->runAnalyse(__DIR__ . '/data/bug-5527.php');
438+
$this->assertCount(0, $errors);
439+
}
440+
435441
/**
436442
* @param string $file
437443
* @return \PHPStan\Analyser\Error[]
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
namespace Bug5527;
4+
5+
use function PHPStan\Testing\assertType;
6+
7+
class Base64
8+
{
9+
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
10+
11+
public function decode(string $buf): void
12+
{
13+
$chars = array_flip(str_split(self::chars));
14+
$res = $chars[$buf[0]] << 18;
15+
$res += $chars[$buf[1]] << 12;
16+
$res += $chars[$buf[2]] << 6;
17+
$res += $chars[$buf[3]];
18+
assertType('int', $res);
19+
}
20+
}

0 commit comments

Comments
 (0)