-
-
Notifications
You must be signed in to change notification settings - Fork 388
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
Add PHPDoc blocks to AbstractMigration #1052
base: 3.0.x
Are you sure you want to change the base?
Add PHPDoc blocks to AbstractMigration #1052
Conversation
cfbd10f
to
b45758d
Compare
Why would it be useful? |
Hey,
You have a description of the methods on the site, why not place the documentation in the code to save programmers from the need to google or research the code in depth to understand its work? |
That's a good point, maybe there is valuable information here that could be fit in the comments. |
I got it. So, do I understand correctly, if I add a more useful description for the P.S. I took a description of all methods from the official site (for method |
@@ -60,11 +60,22 @@ public function isTransactional() : bool | |||
return true; | |||
} | |||
|
|||
/** | |||
* Description of this migration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tautological, either improve or remove
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
* | ||
* @return string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing new here, let's remove it
* | |
* @return string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
* | ||
* @param bool $condition | ||
* @param string $message |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* | |
* @param bool $condition | |
* @param string $message |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
public function getDescription() : string | ||
{ | ||
return ''; | ||
} | ||
|
||
/** | ||
* Warn with a message if some condition is met. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's made fairly clear just by reading the signature (you don't have to read the code inside the method)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
@@ -155,6 +166,11 @@ public function getSql() : array | |||
return $this->plannedSql; | |||
} | |||
|
|||
/** | |||
* Write some debug information to the console. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
debug information is written with debug()
, this is a notice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
* | ||
* @param string $message |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* | |
* @param string $message |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
phpcs.xml.dist
Outdated
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint.UselessAnnotation"> | ||
<exclude-pattern>lib/Doctrine/Migrations/AbstractMigration.php</exclude-pattern> | ||
</rule> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
It's the opposite actually, if we merge the PR, then it means you will have added a more useful description for that method, but that will probably not be enough, since other methods need a better description too. |
b45758d
to
62f6570
Compare
/** | ||
* Description of this migration. | ||
* | ||
* Describe what this migration does in simple terms. This information is displayed when you view the list of migrations. | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/** | |
* Description of this migration. | |
* | |
* Describe what this migration does in simple terms. This information is displayed when you view the list of migrations. | |
*/ | |
/** | |
* Describe what this migration does in simple terms. This information is displayed when you view the list of migrations. | |
*/ |
/** | ||
* Write some debug information to the console. | ||
* | ||
* Debug information is written with debug(). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 I mean it should, but it's actually written with notice()
, so that comment is just misleading
Summary
Add PHPDoc blocks to AbstractMigration methods. This could be useful for those who use
@inheritdoc
annotation (like me:)).