Commit 019a4189 authored by Tim Rohaly's avatar Tim Rohaly Committed by Tim Rohaly
Browse files

Issue #3276530 by TR: Add parameter and return type hints to service methods

parent db399a75
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -293,7 +293,7 @@ class HoneypotService implements HoneypotServiceInterface {
   * @param array $complete_form
   *   The complete form structure.
   */
  public function validateHoneypot(array &$element, FormStateInterface $form_state, array &$complete_form) {
  public function validateHoneypot(array &$element, FormStateInterface $form_state, array &$complete_form): void {
    // Get the honeypot field value.
    $honeypot_value = $element['#value'];

@@ -315,7 +315,7 @@ class HoneypotService implements HoneypotServiceInterface {
   * @param array $complete_form
   *   The complete form structure.
   */
  public function validateTimeRestriction(array &$element, FormStateInterface $form_state, array &$complete_form) {
  public function validateTimeRestriction(array &$element, FormStateInterface $form_state, array &$complete_form): void {
    if ($form_state->isProgrammed()) {
      // Don't do anything if the form was submitted programmatically.
      return;
@@ -354,7 +354,7 @@ class HoneypotService implements HoneypotServiceInterface {
   *   - honeypot: If honeypot field was filled in.
   *   - honeypot_time: If form was completed before the configured time limit.
   */
  protected function log($form_id, $type): void {
  protected function log(string $form_id, string $type): void {
    $this->logFailure($form_id, $type);
    if ($this->config->get('log')) {
      $variables = [
@@ -368,7 +368,7 @@ class HoneypotService implements HoneypotServiceInterface {
  /**
   * {@inheritdoc}
   */
  public function logFailure($form_id, $type): void {
  public function logFailure(string $form_id, string $type): void {
    $uid = $this->account->id();

    // Log failed submissions.
+1 −1
Original line number Diff line number Diff line
@@ -52,6 +52,6 @@ interface HoneypotServiceInterface {
   *   - honeypot: If honeypot field was filled in.
   *   - honeypot_time: If form was completed before the configured time limit.
   */
  public function logFailure($form_id, $type): void;
  public function logFailure(string $form_id, string $type): void;

}