diff --git a/rules/S5797/description.adoc b/rules/S5797/description.adoc
new file mode 100644
index 00000000000..09850b05f70
--- /dev/null
+++ b/rules/S5797/description.adoc
@@ -0,0 +1,5 @@
+This rule raises an issue when a constant expression is used as a condition in an ``++if++``, ``++elif++``, a conditional expression or other boolean expressions.
+
+== Why is this an issue?
+
+When a constant is used as a condition, either it has no effect on the execution flow and it can be removed, or some code will never be executed and it is a bug.
diff --git a/rules/S5797/php/metadata.json b/rules/S5797/php/metadata.json
new file mode 100644
index 00000000000..7a73a41bfdf
--- /dev/null
+++ b/rules/S5797/php/metadata.json
@@ -0,0 +1,2 @@
+{
+}
\ No newline at end of file
diff --git a/rules/S5797/php/rule.adoc b/rules/S5797/php/rule.adoc
new file mode 100644
index 00000000000..c8211f6024e
--- /dev/null
+++ b/rules/S5797/php/rule.adoc
@@ -0,0 +1,34 @@
+include::../description.adoc[]
+
+== How to fix it
+
+=== Code examples
+
+==== Noncompliant code example
+
+[source,php,diff-id=1,diff-type=noncompliant]
+----
+function foo() {
+    if (true) { // Noncompliant: the condition is always true
+        return 1;
+    } else {
+        return 2;
+    }
+}
+----
+
+==== Compliant solution
+
+[source,php,diff-id=1,diff-type=compliant]
+----
+function foo() {
+    $a = bar();
+    if ($a) {
+        return 1;
+    } else {
+        return 2;
+    }
+}
+----
+
+include::../rule.adoc[]
diff --git a/rules/S5797/python/rule.adoc b/rules/S5797/python/rule.adoc
index c45be3615f0..5523a2715ea 100644
--- a/rules/S5797/python/rule.adoc
+++ b/rules/S5797/python/rule.adoc
@@ -1,19 +1,38 @@
-include::../rule.adoc[]
+include::../description.adoc[]
+
+=== Code examples
+
+==== Noncompliant code example
 
-ifdef::env-github,rspecator-view[]
+[source,python,diff-id=1,diff-type=noncompliant]
+----
+def foo():
+    a = True
+    if a: # Noncompliant: the condition is always true
+      return 1
+    else:
+      return 2
+----
 
-'''
-== Implementation Specification
-(visible only on this page)
 
-include::../message.adoc[]
+==== Compliant solution
 
-include::../highlighting.adoc[]
+[source,python,diff-id=1,diff-type=compliant]
+----
+def foo():
+    a = bar()
+    if a:
+      return 1
+    else:
+      return 2
+----
 
-'''
-== Comments And Links
-(visible only on this page)
 
-include::../comments-and-links.adoc[]
+== Resources
 
-endif::env-github,rspecator-view[]
+=== Documentation
+
+* Python documentation - https://www.python.org/dev/peps/pep-0285/[PEP 285 - Adding a bool type]
+* Python documentation - https://docs.python.org/3/library/stdtypes.html#truth-value-testing[Python documentation - Truth Value Testing]
+
+include::../rule.adoc[]
diff --git a/rules/S5797/rule.adoc b/rules/S5797/rule.adoc
index 78f353d8d3b..3068e7fd2df 100644
--- a/rules/S5797/rule.adoc
+++ b/rules/S5797/rule.adoc
@@ -1,40 +1,17 @@
-This rule raises an issue when a constant expression is used as a condition in an ``++if++``, ``++elif++``, a conditional expression or other boolean expressions.
+ifdef::env-github,rspecator-view[]
 
-== Why is this an issue?
+'''
+== Implementation Specification
+(visible only on this page)
 
-When a constant is used as a condition, either it has no effect on the execution flow and it can be removed, or some code will never be executed and it is a bug.
+include::./message.adoc[]
 
+include::./highlighting.adoc[]
 
-=== Noncompliant code example
+'''
+== Comments And Links
+(visible only on this page)
 
-[source,python,diff-id=1,diff-type=noncompliant]
-----
-def foo():
-    a = True
-    if a: # Noncompliant: the condition is always true
-      return 1
-    else:
-      return 2
-----
-
-
-=== Compliant solution
-
-[source,python,diff-id=1,diff-type=compliant]
-----
-def foo():
-    a = bar()
-    if a:
-      return 1
-    else:
-      return 2
-----
-
-
-== Resources
-
-=== Documentation
-
-* Python documentation - https://www.python.org/dev/peps/pep-0285/[PEP 285 - Adding a bool type]
-* Python documentation - https://docs.python.org/3/library/stdtypes.html#truth-value-testing[Python documentation - Truth Value Testing]
+include::./comments-and-links.adoc[]
 
+endif::env-github,rspecator-view[]