sj-i /
php-fuse
| 1 | <?php |
||
| 2 | |||
| 3 | /** |
||
| 4 | * This file is part of the sj-i/php-fuse package. |
||
| 5 | * |
||
| 6 | * (c) sji <[email protected]> |
||
| 7 | * |
||
| 8 | * For the full copyright and license information, please view the LICENSE |
||
| 9 | * file that was distributed with this source code. |
||
| 10 | */ |
||
| 11 | |||
| 12 | declare(strict_types=1); |
||
| 13 | |||
| 14 | namespace Fuse\Filesystem\Log; |
||
| 15 | |||
| 16 | use Fuse\Filesystem\BeforeAll\BeforeAllFilesystem; |
||
| 17 | use Fuse\Filesystem\Delegation\DelegationFilesystemTrait; |
||
| 18 | use Fuse\Filesystem\Null\NullFilesystem; |
||
| 19 | use Fuse\Filesystem\Overlay\OverlayFilesystem; |
||
| 20 | use Fuse\FilesystemInterface; |
||
| 21 | use Psr\Log\LoggerInterface; |
||
|
0 ignored issues
–
show
|
|||
| 22 | use Psr\Log\LogLevel; |
||
|
0 ignored issues
–
show
The type
Psr\Log\LogLevel was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 23 | |||
| 24 | final class LogUnimplementedFilesystem implements FilesystemInterface |
||
| 25 | { |
||
| 26 | use DelegationFilesystemTrait; |
||
| 27 | |||
| 28 | private const DEFAULT_MESSAGE = 'An unimplemented FUSE API is called'; |
||
| 29 | |||
| 30 | private const LOG_LEVELS = [ |
||
| 31 | LogLevel::EMERGENCY, |
||
| 32 | LogLevel::ALERT, |
||
| 33 | LogLevel::CRITICAL, |
||
| 34 | LogLevel::ERROR, |
||
| 35 | LogLevel::WARNING, |
||
| 36 | LogLevel::NOTICE, |
||
| 37 | LogLevel::INFO, |
||
| 38 | LogLevel::DEBUG, |
||
| 39 | ]; |
||
| 40 | |||
| 41 | private LoggerInterface $logger; |
||
| 42 | private string $log_level; |
||
| 43 | private string $message; |
||
| 44 | |||
| 45 | /** @param value-of<self::LOG_LEVELS> $log_level */ |
||
|
0 ignored issues
–
show
|
|||
| 46 | public function __construct( |
||
| 47 | FilesystemInterface $filesystem, |
||
| 48 | LoggerInterface $logger, |
||
| 49 | string $log_level = LogLevel::DEBUG, |
||
| 50 | string $message = self::DEFAULT_MESSAGE |
||
| 51 | ) { |
||
| 52 | $this->initialize($filesystem); |
||
| 53 | $this->logger = $logger; |
||
| 54 | $this->log_level = $log_level; |
||
| 55 | $this->message = $message; |
||
| 56 | } |
||
| 57 | |||
| 58 | private function initialize(FilesystemInterface $filesystem): void |
||
| 59 | { |
||
| 60 | $this->setDelegation( |
||
| 61 | new OverlayFilesystem( |
||
| 62 | $filesystem, |
||
| 63 | new BeforeAllFilesystem( |
||
| 64 | fn(string $method, array $args) => $this->log($method, $args), |
||
| 65 | new NullFilesystem() |
||
| 66 | ) |
||
| 67 | ) |
||
| 68 | ); |
||
| 69 | } |
||
| 70 | |||
| 71 | private function log(string $method, array $args): void |
||
| 72 | { |
||
| 73 | $this->logger->log( |
||
| 74 | $this->log_level, |
||
| 75 | $this->message, |
||
| 76 | [ |
||
| 77 | 'method' => $method, |
||
| 78 | 'args' => $args |
||
| 79 | ] |
||
| 80 | ); |
||
| 81 | } |
||
| 82 | } |
||
| 83 |
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