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

PHAN refactoring improvements #4537

Merged
merged 13 commits into from
Nov 14, 2023
Merged

Conversation

marcovtwout
Copy link
Member

Q A
Is bugfix? ✔️
New feature?
Breaks BC?
Tests pass? ✔️
Fixed issues #4533

Fixes:
- base/CComponent.php:148 PhanTypeMagicVoidWithReturn Found a return statement with a value in the implementation of the magic method \CComponent::__set, expected void return type
- base/CComponent.php:215 PhanTypeMagicVoidWithReturn Found a return statement with a value in the implementation of the magic method \CComponent::__unset, expected void return type
Fixes:
- base/CSecurityManager.php:528 PhanTypeMissingReturn Method \CSecurityManager::validateEncryptionKey is declared to return bool in phpdoc but has no return value
Fixes:
- caching/CCache.php:376 PhanTypeMissingReturn Method \CCache::offsetUnset is declared to return bool in phpdoc but has no return value
- caching/CDummyCache.php:164 PhanTypeMissingReturn Method \CDummyCache::offsetUnset is declared to return bool in phpdoc but has no return value
Fixes:
- cli/commands/shell/ModelCommand.php:127 PhanTypeMissingReturn Method \ModelCommand::generateRelations is declared to return array in phpdoc but has no return value
Fixes:
- db/schema/mssql/CMssqlPdoAdapter.php:23 PhanUnextractableAnnotationElementName Saw possibly unextractable annotation for a fragment of comment '* @param string|null sequence name. Defaults to null': after string|null, did not see an element name (will guess based on comment order)
Fixes:
- gii/generators/model/ModelCode.php:365 PhanUnextractableAnnotationElementName Saw possibly unextractable annotation for a fragment of comment '* @param CDbTableSchema table to inspect': after CDbTableSchema, did not see an element name (will guess based on comment order)
- gii/generators/model/ModelCode.php:397 PhanUnextractableAnnotationElementName Saw possibly unextractable annotation for a fragment of comment '* @param string the name of the table to hold the relation': after string, did not see an element name (will guess based on comment order)
- gii/generators/model/ModelCode.php:398 PhanUnextractableAnnotationElementName Saw possibly unextractable annotation for a fragment of comment '* @param string the foreign key name': after string, did not see an element name (will guess based on comment order)
- gii/generators/model/ModelCode.php:399 PhanUnextractableAnnotationElementName Saw possibly unextractable annotation for a fragment of comment '* @param boolean whether the relation would contain multiple objects': after boolean, did not see an element name (will guess based on comment order)
Fixes:
- gii/generators/model/ModelGenerator.php:12 PhanTypeMissingReturn Method \ModelGenerator::actionGetTableNames is declared to return string in phpdoc but has no return value
Fixes:
- messages/ca/yii.php:88 PhanPluginDuplicateArrayKey Duplicate/Equivalent array key value('Alias "{alias}" is invalid. Make sure it points to an existing directory or file.') detected in array - the earlier entry 'Alias "{alias}" is invalid. Make sure it points to an existing directory or file.' at line 87 will be ignored.
Fixes:
- web/CHttpSessionIterator.php:33 PhanUnextractableAnnotationElementName Saw possibly unextractable annotation for a fragment of comment '* @param array the data to be iterated through': after array, did not see an element name (will guess based on comment order)
Fixes:
- web/actions/CViewAction.php:98 PhanTypeMissingReturn Method \CViewAction::resolveView is declared to return string in phpdoc but has no return value
Fixes:
- web/widgets/COutputCache.php:162 PhanTypeMissingReturn Method \COutputCache::filter is declared to return bool in phpdoc but has no return value
@what-the-diff
Copy link

what-the-diff bot commented Sep 27, 2023

PR Summary

  • Enhanced Code Cleanliness
    Enhancements were made to organize the codebase better, through various refactorings, based on checks run through PHPStan.

  • Removed Redundant Annotations in Multiple Files
    In several files (including but not limited to CComponent.php, CSecurityManager.php, CCache.php, CMssqlPdoAdapter.php, ModelGenerator.php, CHttpSessionIterator.php, CViewAction.php, and COutputCache.php), unnecessary usage of the @return and @throws annotations was detected and has been eradicated.

  • Elimination of Unnecessary Comments
    Unnecessary and meaningless comments were identified and removed in ModelCommand.php and ModelCode.php.

  • Optimization of Translation Handling
    The PR includes a removal of unnecessary translations in yii.php resulting in a cleaner, more efficient code, enhancing the overall performance of the codebase.

@marcovtwout marcovtwout mentioned this pull request Sep 27, 2023
@marcovtwout marcovtwout changed the title PHPStan check refactoring improvements PHAN refactoring improvements Sep 27, 2023
Copy link
Contributor

@mdeweerd mdeweerd left a comment

Choose a reason for hiding this comment

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

Good for me.

@marcovtwout marcovtwout merged commit 6d8e867 into master Nov 14, 2023
24 checks passed
@marcovtwout marcovtwout deleted the 4533-phan-check-improvements branch November 14, 2023 07:40
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.

4 participants