Skip to content

Instantly share code, notes, and snippets.

View Majkl578's full-sized avatar
💥
breaking builds

Michael Moravec Majkl578

💥
breaking builds
View GitHub Profile
DQL:
DELETE FROM Foo f WHERE f.x = true AND NOT f.y IN (1, ?2, :abc, 'z')
HOA AST:
> #QueryLanguage
> > #DeleteStatement
> > > #DeleteClause
> > > > #AbstractSchemaName
> > > > #AliasIdentificationVariable
> > > #WhereClause
> > > > #ConditionalExpression
@Majkl578
Majkl578 / 7.2.diff
Created June 27, 2017 02:21
EntityManagerInterface @ PHP 7.2
19a20,21
> declare(strict_types=1);
>
21a24
> use Doctrine\Common\EventManager;
22a26,31
> use Doctrine\DBAL\Connection;
> use Doctrine\ORM\Cache;
> use Doctrine\ORM\Internal\Hydration\AbstractHydrator;
> use Doctrine\ORM\Proxy\ProxyFactory;
@Majkl578
Majkl578 / CompositeAuthenticator.php
Last active May 10, 2017 17:07
Composite authenticator for Nette (proof of concept, no tests, just an idea)
<?php
declare(strict_types=1);
use Nette\Security\AuthenticationException;
use Nette\Security\IIdentity;
class CompositeAuthenticator implements CompositeAuthenticatorInterface
{
public const TYPE_KEY = 'type';
@Majkl578
Majkl578 / autoload.patch
Created May 5, 2017 21:15
PHPStan - handling fatal during autoloading of unknown classes
From 6aeae9739015071348076dadd6ba8e10aefde007 Mon Sep 17 00:00:00 2001
From: Michael Moravec <mail@majkl578.cz>
Date: Fri, 5 May 2017 23:13:43 +0200
Subject: [PATCH] WIP
---
src/Broker/Broker.php | 10 ++++++++++
src/Broker/ClassAutoloadingException.php | 22 +++++++++++++++-------
2 files changed, 25 insertions(+), 7 deletions(-)
@Majkl578
Majkl578 / Dockerfile
Last active November 8, 2019 17:41
Dockerized example for article at Pehapkari.cz about running multiple PHP versions: https://pehapkari.cz/blog/2017/03/27/multiple-php-versions-the-easy-way/
FROM debian:stretch
ENV DEBIAN_FRONTEND noninteractive
# install NGINX
RUN apt-get update && \
apt-get install -y nginx --no-install-recommends && \
rm -rf /var/lib/apt/lists/*
Starting program: /usr/bin/php -n www/index.php
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Program received signal SIGSEGV, Segmentation fault.
0x0000000000c152b9 in zend_hash_index_find_bucket (ht=0x7fffea6fac00, h=0) at Zend/zend_hash.c:464
464 idx = HT_HASH_EX(arData, nIndex);
bt:
Directory: /tmp/tmp.SMAKC5sSqN
Using PHP 7.0.0alpha2 (cli) (built: Jun 27 2015 22:30:17) (DEBUG)
Copyright (c) 1997-2015 The PHP Group, version:
PHP 7.0.0alpha2 (cli) (built: Jun 27 2015 22:30:17) (DEBUG)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0-dev, Copyright (c) 1998-2015 Zend Technologies
Downloading composer...
Composer version 1.0-dev (943107cfe717a74aa791f57b87fa514c88582b0d) 2015-06-26 13:40:26
@Majkl578
Majkl578 / composer.json
Last active August 29, 2015 14:08
Nette sessions + custom save path and automatic GC, IT WORKS
{
"require": {
"nette/http": "2.2.*"
}
}
@Majkl578
Majkl578 / gist:eb69a620b00117bde91e
Created October 24, 2014 15:54
CURLFile fix for HHVM w/o 83a84147866fc73db7d2e0299f69c94738150436
<?php
class FixedCurlFile extends CurlFile
{
public function __construct($filename, $mimetype = '', $postname = '')
{
parent::__construct($filename, $mimetype, $postname ?: $filename;
}
}
Directory: /tmp/tmp.nWfNtHaIV3
Using HipHop VM 3.4.0-dev (dbg), version:
HipHop VM 3.4.0-dev (dbg)
Compiler: heads/master-0-g29f63872cff9839512ead9823b135d3c929da2b1
Repo schema: 42b47346b9ffaec357e9ce4dc94469b6f9e6a47c
Extension API: 20140829
Downloading composer...
Composer version 1.0-dev (a309e1d89ded6919935a842faeaed8e888fbfe37) 2014-10-20 19:16:14