for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace WyriHaximus\TwigView\Lib;
use Cake\Core\App;
/**
* Class RelativeScanner
* @package WyriHaximus\TwigView\Lib
*/
class RelativeScanner
{
* Return all sections (app & plugins) with an Template directory.
*
* @return array
public static function all()
return static::strip(Scanner::all());
\WyriHaximus\TwigView\Lib\Scanner::all()
array
string
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example:
function acceptsInteger($int) { } $x = '123'; // string "123" // Instead of acceptsInteger($x); // we recommend to use acceptsInteger((integer) $x);
}
* Return all templates for a given plugin.
* @param string $plugin The plugin to find all templates for.
* @return mixed
public static function plugin($plugin)
return static::strip([
array($plugin => \WyriHa...anner::plugin($plugin))
array<string,array>
$plugin => Scanner::plugin($plugin),
])[$plugin];
* Strip the absolute path of template's paths for all given sections.
* @param string $sections Sections to iterate over.
protected static function strip($sections)
foreach ($sections as $section => $paths) {
$sections
$sections[$section] = static::stripAbsolutePath($paths, $section == 'APP' ? null : $section);
return $sections;
* Strip the absolute path of template's paths.
* @param array $paths Paths to strip.
* @param string|null $plugin Hold plugin name or null for App.
protected static function stripAbsolutePath(array $paths, $plugin = null)
foreach (App::path('Template', $plugin) as $templatesPath) {
array_walk($paths, function (&$path) use ($templatesPath) {
if (substr($path, 0, strlen($templatesPath)) == $templatesPath) {
$path = substr($path, strlen($templatesPath));
});
return $paths;
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: