Skip to content

Instantly share code, notes, and snippets.

View staabm's full-sized avatar
👋

Markus Staab staabm

👋
View GitHub Profile
<?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;
@staabm
staabm / bug12159.php
Created November 29, 2024 20:07
reduced phpstan bug 12159
<?php
$func = static fn( int $Point ) : int => TestMatrix::Values[ $Point ][ 0 ];
$foo =
[
[ 'val' => $func( 1237123 ) ],
[ 'val' => $func( 4379284 ) ],
[ 'val' => $func( 4534895 ) ],
[ 'val' => $func( 9483754 ) ],
[ 'val' => $func( 8127361 ) ],
@staabm
staabm / slow.php
Created July 6, 2024 06:17
PHPStan bug 11283
<?php
declare(strict_types=1);
/**
* Partial copy of https://github.com/reactphp/promise/blob/3.x/src/PromiseInterface.php
* @template-covariant T
*/
interface PromiseInterface
{
@staabm
staabm / Linter.php
Last active December 10, 2023 08:40
fast-lint
<?php
declare(strict_types=1);
/*
* This file is part of the overtrue/phplint package
*
* (c) overtrue
*
* This source file is subject to the MIT license that is bundled