Skip to content

Commit b407a46

Browse files
committed
Fix PHPStan error on unchecked preg_match result in test
1 parent d66317a commit b407a46

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎tests/CaBundleTest.php‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ public function testFindDistrustedCertificate(): void
2121
{
2222
$ev = (string) file_get_contents(__DIR__.'/Fixtures/distrusted/em-ev-tls-ca-g3b.pem');
2323
$ov = (string) file_get_contents(__DIR__.'/Fixtures/distrusted/em-ov-tls-ca-g3b.pem');
24-
preg_match('{-----BEGIN CERTIFICATE-----.+?-----END CERTIFICATE-----}s', (string) file_get_contents(CaBundle::getBundledCaBundlePath()), $trusted);
24+
if (!preg_match('{-----BEGIN CERTIFICATE-----.+?-----END CERTIFICATE-----}s', (string) file_get_contents(CaBundle::getBundledCaBundlePath()), $trusted)) {
25+
$this->fail('No certificate found in the bundled CA file');
26+
}
2527

2628
$this->assertSame('EM EV TLS CA - G3B', CaBundle::findDistrustedCertificate(array($ev)));
2729
$this->assertSame('EM OV TLS CA - G3B', CaBundle::findDistrustedCertificate(array('garbage', $ov, $ev)));

0 commit comments

Comments
 (0)