1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
* This file is part of the Valkyrja Framework package. |
7
|
|
|
* |
8
|
|
|
* (c) Melech Mizrachi <[email protected]> |
9
|
|
|
* |
10
|
|
|
* For the full copyright and license information, please view the LICENSE |
11
|
|
|
* file that was distributed with this source code. |
12
|
|
|
*/ |
13
|
|
|
|
14
|
|
|
namespace Valkyrja\Application\Cli\Command; |
15
|
|
|
|
16
|
|
|
use Valkyrja\Application\Env; |
|
|
|
|
17
|
|
|
use Valkyrja\Cli\Interaction\Factory\Contract\OutputFactory; |
18
|
|
|
use Valkyrja\Cli\Interaction\Message\Banner; |
19
|
|
|
use Valkyrja\Cli\Interaction\Message\Message; |
20
|
|
|
use Valkyrja\Cli\Interaction\Message\NewLine; |
21
|
|
|
use Valkyrja\Cli\Interaction\Message\SuccessMessage; |
22
|
|
|
use Valkyrja\Cli\Interaction\Output\Contract\Output; |
23
|
|
|
use Valkyrja\Cli\Routing\Attribute\Command as CommandAttribute; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Class ClearCacheCommand. |
27
|
|
|
* |
28
|
|
|
* @author Melech Mizrachi |
29
|
|
|
*/ |
30
|
|
|
class ClearCacheCommand |
31
|
|
|
{ |
32
|
|
|
#[CommandAttribute( |
33
|
|
|
name: 'config:clear-cache', |
34
|
|
|
description: 'Clear config cache', |
35
|
|
|
helpText: new Message('A command to clear the config cache.'), |
36
|
|
|
)] |
37
|
|
|
public function run(Env $env, OutputFactory $outputFactory): Output |
38
|
|
|
{ |
39
|
|
|
/** @var non-empty-string $cacheFilePath */ |
40
|
|
|
$cacheFilePath = $env::APP_CACHE_FILE_PATH; |
41
|
|
|
|
42
|
|
|
// If the cache file already exists, delete it |
43
|
|
|
if (is_file($cacheFilePath)) { |
44
|
|
|
@unlink($cacheFilePath); |
|
|
|
|
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
return $outputFactory |
48
|
|
|
->createOutput() |
49
|
|
|
->withMessages( |
50
|
|
|
new Banner(new SuccessMessage('Application config cache cleared successfully.')), |
51
|
|
|
new NewLine(), |
52
|
|
|
); |
53
|
|
|
} |
54
|
|
|
} |
55
|
|
|
|
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