SensioLabs\DeprecationDetector\FileInfo\PhpFileInfo::create PHP Метод

create() публичный статический Метод

public static create ( Symfony\Component\Finder\SplFileInfo $file ) : self
$file Symfony\Component\Finder\SplFileInfo
Результат self
    public static function create(SplFileInfo $file)
    {
        return new static($file->getPathname(), $file->getRelativePath(), $file->getRelativePathname());
    }

Usage Example

    public function testVariableResolver()
    {
        $source = <<<'EOC'
<?php
namespace Foo;
class Bar
{
    function a() {
    }
    function b() {
        $this->a();
        $x = new Bar1();
        $x->a();
        $x->b();
        $c = new Bar2();
        $y = $c;
        $f = $y;
        $f->a();
    }
}
EOC;
        $fileInfo = PhpFileInfo::create($this->prophesize('Symfony\\Component\\Finder\\SplFileInfo')->reveal());
        $contents = $this->traverseSourceAndReturnContents($source, $fileInfo);
        $methodUsages = $contents->methodUsages();
        $this->assertCount(4, $methodUsages);
        $this->assertEquals(new MethodUsage('a', 'Foo\\Bar', 8, false), $methodUsages[0]);
        $this->assertEquals(new MethodUsage('a', 'Bar1', 10, false), $methodUsages[1]);
        $this->assertEquals(new MethodUsage('b', 'Bar1', 11, false), $methodUsages[2]);
        $this->assertEquals(new MethodUsage('a', 'Bar2', 15, false), $methodUsages[3]);
    }
All Usage Examples Of SensioLabs\DeprecationDetector\FileInfo\PhpFileInfo::create