Skip to content

Update isValidCns logic to include CNS starting with 5 #59

Description

@marianaflima

I need to update isValidCns() function on src/Helpers/Validate.php

Currently, the function validate_cns_tmp() only triggers for CNS numbers starting in 7, 8, or 9. Based on this documentation, numbers starting with 5 are now also valid and should follow the same validation logic.

I want you to locate where the conditional responsible for checking this out and add 5 to allowed digits.

To assure implementation is correct, I want you to generate/update test suites with the following examples:
Valid ones:

  • 550354737380003
  • 521473152170018
    Invalid ones:
  • 503521996570006
  • 556492895730003
  • 584480646290007

Activity

  1. self-assigned this
    on Mar 2, 2026
  2. changed the title [-]Change cns validator[/-] [+]Update isValidCns logic to include CNS starting with 5[/+] on Mar 2, 2026
  3. google-labs-jules commented on Mar 2, 2026

    @google-labs-jules
    Contributor

    Jules is on it. When finished, you will see another comment and be able to review a PR.

  4. deleted a comment from lucasn4s on Mar 2, 2026
  5. google-labs-jules commented on Mar 2, 2026

    @google-labs-jules
    Contributor

    Ready for a review! A PR has been created.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions