rspec/rules/S6395/php/rule.adoc

32 lines
464 B
Plaintext
Raw Normal View History

include::../description.adoc[]
== Noncompliant Code Example
2022-02-04 17:28:24 +01:00
[source,php]
----
"(?:number)\d{2}"
----
== Compliant Solution
2022-02-04 17:28:24 +01:00
[source,php]
----
"number\d{2}"
"(?:number)?\d{2}"
----
== Exceptions
This rule does not report an issue if the non-capturing group is an alternation.
[source,php]
----
"(?:number|string)"
----
== See
https://www.php.net/manual/en/regexp.reference.subpatterns.php[Subpatterns] - PHP Documentation
include::../implementation.adoc[]