Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve return types for Table methods #27

Merged
merged 17 commits into from
Feb 5, 2024

Conversation

rochamarcelo
Copy link
Contributor

Improved return types, this will cover models without custom phpdoc @method

  1. Provide correct return type for Cake\ORM\Table::get based on your table class name

  2. Provide correct return type for Cake\ORM\Table::newEntity based on your table class name

  3. Provide correct return type for Cake\ORM\Table::newEntities based on your table class name

  4. Provide correct return type for Cake\ORM\Table::newEmptyEntity based on your table class name

  5. Provide correct return type for Cake\ORM\Table::findOrCreate based on your table class name

  6. Provide correct return type for Cake\ORM\Table::patchEntity based on the first argument passed

  7. Provide correct return type for Cake\ORM\Table::patchEntities based on the first argument passed

  8. Provide correct return type for Cake\ORM\Table::save based on the first argument passed

  9. Provide correct return type for Cake\ORM\Table::saveOrFail based on the first argument passed

  10. Provide correct return type for Cake\ORM\Table::saveMany based on the first argument passed

  11. Provide correct return type for Cake\ORM\Table::saveManyOrFail based on the first argument passed

  12. Provide correct return type for Cake\ORM\Table::deleteMany based on the first argument passed

  13. Provide correct return type for Cake\ORM\Table::deleteManyOrFail based on the first argument passed

Fixed how extension detect Table::findBy* to correct set expected parameters and return type.

Improved integration tests with rules

- Symplify\PHPStanRules\Rules\Explicit\NoMixedPropertyFetcherRule
- Symplify\PHPStanRules\Rules\Explicit\NoMixedMethodCallerRule

…ity|newEmptyEntity|patchEntity|findOrCreate|saveOrFail
…the first argument: Table::saveOrFail, Table::patchEntity
…the first argument: Table::save, Table::saveManyOrFail and Table::deleteManyOrFail
…s the first argument: Table::saveMany and Table::deleteMany
…M\Association\BelongsTo<\App\Model\Table\UsersTable> $Users`
…t covered by backward compatibility promise. The class might change in a minor PHPStan version.
@steinkel steinkel merged commit 8c91584 into 3.next-cake5 Feb 5, 2024
5 checks passed
@rochamarcelo rochamarcelo deleted the feature/table-entity-return-type branch February 7, 2024 11:28
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.

2 participants