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

Added return types for methods in models #547

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Erkinbek
Copy link

@Erkinbek Erkinbek commented Feb 12, 2024

Q A
Is bugfix?
New feature?
Breaks BC?
Fixed issues Added method return types

Copy link

what-the-diff bot commented Feb 12, 2024

PR Summary

  • Changes to Generator.php in model generation
    This update modifies how we generate models in the system. Depending on the PHP version being used, it can now select between two different templates. This allows for better compatibility across different PHP versions.

  • Addition of a new model template model_from_7.php
    A new model template has been added to the system. This new template is specifically designed for generating model classes based on a particular table when the PHP version is 7 or above, providing a more tailored experience for developers using these versions.

  • Updates to ModelGeneratorTest.php for improved testing
    The testing module for model generation has been updated to reflect the changes in the Generator.php file. This ensures that the tests are adequate and cover the new logic for selecting the appropriate model template based on the PHP version. This is crucial for ensuring the smooth operation of our model generation process moving forward.

@@ -310,9 +310,12 @@ public function generate()
'relationsClassHints' => $this->generateRelationsClassHints($tableRelations, $this->generateQuery),
'enum' => $this->getEnum($tableSchema->columns),
];

$template = phpversion() < '7' ? 'model.php': 'model_from_7.php';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$template = phpversion() < '7' ? 'model.php': 'model_from_7.php';
$template = phpversion() < '7' ? 'model.php': 'model_with_types.php';

@samdark
Copy link
Member

samdark commented Feb 12, 2024

Overall it's a good idea.

@samdark samdark added the type:enhancement Enhancement label Feb 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:enhancement Enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants