This is a spin-off from #2621486: Fixes to migrate/tests/src/Unit/*.php files. In that issue, the constructor() method of core/modules/migrate/tests/src/Unit/TestSqlIdMap.php was corrected by hand for the missing @param directive for the final variable $event_dispatcher. For some reason, the FunctionCommentSniff.php sniff is not catching this missing @param directive.
Good example:
/**
* Constructs a TestSqlIdMap object.
*
* @param \Drupal\Core\Database\Connection $database
* The database.
* @param array $configuration
* The configuration.
* @param string $plugin_id
* The plugin ID for the migration process to do.
* @param mixed $plugin_definition
* The configuration for the plugin.
* @param \Drupal\migrate\Entity\MigrationInterface $migration
* The migration to do.
* @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
* The event dispatcher service.
*/
public function __construct(Connection $database, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, EventDispatcherInterface $event_dispatcher) {
}
Bad example:
/**
* Constructs a TestSqlIdMap object.
*
* @param \Drupal\Core\Database\Connection $database
* The database.
* @param array $configuration
* The configuration.
* @param string $plugin_id
* The plugin ID for the migration process to do.
* @param mixed $plugin_definition
* The configuration for the plugin.
* @param \Drupal\migrate\Entity\MigrationInterface $migration
* The migration to do.
*/
public function __construct(Connection $database, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, EventDispatcherInterface $event_dispatcher) {
}
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | create_sniff_for-2624558-4.patch | 2.81 KB | YurkinPark |
Comments
Comment #2
anoopjohn commentedI checked this. It does not look like we have a rule that catches a missing @param directive at all. What we have is a rule that checks if the actual comment in a @param directive is missing and that gives the MissingParamComment error.
Comment #3
andypostConfirm bug, functions that have patams but does not declare them in doc block pass.
Same time we still have hooks that should omit params - that maybe really tricky to handle
Comment #4
YurkinPark commentedThis could be a solution
Comment #5
YurkinPark commentedComment #6
klausiCool, can you file a pull request against https://github.com/klausi/coder/pulls and add a test case?
Comment #7
YurkinPark commentedPull request created
https://github.com/klausi/coder/pull/21
Comment #10
klausiThanks!
So this was a bit tricky because we allow omission of param tags: