Repository navigation
Add return $value for all Assert assertions. - #324
Conversation
|
BTW, use |
Thanks for the tip @shadowhand, updated PR accordingly. |
|
Ah, didn't the code style in the project for |
|
@kkevindev if you rebase |
done! @shadowhand |
|
Looks like we still need the |
|
@kkevindev I think that's because Mixin needs to be regenerated? |
shadowhand
left a comment
There was a problem hiding this comment.
Everything is looking good, except for Mixin generation.
|
|
||
| $staticFunction = $this->phpdoc($phpdocLines, $indent)."\n"; | ||
| $staticFunction .= $indentation.'public static function '.$name.$this->functionParameters($parameters, $types, $defaults).": void\n" | ||
| $staticFunction .= $indentation.'public static function '.$name.$this->functionParameters($parameters, $types, $defaults)."\n" |
There was a problem hiding this comment.
This dropped the return type, without adding the newly added types.
There was a problem hiding this comment.
@shadowhand I just noticed alot of the @psalm-return annotations on the Mixin class weren't even correct. This is fixed now.
I got it to a point where the @return phpdoc return type contains the exact return type and native php method return type is the same as the parameter value, so can be mixed, see:
public static function allString(iterable $value, string $message = ''): iterable
public static function nullOrString(mixed $value, string $message = ''): mixed
I've looked into a way to get the native php return type but since we are guessing the return type based on the psalm phpdoc on the Assert class, we currently do not have a way to convert these non-native types non-empty-string|null (for nullOrStringNotEmpty) to be string|null. Any idea's?
I think for now this is acceptable.
There was a problem hiding this comment.
Yup good enough. Appreciate all the work on this!
|
Sorry for this off topic message: BUT I LOVE THIS 😁 👏 🙌 Thanks! Soon I can finally remove my custom |
Added return statement for all
Assertassertions.Closes #280.