mirror of
https://github.com/danog/psalm.git
synced 2024-12-15 02:47:02 +01:00
ead107fa9e
* add native return types * redundant phpdoc
62 lines
1.6 KiB
PHP
62 lines
1.6 KiB
PHP
<?php
|
|
namespace Psalm\Test\Config\Plugin\Hook;
|
|
|
|
use PhpParser;
|
|
use Psalm\CodeLocation;
|
|
use Psalm\Context;
|
|
use Psalm\Plugin\Hook\PropertyExistenceProviderInterface;
|
|
use Psalm\Plugin\Hook\PropertyTypeProviderInterface;
|
|
use Psalm\Plugin\Hook\PropertyVisibilityProviderInterface;
|
|
use Psalm\StatementsSource;
|
|
use Psalm\Type;
|
|
|
|
class FooPropertyProvider implements
|
|
PropertyExistenceProviderInterface,
|
|
PropertyVisibilityProviderInterface,
|
|
PropertyTypeProviderInterface
|
|
{
|
|
/**
|
|
* @return array<string>
|
|
*/
|
|
public static function getClassLikeNames() : array
|
|
{
|
|
return ['Ns\Foo'];
|
|
}
|
|
|
|
public static function doesPropertyExist(
|
|
string $fq_classlike_name,
|
|
string $property_name,
|
|
bool $read_mode,
|
|
?StatementsSource $source = null,
|
|
?Context $context = null,
|
|
?CodeLocation $code_location = null
|
|
): ?bool {
|
|
return $property_name === 'magic_property';
|
|
}
|
|
|
|
public static function isPropertyVisible(
|
|
StatementsSource $source,
|
|
string $fq_classlike_name,
|
|
string $property_name,
|
|
bool $read_mode,
|
|
?Context $context = null,
|
|
?CodeLocation $code_location = null
|
|
): ?bool {
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* @param array<PhpParser\Node\Arg> $call_args
|
|
*
|
|
*/
|
|
public static function getPropertyType(
|
|
string $fq_classlike_name,
|
|
string $property_name,
|
|
bool $read_mode,
|
|
?StatementsSource $source = null,
|
|
?Context $context = null
|
|
): ?Type\Union {
|
|
return Type::getString();
|
|
}
|
|
}
|