From ee9d8d22be5e077dd80e1e44b75315bceb31d8f6 Mon Sep 17 00:00:00 2001 From: Takuya Aramaki Date: Sun, 23 Nov 2025 18:22:30 +0900 Subject: [PATCH] Narrow string type when `ctype_*` functions return true --- conf/config.neon | 1 + stubs/ctype.stub | 51 +++++++++ tests/PHPStan/Analyser/nsrt/ctype.php | 151 ++++++++++++++++++++++++++ 3 files changed, 203 insertions(+) create mode 100644 stubs/ctype.stub create mode 100644 tests/PHPStan/Analyser/nsrt/ctype.php diff --git a/conf/config.neon b/conf/config.neon index af2a15cba5..018f87958b 100644 --- a/conf/config.neon +++ b/conf/config.neon @@ -144,6 +144,7 @@ parameters: - ../stubs/file.stub - ../stubs/stream_socket_client.stub - ../stubs/stream_socket_server.stub + - ../stubs/ctype.stub earlyTerminatingMethodCalls: [] earlyTerminatingFunctionCalls: [] resultCachePath: %tmpDir%/resultCache.php diff --git a/stubs/ctype.stub b/stubs/ctype.stub new file mode 100644 index 0000000000..872296b47a --- /dev/null +++ b/stubs/ctype.stub @@ -0,0 +1,51 @@ +