Skip to content

Commit

Permalink
Regression test
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Jul 14, 2021
1 parent 19cefd1 commit 26cbd07
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/PHPStan/Analyser/NodeScopeResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,7 @@ public function dataFileAsserts(): iterable
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-5259.php');
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-5293.php');
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-5129.php');
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-4970.php');
}

/**
Expand Down
29 changes: 29 additions & 0 deletions tests/PHPStan/Analyser/data/bug-4970.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace Bug4970;

use function PHPStan\Testing\assertType;

class Test
{
/**
* @var string
*/
protected $importFile = '/a';

protected function beforeRun(): int
{
if (!\file_exists($this->importFile)) {
return 1;
}
assertType('true', \file_exists($this->importFile));
$this->importFile = '/b';
assertType('bool', \file_exists($this->importFile));

if (\file_exists($this->importFile)) {
echo 'test';
}

return \file_exists($this->importFile) ? 0 : 1;
}
}

0 comments on commit 26cbd07

Please sign in to comment.