1 | <?php |
||
2 | declare(strict_types = 1); |
||
3 | /** |
||
4 | * /src/Controller/VersionController.php |
||
5 | * |
||
6 | * @author TLe, Tarmo Leppänen <[email protected]> |
||
7 | */ |
||
8 | |||
9 | namespace App\Controller; |
||
10 | |||
11 | use App\Service\Version; |
||
0 ignored issues
–
show
|
|||
12 | use OpenApi\Attributes as OA; |
||
13 | use OpenApi\Attributes\JsonContent; |
||
14 | use OpenApi\Attributes\Property; |
||
15 | use Symfony\Component\HttpFoundation\JsonResponse; |
||
16 | use Symfony\Component\HttpFoundation\Request; |
||
17 | use Symfony\Component\HttpKernel\Attribute\AsController; |
||
18 | use Symfony\Component\Routing\Annotation\Route; |
||
19 | |||
20 | /** |
||
21 | * Class VersionController |
||
22 | * |
||
23 | * @package App\Controller |
||
24 | * @author TLe, Tarmo Leppänen <[email protected]> |
||
25 | */ |
||
26 | #[AsController] |
||
27 | class VersionController |
||
28 | { |
||
29 | 4 | public function __construct( |
|
30 | private readonly Version $version, |
||
31 | ) { |
||
32 | 4 | } |
|
33 | |||
34 | /** |
||
35 | * Route to get API version. |
||
36 | */ |
||
37 | 4 | #[Route( |
|
38 | path: '/version', |
||
39 | methods: [Request::METHOD_GET], |
||
40 | )] |
||
41 | #[OA\Get( |
||
42 | operationId: 'version', |
||
43 | responses: [ |
||
44 | new OA\Response( |
||
45 | response: 200, |
||
46 | description: 'success', |
||
47 | content: new JsonContent( |
||
48 | properties: [ |
||
49 | new Property( |
||
50 | property: 'version', |
||
51 | description: 'Version number of the API in semver format', |
||
52 | type: 'string', |
||
53 | ), |
||
54 | ], |
||
55 | type: 'object', |
||
56 | example: [ |
||
57 | 'version' => '1.2.3', |
||
58 | ], |
||
59 | ), |
||
60 | ), |
||
61 | ], |
||
62 | )] |
||
63 | public function __invoke(): JsonResponse |
||
64 | { |
||
65 | 4 | return new JsonResponse([ |
|
66 | 4 | 'version' => $this->version->get(), |
|
67 | 4 | ]); |
|
68 | } |
||
69 | } |
||
70 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths