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

Adds new documentation for PostCode validator #16

Merged
merged 8 commits into from
Mar 15, 2020

Conversation

froschdesign
Copy link
Member

Q A
Documentation yes

docs/book/validators/post-code.md Outdated Show resolved Hide resolved
docs/book/validators/post-code.md Outdated Show resolved Hide resolved
### Conventions for self defined Formats

When using self defined formats, you should omit the regex delimiters and
anchors (`'/^'` and `'$/'`). They are attached automatically.
Copy link
Member

Choose a reason for hiding this comment

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

As I have checked in the code it is true when we skip delimiters, completely, but if we use other delimiters than / it will break the regexp by attaching additional /^ and $/. We can provide regexp as: #^AT-\d{3}$# but internally it will be broken and changed to: /^#^AT-\d{3}$#$/

Copy link
Member Author

Choose a reason for hiding this comment

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

The question that arises here: is the documentation wrong or the code which handles this behaviour?
In my opinion the simple handling should be in the foreground and the code should realize this.

Copy link
Member

Choose a reason for hiding this comment

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

I would prefer to detect any delimiter used, but the question is if we can do that in any reliable way?
Hm... I would need to think about it.

In general I do not like idea of attaching /^ and $/ (maybe / is the most used, but is not the only/valid one and there are sometimes good reasons to use another).

Copy link
Member Author

Choose a reason for hiding this comment

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

If we have a problem here then a separate issue report is needed.

Copy link
Member

Choose a reason for hiding this comment

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

@froschdesign I've created issue: #18

docs/book/validators/post-code.md Outdated Show resolved Hide resolved
michalbundyra added a commit that referenced this pull request Mar 15, 2020
@michalbundyra michalbundyra merged commit 43b3c4c into laminas:master Mar 15, 2020
@michalbundyra
Copy link
Member

Thanks, @froschdesign!

@froschdesign froschdesign deleted the hotfix/docs/post-code branch March 15, 2020 15:52
@froschdesign froschdesign linked an issue Mar 16, 2020 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Documentation update
2 participants