Skip to content

[TASK] #593: generate phpstan-compatible code (void return types, @var array<mixed>)#813

Draft
PKuhlmay wants to merge 1 commit intomasterfrom
feature/issue-593-phpstan-compatibility
Draft

[TASK] #593: generate phpstan-compatible code (void return types, @var array<mixed>)#813
PKuhlmay wants to merge 1 commit intomasterfrom
feature/issue-593-phpstan-compatibility

Conversation

@PKuhlmay
Copy link
Copy Markdown
Collaborator

Summary

Fixes #593 — generates phpstan-compatible code for basic TYPO3 extensions.

  • : void return types on setter methods: Fixed a parsing bug in ClassFactory::buildClassMethodObject() that silently dropped void (and other primitive types) when reading method templates. PHP-Parser represents void as an Identifier node, not FullyQualified — the condition was too narrow.
  • : void return types on inject methods: Same root cause — existing inject methods with : void lost their return type during round-trip parsing. Now preserved correctly.
  • @var array<mixed> on $defaultOrderings: Added the missing PHPDoc annotation to Repository.phpt so generated repositories pass phpstan without warnings.
  • Correct code output: Fixed NodeFactory::buildMethodNode() to emit primitive return types as Identifier nodes (output: void) instead of FullyQualified (which would incorrectly output \void).

Changes

  • Classes/Parser/ClassFactory.php — handle Identifier return type nodes
  • Classes/Parser/NodeFactory.php — emit primitive types as Identifier, class types as FullyQualified
  • Resources/Private/CodeTemplates/Extbase/Classes/Domain/Repository/Repository.phpt — add @var array<mixed> to $defaultOrderings
  • Tests/Unit/Parser/ClassFactoryTest.php — two new tests covering the parsing and output round-trip

Test plan

  • buildClassMethodObjectParsesVoidReturnType — verifies : void is parsed correctly
  • buildMethodNodeOutputsVoidReturnTypeWithoutLeadingBackslash — verifies output is : void not : \void
  • All 155 unit tests pass
  • PHPStan: no errors

🤖 Generated with Claude Code

@PKuhlmay PKuhlmay changed the title Fix #593: generate phpstan-compatible code (void return types, @var array<mixed>) [BUGFIX] #593: generate phpstan-compatible code (void return types, @var array<mixed>) Apr 11, 2026
@github-actions github-actions bot added bug Something isn't working enhancement New feature or request maintenance labels Apr 11, 2026
@PKuhlmay PKuhlmay changed the title [BUGFIX] #593: generate phpstan-compatible code (void return types, @var array<mixed>) [TASK] #593: generate phpstan-compatible code (void return types, @var array<mixed>) Apr 12, 2026
@github-actions github-actions bot removed the bug Something isn't working label Apr 12, 2026
@PKuhlmay PKuhlmay added the WIP Work in progress, but not finished yet label Apr 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request maintenance WIP Work in progress, but not finished yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make it compatible with phpstan

1 participant