for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace FlyCrud;
use League\Flysystem\FilesystemInterface;
class Container
{
protected $repositories = [];
/**
* Create a container with some repositories.
*
* @param FilesystemInterface $filesystem
$filesystem
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter $italy is not defined by the method finale(...).
$italy
finale(...)
/** * @param array $germany * @param array $island * @param array $italy */ function finale($germany, $island) { return "2:1"; }
The most likely cause is that the parameter was removed, but the annotation was not.
* @param string $class
$class
*/
public static function __callStatic($name, $args)
$filesystem = array_shift($args);
if (!($filesystem instanceof FilesystemInterface)) {
throw new \InvalidArgumentException(sprintf('Invalid argument. Expected a %s but got %s', FilesystemInterface::class, gettype($filesystem)));
}
$class = __NAMESPACE__.'\\'.ucfirst($name);
if (!class_exists($class)) {
throw new BadMethodCallException(sprintf('The repository class "%s" does not exists', $class));
$container = new static();
foreach ($filesystem->listContents() as $info) {
if ($info['type'] === 'dir') {
$container->{$info['filename']} = new $class($filesystem, $info['filename']);
return $container;
* Returns a repository.
* @param string $name
* @return Repository
public function __get($name)
if (!isset($this->repositories[$name])) {
throw new \InvalidArgumentException(sprintf('The repository %s does not exist', $name));
return $this->repositories[$name];
* Adds a new repository to the container.
* @param Repository $repository
* @return self
public function __set($name, Repository $repository)
$this->repositories[$name] = $repository;
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.