The error message is pretty clear:
Fatal error: Declaration of Frontend\Helpers\CssYUICompressor::filter($contents) must be compatible with Phalcon\Assets\FilterInterface::filter(string $content): string in /home/devmass/web/dev.loc/public_html/apps/frontend/helpers/CssYUICompressor.php on line 12
Taking a look at the definition of FIlterInterface: https://github.com/phalcon/cphalcon/blob/master/phalcon/Assets/FilterInterface.zep
You can see the input parameter MUST be a string, so you should refactor your filter class to match that:
namespace Frontend\Helpers;
use Phalcon\Assets\FilterInterface;
/**
* Filters CSS content using YUI
*
* @param string $contents
* @return string
*/
class CssYUICompressor implements FilterInterface
{
protected $options;
/**
* CssYUICompressor constructor
*
* @param array $options
*/
public function __construct(array $options)
{
$this->options = $options;
}
/**
* @param string $contents
*
* @return string
*/
public function filter(string $contents): string
{
// Write the string contents into a temporal file
file_put_contents('temp/my-temp-1.css', $contents);
system(
$this->options['java-bin'] .
' -jar ' .
$this->options['yui'] .
' --type css ' .
'temp/my-temp-file-1.css ' .
$this->options['extra-options'] .
' -o temp/my-temp-file-2.css'
);
// Return the contents of file
return file_get_contents('temp/my-temp-file-2.css');
}
}