rspec/rules/S5850/php/rule.adoc
2022-02-04 16:28:24 +00:00

34 lines
331 B
Plaintext

include::../description.adoc[]
== Noncompliant Code Example
[source,php]
----
/^a|b|c$/
----
== Compliant Solution
[source,php]
----
/^(?:a|b|c)$/
----
or
[source,php]
----
/^a$|^b$|^c$/
----
or, if you do want the anchors to only apply to ``++a++`` and ``++c++`` respectively:
[source,php]
----
/(?:^a)|b|(?:c$)/
----