Simplify hook patterns using *MARK

Created on 19 July 2025, 3 days ago

Problem/Motivation

The Lexer class in phpstan/phpdoc-parser uses this $pattern = '(?:' . $pattern . ')(*MARK:' . $type . ')';. This might come as a surprise because up until yesterday support for *MARK in PHP was undocumented (it now is because I documented it). However, a quick look at the PHP source confirms support. We totally could and should follow. It majorly simplifies the entire hook pattern mechanism: some 48 lines can be deleted including a runtime query.

Steps to reproduce

  1. Look at Lexer
  2. Go hmmm

Proposed resolution

Delete, delete, delete.

Remaining tasks

Ain't much.

User interface changes

API changes

DocBlockInterface::getHookFunction is gone. We hardly knew ya.

Data model changes

πŸ“Œ Task
Status

Needs review

Version

2.0

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada Charlie ChX Negyesi 🍁Canada

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024