Skip to content

Instantly share code, notes, and snippets.

View staabm's full-sized avatar
πŸ‘‹

Markus Staab staabm

πŸ‘‹
View GitHub Profile
@staabm
staabm / negated_conditions_repro.php
Created August 15, 2026 11:20
negated_conditions_repro.php
@ -0,0 +1,175 @@
<?php
declare(strict_types=1);
/**
* Reproducer for commit d363881c66bf4a301bb0af9c5b8119e50f2a7494:
* "Compile negated conditions as inverted jumps"
*
* Run this script on:
@staabm
staabm / closure_from_callable_runtime_cache_bench.php
Created August 15, 2026 09:26
closure_from_callable_runtime_cache_bench.php
<?php
// Measures repeated fake-closure creation over a method that has not run yet.
// The affected path is Closure::fromCallable()/first-class callable generation.
final class CacheHeavyCallable
{
public $p1 = 1;
public $p2 = 2;
public $p3 = 3;
@staabm
staabm / ExprCacheHelper.php
Created August 5, 2026 07:19
Cache PHPParser in ExprCacheHelper
<?php
declare(strict_types=1);
namespace PHPStan\BetterReflection\Reflection;
use PhpParser\Node\Expr;
use PHPStan\BetterReflection\BetterReflection;
final class ExprCacheHelper
<?php declare(strict_types = 1);
use function PHPStan\dumpType;
use function PHPStan\Testing\assertType;
class HelloWorld
{
/**
* Returns whether an element of a given name is in the HTML special category.
*
@staabm
staabm / gist:ec1c42f04f053e20928ae1ea9e4a90f4
Created February 24, 2026 07:01
phpstan-src error on PHP8.5
➜ phpstan-src git:(2.1.x) php -d memory_limit=599M bin/phpstan -v
Note: Using configuration file /Users/staabm/workspace/phpstan-src/phpstan.neon.dist.
2178/2178 [β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“] 100% 10 secs
-- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Error
-- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Internal error: Trait "Hoa\Event\Listens" not found while analysing file /Users/staabm/workspace/phpstan-src/src/Type/Regex/RegexGroupParser.php
Post the following stack trace to https://github.com/phpstan/phpstan/issues/new?te
@staabm
staabm / gist:4d70422d132ae96c0723f0b3d6eb7276
Last active December 10, 2025 11:21
xdebug gc stats for a PHPUnit run on phpstan-src
see https://xdebug.org/docs/garbage_collection
cd phpstan-src
php -dxdebug.mode=gcstats -dxdebug.start_with_request=yes vendor/bin/phpunit
leads to
Garbage Collection Report
version: 1
creator: xdebug 3.4.7 (PHP 8.3.28)
@staabm
staabm / gist:3f158e7aaa43469cd07f2f69c4535d27
Last active December 10, 2025 07:57
xdebug 3.5.0-alpha4 segfault
- clone phpstan-src
- checkout c08e6587e6
- composer install
- make test
- time XDEBUG_MODE=coverage tests/vendor/bin/paratest --coverage-xml tmp/coverage
leads to:
PHPUnit 11.5.34 by Sebastian Bergmann and contributors.
Runtime: PHP 8.3.24 with Xdebug 3.4.5
Configuration: /Users/staabm/workspace/PHPUnit-Polyfills/phpunit11.xml.dist
string(101) "/Users/staabm/workspace/PHPUnit-Polyfills/tests/Polyfills/AssertFileEqualsSpecializationsTestCase.php"
string(94) "/Users/staabm/workspace/PHPUnit-Polyfills/tests/Polyfills/AssertClosedResourceZlibTestCase.php"
string(146) "/Users/staabm/workspace/PHPUnit-Polyfills/vendor/phpunit/phpunit/src/Event/Events/Test/TestDouble/MockObjectForIntersectionOfInterfacesCreated.php"
string(125) "/Users/staabm/workspace/PHPUnit-Polyfills/vendor/phpunit/phpunit/src/Event/Events/Test/HookMethod/BeforeTestMethodErrored.php"
string(129) "/Users/staabm/workspace/PHPUnit-Polyfills/vendor/phpunit/phpunit/src/Event/Events/Test/HookMethod/BeforeFirstTestMethodCalled.php"
PHPUnit 12.3.6 by Sebastian Bergmann and contributors.
Runtime: PHP 8.3.24 with Xdebug 3.4.5
Configuration: /Users/staabm/workspace/PHPUnit-Polyfills/phpunit12.xml.dist
string(101) "/Users/staabm/workspace/PHPUnit-Polyfills/tests/Polyfills/AssertFileEqualsSpecializationsTestCase.php"
string(94) "/Users/staabm/workspace/PHPUnit-Polyfills/tests/Polyfills/AssertClosedResourceZlibTestCase.php"
string(86) "/Users/staabm/workspace/PHPUnit-Polyfills/vendor/sebastian/type/src/type/UnionType.php"
string(88) "/Users/staabm/workspace/PHPUnit-Polyfills/vendor/sebastian/type/src/ReflectionMapper.php"
string(107) "/Users/staabm/workspace/PHPUnit-Polyfills/vendor/phpunit/php-code-coverage/src/Target/ValidationFailure.php"
@staabm
staabm / test11968.php
Created November 30, 2024 12:16
Reduced repro PHPStan Bug 11968
<?php
declare(strict_types=1);
namespace collecthor\helpers;
use yii\helpers\Html;
enum Mdi
{
case FileArrowUpDownOutline;