assert-function-signature issueshttps://gitlab.grifart.cz/jkuchar1/assert-function-signature/-/issues2019-11-20T09:00:02Zhttps://gitlab.grifart.cz/jkuchar1/assert-function-signature/-/issues/3Support for PHP 7.42019-11-20T09:00:02ZJan Kuchařhonza.kuchar@grifart.czSupport for PHP 7.4errors are in attached builderrors are in attached buildhttps://gitlab.grifart.cz/jkuchar1/assert-function-signature/-/issues/2How to deal with covariance and contra-variance2017-12-15T16:57:51ZJan Kuchařhonza.kuchar@grifart.czHow to deal with covariance and contra-variancehttps://gitlab.grifart.cz/jkuchar1/assert-function-signature/-/issues/1RFC for function type2017-05-01T12:54:48ZRichard Trebichavskýrichard.trebichavsky@grifart.czRFC for function typeČo hovoríš na takýto jazykový konštrukt?
```php
<?php
functiontype PlusFunctionType(int, int): int;
$plus = function implements PlusFunctionType(int $first, int $second): int {
return $first + $second;
};
```
V haskelli sa to volá [ty...Čo hovoríš na takýto jazykový konštrukt?
```php
<?php
functiontype PlusFunctionType(int, int): int;
$plus = function implements PlusFunctionType(int $first, int $second): int {
return $first + $second;
};
```
V haskelli sa to volá [type signature](https://wiki.haskell.org/Type_signature).
Pre kompletnosť uvádzam ako je tento problém možné reišiť v súčastnosti:
```php
<?php declare(strict_types=1);
interface PlusFunction
{
public function __invoke(int $first, int $second): int;
}
$plus = function (int $first, int $second): int {
return $first + $second;
};
$plusImpl = new class implements PlusFunction {
public function __invoke(int $first, int $second): int {
return $first + $second;
}
};
var_dump($plus(3,4));
$plusObj = (object)$plus;
var_dump($plusObj);
var_dump($plusObj instanceof PlusFunction);
var_dump($plusObj(3,4));
var_dump($plusImpl instanceof PlusFunction);
var_dump($plusImpl(3,4));
```