ricardosierra /
translation
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Translation\Routes; |
||
| 4 | |||
| 5 | use Illuminate\Routing\ResourceRegistrar as LRR; |
||
|
0 ignored issues
–
show
|
|||
| 6 | use Illuminate\Routing\Router; |
||
|
0 ignored issues
–
show
The type
Illuminate\Routing\Router 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...
|
|||
| 7 | use Translation\Repositories\LanguageRepository; |
||
| 8 | |||
| 9 | class ResourceRegistrar extends LRR |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * The language repository. |
||
| 13 | * |
||
| 14 | * @var array |
||
| 15 | */ |
||
| 16 | protected $languageRepository; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * Create a new resource registrar instance. |
||
| 20 | * |
||
| 21 | * @param \Illuminate\Routing\Router $router |
||
| 22 | * @return void |
||
| 23 | */ |
||
| 24 | public function __construct(Router $router, LanguageRepository $languageRepository) |
||
| 25 | { |
||
| 26 | parent::__construct($router); |
||
| 27 | $this->languageRepository = $languageRepository; |
||
|
0 ignored issues
–
show
It seems like
$languageRepository of type Translation\Repositories\LanguageRepository is incompatible with the declared type array of property $languageRepository.
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property. Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property.. Loading history...
|
|||
| 28 | } |
||
| 29 | |||
| 30 | /** |
||
| 31 | * Get the resource name for a grouped resource. |
||
| 32 | * |
||
| 33 | * @param string $prefix |
||
| 34 | * @param string $resource |
||
| 35 | * @param string $method |
||
| 36 | * @return string |
||
| 37 | */ |
||
| 38 | protected function getGroupResourceName($prefix, $resource, $method) |
||
| 39 | { |
||
| 40 | $availableLocales = $this->languageRepository->availableLocales(); |
||
| 41 | |||
| 42 | // Remove segments from group prefix that are equal to one of the available locales: |
||
| 43 | $groupSegments = explode('/', $this->router->getLastGroupPrefix()); |
||
| 44 | $groupSegments = array_filter( |
||
| 45 | $groupSegments, function ($segment) use ($availableLocales) { |
||
| 46 | return !in_array($segment, $availableLocales); |
||
| 47 | } |
||
| 48 | ); |
||
| 49 | $group = trim(implode('.', $groupSegments), '.'); |
||
| 50 | |||
| 51 | if (empty($group)) { |
||
| 52 | return trim("{$prefix}{$resource}.{$method}", '.'); |
||
| 53 | } |
||
| 54 | |||
| 55 | return trim("{$prefix}{$group}.{$resource}.{$method}", '.'); |
||
| 56 | } |
||
| 57 | } |
||
| 58 |
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