for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace SimpleSAML\Module\monitor;
final class TestData
{
/**
* @var array
*/
protected $testData = array();
* @param array $input
public function __construct($input = array())
assert(is_array($input));
$this->setInput($input);
}
* @param string $key
$key
string|null
This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.
@param
It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.
*
* @return void
public function setInput($input = array(), $key = null)
assert(is_string($key) || is_null($key));
if (is_null($key)) {
foreach ($input as $key => $value) {
$this->addInput($key, $value);
} elseif (array_key_exists($key, $this->testData)) {
$this->testData[$key] = $input;
} else {
$this->addInput($key, $input);
* @param mixed|null $value
public function addInput($key, $value = null)
assert(is_string($key));
if (isSet($this->testData[$key])) {
assert(is_array($this->testData[$key]));
$this->testData[$key] = array_merge($this->testData[$key], $value);
$this->testData[$key] = $value;
* @param string|null $item
* @return mixed
protected function getInput($item = null)
assert(is_string($item) || is_null($item));
return is_null($item) ? $this->testData : (isSet($this->testData[$item]) ? $this->testData[$item] : null);
This check looks for
@paramannotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.