Lines Matching refs:name

7         $name = new Name(['foo', 'bar']);
8 $this->assertSame('foo\bar', $name->name);
10 $name = new Name('foo\bar');
11 $this->assertSame('foo\bar', $name->name);
13 $name = new Name($name);
14 $this->assertSame('foo\bar', $name->name);
18 $name = new Name('foo');
19 $this->assertSame('foo', $name->getFirst());
20 $this->assertSame('foo', $name->getLast());
21 $this->assertSame(['foo'], $name->getParts());
23 $name = new Name('foo\bar');
24 $this->assertSame('foo', $name->getFirst());
25 $this->assertSame('bar', $name->getLast());
26 $this->assertSame(['foo', 'bar'], $name->getParts());
30 $name = new Name('Foo\Bar');
32 $this->assertSame('Foo\Bar', (string) $name);
33 $this->assertSame('Foo\Bar', $name->toString());
34 $this->assertSame('foo\bar', $name->toLowerString());
38 $name = new Name('foo\bar\baz');
39 $this->assertEquals(new Name('foo\bar\baz'), $name->slice(0));
40 $this->assertEquals(new Name('bar\baz'), $name->slice(1));
41 $this->assertNull($name->slice(3));
42 $this->assertEquals(new Name('foo\bar\baz'), $name->slice(-3));
43 $this->assertEquals(new Name('bar\baz'), $name->slice(-2));
44 $this->assertEquals(new Name('foo\bar'), $name->slice(0, -1));
45 $this->assertNull($name->slice(0, -3));
46 $this->assertEquals(new Name('bar'), $name->slice(1, -1));
47 $this->assertNull($name->slice(1, -2));
48 $this->assertEquals(new Name('bar'), $name->slice(-2, 1));
49 $this->assertEquals(new Name('bar'), $name->slice(-2, -1));
50 $this->assertNull($name->slice(-2, -2));
102 $name = new Name('foo');
103 $this->assertTrue($name->isUnqualified());
104 $this->assertFalse($name->isQualified());
105 $this->assertFalse($name->isFullyQualified());
106 $this->assertFalse($name->isRelative());
107 $this->assertSame('foo', $name->toCodeString());
109 $name = new Name('foo\bar');
110 $this->assertFalse($name->isUnqualified());
111 $this->assertTrue($name->isQualified());
112 $this->assertFalse($name->isFullyQualified());
113 $this->assertFalse($name->isRelative());
114 $this->assertSame('foo\bar', $name->toCodeString());
116 $name = new Name\FullyQualified('foo');
117 $this->assertFalse($name->isUnqualified());
118 $this->assertFalse($name->isQualified());
119 $this->assertTrue($name->isFullyQualified());
120 $this->assertFalse($name->isRelative());
121 $this->assertSame('\foo', $name->toCodeString());
123 $name = new Name\Relative('foo');
124 $this->assertFalse($name->isUnqualified());
125 $this->assertFalse($name->isQualified());
126 $this->assertFalse($name->isFullyQualified());
127 $this->assertTrue($name->isRelative());
128 $this->assertSame('namespace\foo', $name->toCodeString());
150 public function testIsSpecialClassName($name, $expected): void { argument
151 $name = new Name($name);
152 $this->assertSame($expected, $name->isSpecialClassName());