1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-03 10:07:52 +01:00
psalm/tests/Config/Plugin/Hook/FooPropertyProvider.php

43 lines
1.2 KiB
PHP
Raw Normal View History

<?php
2019-05-10 00:58:30 +02:00
namespace Psalm\Test\Config\Plugin\Hook;
use Psalm\Plugin\EventHandler\Event\PropertyExistenceProviderEvent;
use Psalm\Plugin\EventHandler\Event\PropertyTypeProviderEvent;
use Psalm\Plugin\EventHandler\Event\PropertyVisibilityProviderEvent;
2021-06-08 04:55:21 +02:00
use Psalm\Plugin\EventHandler\PropertyExistenceProviderInterface;
use Psalm\Plugin\EventHandler\PropertyTypeProviderInterface;
use Psalm\Plugin\EventHandler\PropertyVisibilityProviderInterface;
2019-03-23 19:27:54 +01:00
use Psalm\Type;
2021-12-13 16:28:14 +01:00
use Psalm\Type\Union;
class FooPropertyProvider implements
PropertyExistenceProviderInterface,
PropertyVisibilityProviderInterface,
PropertyTypeProviderInterface
{
/**
* @return array<string>
*/
public static function getClassLikeNames(): array
{
return ['Ns\Foo'];
}
public static function doesPropertyExist(PropertyExistenceProviderEvent $event): ?bool
{
$property_name = $event->getPropertyName();
return $property_name === 'magic_property';
}
public static function isPropertyVisible(PropertyVisibilityProviderEvent $event): ?bool
{
return true;
}
2021-12-13 16:28:14 +01:00
public static function getPropertyType(PropertyTypeProviderEvent $event): ?Union
{
return Type::getString();
}
}