Unknown error in zep file

Hi there,

I can't figure out the problem with this zep file:

namespace PhalconWebsocket;

class Socket {

    public SSL_PARAMS = [
        "countryName" => "NA",
        "stateOrProvinceName" => "none",
        "localityName" => "none",
        "organizationName" => "localhost",
        "organizationalUnitName" => "dev",
        "commonName" => "localhost",
        "emailAddress" => "[email protected]"
    ];

    protected master;
    protected sockets = [];
    protected context = null;
    protected host;
    protected port;
    protected certFile = null;
    protected certPass = null;

    protected function createSocket() {
        string protocol, url, errStr;
        int errNum;
        let protocol = "tcp://";
        if this->certFile {
            let protocol = "tls://";
        }
        let url = protocol . this->host . ":" . this->port;
        let this->context = stream_context_create();
        if this->certFile {
            this->applySslContext();
        }
        let this->master = stream_socket_server(url, errNum, errStr, STREAM_SERVER_BIND|STREAM_SERVER_LISTEN, this->context);
        if !this->master {
            throw new Exception("Failed to create socket server: " . errStr);
        }
        this->sockets[] = this->master;
    }

    protected function applySslContext() {
        var key, crt, pem;
        if !file_exists(this->certFile) {
            let key = openssl_pkey_new();
            let crt = openssl_csr_new(this->SSL_PARAMS, key);
            let crt = openssl_csr_sign(crt, null, key, 3650);
            let pem = [];
            openssl_x509_export(crt, pem[0]);
            openssl_pkey_export(key, pem[1], this->certPass);
            let pem = implode(pem);
            file_put_contents(this->certFile, pem);
        }
        stream_context_set_option(this->context, "ssl", "local_cert", this->certFile);
        stream_context_set_option(this->context, "ssl", "passphrase", this->certPass);
        stream_context_set_option(this->context, "ssl", "allow_self_signed", true);
        stream_context_set_option(this->context, "ssl", "verify_peer", false);
    }

    public function __construct(string! host="localhost", int! port=8081, string certFile=null, string certPass=null) {
        ob_implicit_flush(true);
        let this->host = host;
        let this->port = port;
        let this->certFile = certFile;
        let this->certPass = certPass;
        this->createSocket();
    }
}

This is the only file in the project so far, and the error I get is:

$ zephir clean && zephir compile
Zephir\Exception: Cannot parse file: /var/www/phalcon-websocket/phalconwebsocket/socket.zep

at Library/CompilerFile.php(570)
#0 Library/Compiler.php(331): Zephir\CompilerFile->preCompile(Object(Zephir\Compiler))
#1 Library/Compiler.php(370): Zephir\Compiler->preCompile('phalconwebsocke...')
#2 Library/Compiler.php(965): Zephir\Compiler->recursivePreCompile('phalconwebsocke...')
#3 Library/Compiler.php(1194): Zephir\Compiler->generate(Object(Zephir\Commands\CommandCompile))
#4 Library/Commands/CommandAbstract.php(108): Zephir\Compiler->compile(Object(Zephir\Commands\CommandCompile))
#5 Library/Bootstrap.php(200): Zephir\Commands\CommandAbstract->execute(Object(Zephir\Config), Object(Zephir\Logger))
#6 compiler.php(21): Zephir\Bootstrap::boot()
#7 {main}

My Zephir version is 0.9.3a-dev-5c0fb106a6, any feedback is welcome!

Looks like error on let this->master = stream_socket_server line. It seems Zephir can't pass variables by reference. See stream_socket_server doc

and error here

this->sockets[] = this->master;

You have to use let

Oops, thanks for pointing that out! :D

But still no dice... I even tried this:

namespace PhalconWebsocket;

class Socket {

}

And the error is still the same:

Zephir\Exception: Cannot parse file: /var/www/phalcon-websocket/phalconwebsocket/socket.zep

at Library/CompilerFile.php(570)
#0 Library/Compiler.php(331): Zephir\CompilerFile->preCompile(Object(Zephir\Compiler))
#1 Library/Compiler.php(370): Zephir\Compiler->preCompile('phalconwebsocke...')
#2 Library/Compiler.php(965): Zephir\Compiler->recursivePreCompile('phalconwebsocke...')
#3 Library/Compiler.php(1194): Zephir\Compiler->generate(Object(Zephir\Commands\CommandCompile))
#4 Library/Commands/CommandAbstract.php(108): Zephir\Compiler->compile(Object(Zephir\Commands\CommandCompile))
#5 Library/Bootstrap.php(200): Zephir\Commands\CommandAbstract->execute(Object(Zephir\Config), Object(Zephir\Logger))
#6 compiler.php(21): Zephir\Bootstrap::boot()
#7 {main}

I also checked file permissions, they are fine

I just copied your example and I was able to compile it

Use : instead of => in arrays:

public SSL_PARAMS = [
    "countryName": "NA",
    "stateOrProvinceName": "none",
    "localityName": "none",
    "organizationName": "localhost",
    "organizationalUnitName": "dev",
    "commonName": "localhost",
    "emailAddress": "[email protected]"
];