Skip to content

Commit 0ec9fb4

Browse files
VincentLangletondrejmirtes
authored andcommitted
Fix fwrite
1 parent 7b2ff7a commit 0ec9fb4

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

resources/functionMap_php74delta.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
'ReflectionProperty::isInitialized' => ['bool', 'object='=>'?object'],
5252
'ReflectionReference::fromArrayElement' => ['?ReflectionReference', 'array'=>'array', 'key'=>'int|string'],
5353
'ReflectionReference::getId' => ['string'],
54+
'SplFileObject::fwrite' => ['int|false', 'str'=>'string', 'length='=>'int'],
5455
'SQLite3Stmt::getSQL' => ['string', 'expanded='=>'bool'],
5556
'strip_tags' => ['string', 'str'=>'string', 'allowable_tags='=>'string|array<int, string>'],
5657
'WeakReference::create' => ['WeakReference', 'referent'=>'object'],

tests/PHPStan/Rules/Comparison/StrictComparisonOfDifferentTypesRuleTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -996,4 +996,9 @@ public function testBug12946(): void
996996
$this->analyse([__DIR__ . '/data/bug-12946.php'], []);
997997
}
998998

999+
public function testBug13208(): void
1000+
{
1001+
$this->analyse([__DIR__ . '/data/bug-13208.php'], []);
1002+
}
1003+
9991004
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
namespace Bug13208;
4+
5+
class HelloWorld
6+
{
7+
public function main()
8+
{
9+
$file = new \SplFileObject('/tmp/file', "wd+");
10+
if ($file->fwrite('a') === false) {
11+
throw new \Exception("write failed !");
12+
}
13+
}
14+
}

0 commit comments

Comments
 (0)