
Improvement identified in #2790. Add a prefix to the diff-id when it is used multiple times in different "how to fix it in XYZ" sections to avoid ambiguity and pedantically follow the spec: > A single and unique diff-id should be used only once for each type of code example as shown in the description of a rule. Obvious typos around `diff-type` were fixed.
32 lines
615 B
Plaintext
32 lines
615 B
Plaintext
== How to fix it in Laravel
|
|
|
|
=== Code examples
|
|
|
|
include::../../common/fix/code-rationale.adoc[]
|
|
|
|
==== Noncompliant code example
|
|
|
|
[source,php,diff-id=11,diff-type=noncompliant]
|
|
----
|
|
Route::get('/router', function () {
|
|
$route = Input::get('route');
|
|
return redirect($route); // Noncompliant
|
|
});
|
|
----
|
|
|
|
==== Compliant solution
|
|
|
|
[source,php,diff-id=11,diff-type=compliant]
|
|
----
|
|
Route::get('/router', function () {
|
|
$route = Input::get('route');
|
|
return redirect()->route($route);
|
|
});
|
|
----
|
|
|
|
include::../../common/fix/how-does-this-work.adoc[]
|
|
|
|
=== Pitfalls
|
|
|
|
include::../../common/pitfalls/starts-with.adoc[]
|