Skip to content
Permalink
Browse files

Fix templated assertion cc @vasily-kartashov

This is a good reason for you to skip 3.8.1
  • Loading branch information
muglug committed Dec 29, 2019
1 parent 8e54e3a commit 2b88261ecde19f957dfcaf2b0d80c1154ff21d2a
@@ -624,7 +624,7 @@ public static function analyze(
$changed_var_ids,
[],
$statements_analyzer,
[],
$statements_analyzer->getTemplateTypeMap() ?: [],
$context->inside_loop,
new CodeLocation($statements_analyzer->getSource(), $stmt)
);
@@ -562,6 +562,33 @@ function example(Clazz $c) {
return $c->is($x) ? $x : false;
}'
],
'assertOnClass' => [
'<?php
/**
* @template T
*/
abstract class Type
{
/**
* @param mixed $value
* @return bool
* @psalm-assert-if-true T $value
*/
abstract public function matches($value): bool;
/**
* @param mixed $value
* @return mixed
* @psalm-return T
* @psalm-assert T $value
*/
public function assert($value)
{
assert($this->matches($value));
return $value;
}
}'
],
];
}

0 comments on commit 2b88261

Please sign in to comment.
You can’t perform that action at this time.