Skip to content

SmartObject: @property with whitespace or newlines inside the type is silently ignored#339

Open
mabar wants to merge 2 commits into
nette:masterfrom
mabar:fix-space-in-phpdoc-type
Open

SmartObject: @property with whitespace or newlines inside the type is silently ignored#339
mabar wants to merge 2 commits into
nette:masterfrom
mabar:fix-space-in-phpdoc-type

Conversation

@mabar

@mabar mabar commented Jul 8, 2026

Copy link
Copy Markdown
Contributor
  • bug fix
  • BC break? no

ObjectHelpers::getMagicProperties() does not recognize a @property annotation when the type contains whitespace, which is common with generics and array shapes. The properties are silently dropped and lead to member access exception at runtime. It bit me while adding types to an old codebase

Fixed regex now parses the types with newlines and whitespace properly and with no backtracking

I have also noticed the same issue in strictGet/strictSet, "did you mean" hint was missing. Fixed in second commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant