1 | <?php |
||||||
2 | |||||||
3 | declare(strict_types=1); |
||||||
4 | |||||||
5 | use Illuminate\Contracts\Queue\Job; |
||||||
6 | use Illuminate\Http\Request; |
||||||
0 ignored issues
–
show
|
|||||||
7 | use Symfony\Component\Console\Input\InputInterface; |
||||||
8 | use Symfony\Component\Console\Output\OutputInterface; |
||||||
9 | use Symfony\Component\HttpFoundation\Response; |
||||||
0 ignored issues
–
show
This use statement conflicts with another class in this namespace,
Response . Consider defining an alias.
Let?s assume that you have a directory layout like this: .
|-- OtherDir
| |-- Bar.php
| `-- Foo.php
`-- SomeDir
`-- Foo.php
and let?s assume the following content of // Bar.php
namespace OtherDir;
use SomeDir\Foo; // This now conflicts the class OtherDir\Foo
If both files PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php
However, as // Bar.php
namespace OtherDir;
use SomeDir\Foo as SomeDirFoo; // There is no conflict anymore.
![]() |
|||||||
10 | use Umbrellio\Jaravel\Configurations; |
||||||
11 | |||||||
12 | return [ |
||||||
13 | /** |
||||||
14 | * Enable Jaravel tracing or not. If not, noop tracer will be used. |
||||||
15 | */ |
||||||
16 | 'enabled' => env('JARAVEL_ENABLED', true), |
||||||
17 | |||||||
18 | /** |
||||||
19 | * Name of your service, that will be shown in Jaeger panel |
||||||
20 | */ |
||||||
21 | 'tracer_name' => env('JARAVEL_TRACER_NAME', 'application'), |
||||||
22 | |||||||
23 | 'agent_host' => env('JARAVEL_AGENT_HOST', 'http://127.0.0.1'), |
||||||
24 | |||||||
25 | 'agent_port' => env('JARAVEL_AGENT_PORT', 6832), |
||||||
26 | |||||||
27 | /** |
||||||
28 | * Every log in your application will be added to active span, if enabled |
||||||
29 | */ |
||||||
30 | 'logs_enabled' => env('JARAVEL_LOGS_ENABLED', true), |
||||||
31 | |||||||
32 | /** |
||||||
33 | * Describes configuration for incoming Http requests |
||||||
34 | */ |
||||||
35 | 'http' => [ |
||||||
36 | 'span_name' => Configurations\Http\SpanNameResolver::class, |
||||||
37 | 'tags' => fn (Request $request, Response $response) => [ |
||||||
38 | 'type' => 'http', |
||||||
39 | 'request_host' => $request->getHost(), |
||||||
40 | 'request_path' => $request->path(), |
||||||
41 | 'request_method' => $request->method(), |
||||||
42 | 'response_status' => $response->getStatusCode(), |
||||||
43 | 'error' => !$response->isSuccessful() && !$response->isRedirection(), |
||||||
44 | ], |
||||||
45 | ], |
||||||
46 | |||||||
47 | /** |
||||||
48 | * Describes configuration for console commands |
||||||
49 | */ |
||||||
50 | 'console' => [ |
||||||
51 | 'span_name' => fn (string $command, ?InputInterface $input = null) => 'Console: ' . $command, |
||||||
0 ignored issues
–
show
The parameter
$input is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. ![]() |
|||||||
52 | 'filter_commands' => ['schedule:run', 'horizon', 'queue:'], |
||||||
53 | 'tags' => fn (string $command, int $exitCode, ?InputInterface $input = null, ?OutputInterface $output = null) => [ |
||||||
0 ignored issues
–
show
The parameter
$output is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. ![]() The parameter
$input is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. ![]() |
|||||||
54 | 'type' => 'console', |
||||||
55 | 'console_command' => $command, |
||||||
56 | 'console_exit_code' => $exitCode, |
||||||
57 | ], |
||||||
58 | ], |
||||||
59 | |||||||
60 | /** |
||||||
61 | * Describes configuration for queued jobs |
||||||
62 | */ |
||||||
63 | 'job' => [ |
||||||
64 | 'span_name' => fn ($realJob, ?Job $job) => 'Job: ' . get_class($realJob), |
||||||
0 ignored issues
–
show
The parameter
$job is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. ![]() |
|||||||
65 | 'tags' => fn ($realJob, ?Job $job) => [ |
||||||
66 | 'type' => 'job', |
||||||
67 | 'job_class' => get_class($realJob), |
||||||
68 | 'job_id' => optional($job) |
||||||
69 | ->getJobId(), |
||||||
70 | 'job_connection_name' => optional($job) |
||||||
71 | ->getConnectionName(), |
||||||
72 | 'job_name' => optional($job) |
||||||
73 | ->getName(), |
||||||
74 | 'job_queue' => optional($job) |
||||||
75 | ->getQueue(), |
||||||
76 | 'job_attempts' => optional($job) |
||||||
77 | ->attempts(), |
||||||
78 | ], |
||||||
79 | ], |
||||||
80 | |||||||
81 | /** |
||||||
82 | * Describes configuration for Guzzle requests if you`re using middleware created by HttpTracingMiddlewareFactory |
||||||
83 | */ |
||||||
84 | 'guzzle' => [ |
||||||
85 | 'span_name' => Configurations\Guzzle\SpanNameResolver::class, |
||||||
86 | 'tags' => Configurations\Guzzle\TagsResolver::class, |
||||||
87 | ], |
||||||
88 | ]; |
||||||
89 |
Let?s assume that you have a directory layout like this:
and let?s assume the following content of
Bar.php
:If both files
OtherDir/Foo.php
andSomeDir/Foo.php
are loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php
However, as
OtherDir/Foo.php
does not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php
, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: