Closed Erkinbek closed 9 months ago
Q | A |
---|---|
Is bugfix? | ❌ |
New feature? | ❌ |
Breaks BC? | ❌ |
Fixed issues | Added return types |
Modification on controller.php
in generators/crud/default
directory
yii\web\Response
library has been introduced. This could facilitate handling of HTTP requests and responses within the CRUD operations.string
, Response
or array type. Updates to model.php
in generators/model/default
directory
Changes in controller.php
in generators/module/default
directory
actionIndex()
, has been changed to string
. This change is expected to provide better control and management of the output generated by this function.From a less-technical perspective, these changes should enhance the reliability and consistency of the application, and potentially make it less prone to errors related to mismatched or unexpected return types.
It won't work with older PHP versions.
It won't work with older PHP versions.
If create own templates for each PHP version, it will work.
All time when i generate code with gii, my idea (PHPStorm) will shows this lines as not optimized code. So if people are using old versions of php, just need close this PR. Thank you for your attention :)
Idea no bad! In https://github.com/yiisoft/yii2-gii/blob/master/src/generators/model/Generator.php#L313
if (phpversion() < '5.2' ) {
$template = 'model_52.php';
} elseif {phpversion() >= '5.2' && phpversion() < '5.7'} {
$template = 'model_52_57.php';
} elseif {phpversion() >= '5.7' && phpversion() < '7.4'} {
$template = 'model_57_74.php';
} {
$template = 'model_74.php';
}
$files[] = new CodeFile(
Yii::getAlias('@' . str_replace('\\', '/', $this->ns)) . '/' . $modelClassName . '.php',
$this->render($template, $params)
);
For each PHP version own model_*php.
OK. I'll fix it