github dereuromark/cakephp-ide-helper 2.18.0

11 hours ago

Fixes

  • bin/cake annotate all -r no longer silently strips manual @property-read lines for virtual accessors inherited from a trait, parent class, or abstract base. The tokenizer-based scan in EntityAnnotator::buildVirtualPropertyHintTypeMap() only saw _get* methods declared in the entity's own file body, so inherited accessors looked unaccounted-for and the --remove pass dropped them. A complementary reflection-based scan now fills the inheritance gap: methods whose source file differs from the entity's own file are picked up via reflection, with the type resolved from the docblock @return (preferred — keeps generics, unions, FQCNs), then the PHP return type hint, then mixed. The existing tokenizer path stays the source of truth for in-class methods. No public API change.

Improvements

  • New 'strict' tier for concreteEntitiesInParam, mirroring the genericsInParam tri-state pattern (false | true | 'strict'). On top of true, strict mode adds explicit method doc-blocks for delete(), deleteOrFail(), deleteMany(), deleteManyOrFail(), and loadInto() typed with the concrete entity class, and narrows iterable params on patchEntities / saveMany / saveManyOrFail / deleteMany / deleteManyOrFail to iterable<TEntity> even when genericsInParam is left at the default false. This gives PHPStan enough signal to reject Table::delete($order) against an InvoicesTable at static-analysis time, mirroring the runtime guard discussed in cakephp/cakephp#19428. Both DocBlockHelper (bake template) and ModelAnnotator share the new branch so freshly-baked and re-annotated output stay aligned. Method order follows the existing builder convention (delete / deleteOrFail before deleteMany / deleteManyOrFail, loadInto last). Fully opt-in — existing true users see no change; association methods (link, unlink, replaceLinks, …) are intentionally out of scope.

  • Generated table doc-blocks now emit @extends first, aligning with the class-level tag order proposed in php-collective/code-sniffer#59 (template, extends, implements, property, property-read, property-write, method, mixin). Applies to fresh annotations via the addNewDocBlock path; the append-to-existing path is unchanged — full reordering of legacy doc-blocks is left to the sniff fixer to avoid duplicating its work.

  • TestClassAnnotatorTask is now a PathAwareClassAnnotatorTaskInterface consumer (declares tests/TestCase via scanPaths()), and the dedicated tests/TestCase/ walk inside ClassesCommand::execute() is removed. The last remaining "special" path is folded into the unified path-aware mechanism introduced in 2.17.0; per-task shouldRun() gating is preserved so the same files are visited and the same tasks fire. Third-party tasks that declare overlapping roots now collapse via the shared dedup map instead of double-walking. Behavior is unchanged for users who keep the default task list.

Full Changelog: 2.17.0...2.18.0

Don't miss a new cakephp-ide-helper release

NewReleases is sending notifications on new releases.