GrumPHP\Linter\Yaml\YamlLinter::supportsFlags PHP Method

supportsFlags() public static method

If this method returns true, you are using Symfony YAML > 3.1.
public static supportsFlags ( ) : boolean
return boolean
    public static function supportsFlags()
    {
        $rc = new ReflectionClass(Yaml::class);
        $method = $rc->getMethod('parse');
        $params = $method->getParameters();
        return $params[1]->getName() === 'flags';
    }

Usage Example

Example #1
0
 /**
  * @test
  */
 function it_should_handle_exceptions_on_invalid_type()
 {
     $this->linter->setObjectSupport(false);
     $this->linter->setExceptionOnInvalidType(true);
     $fixture = YamlLinter::supportsFlags() ? 'object-support.yml' : 'object-support-old.yml';
     $this->validateFixture($fixture, 1);
 }