Skip to content

Commit

Permalink
regression test for bug 7075
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm committed Jan 20, 2023
1 parent 179f3da commit 5b05ffa
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -201,4 +201,9 @@ public function testBug6776(): void
$this->analyse([__DIR__ . '/data/bug-6776.php'], []);
}

public function testBug7075(): void
{
$this->analyse([__DIR__ . '/data/bug-7075.php'], []);
}

}
18 changes: 18 additions & 0 deletions tests/PHPStan/Rules/Comparison/data/bug-7075.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace Bug7075;

/** @param int<0, 100> $b */
function foo(int $b): void {
if ($b > 100) throw new \Exception("bad");
print "ok";
}

/**
* @param int<1,max> $number
*/
function foo2(int $number): void {
if ($number < 1) {
throw new \Exception('Number cannot be less than 1');
}
}

0 comments on commit 5b05ffa

Please sign in to comment.