Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add test case for variable GD return types
  • Loading branch information
Ben Harcourt committed Jul 2, 2020
commit 079dea37ed6ae31ece8e20ea83b73149607d3fb0
10 changes: 10 additions & 0 deletions tests/PHPStan/Analyser/NodeScopeResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9980,6 +9980,15 @@ public function dataBitwiseNot(): array
return $this->gatherAssertTypes(__DIR__ . '/data/bitwise-not.php');
}

public function dataGraphicsDrawReturnTypes(): array
{
if (!extension_loaded('gd')) {
return [];
}

return $this->gatherAssertTypes(__DIR__ . '/data/graphics-draw-return-types.php');
}

/**
* @dataProvider dataBug2574
* @dataProvider dataBug2577
Expand Down Expand Up @@ -10039,6 +10048,7 @@ public function dataBitwiseNot(): array
* @dataProvider dataArrayTypehintWithoutNullInPhpDoc
* @dataProvider dataOverrideVariableCertaintyInRootScope
* @dataProvider dataBitwiseNot
* @dataProvider dataGraphicsDrawReturnTypes
* @param string $assertType
* @param string $file
* @param mixed ...$args
Expand Down
8 changes: 8 additions & 0 deletions tests/PHPStan/Analyser/data/graphics-draw-return-types.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

use function PHPStan\Analyser\assertType;

$image = imagecreatetruecolor(1, 1);

assertType('bool', imagegd($image, 'php://memory'));
assertType('string', imagegd($image, null));