Skip to content

Commit 7ab9f5e

Browse files
More work on attribute objects for #4502
1 parent 4656f2f commit 7ab9f5e

File tree

4 files changed

+146
-0
lines changed

4 files changed

+146
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php declare(strict_types=1);
2+
/*
3+
* This file is part of PHPUnit.
4+
*
5+
* (c) Sebastian Bergmann <[email protected]>
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
namespace PHPUnit\Framework\Attributes;
11+
12+
use Attribute;
13+
14+
#[Attribute(Attribute::IS_REPEATABLE)]
15+
final class DataProvider
16+
{
17+
/**
18+
* @var string
19+
*/
20+
private $methodName;
21+
22+
public function __construct(string $methodName)
23+
{
24+
$this->methodName = $methodName;
25+
}
26+
27+
public function methodName(): string
28+
{
29+
return $this->methodName;
30+
}
31+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php declare(strict_types=1);
2+
/*
3+
* This file is part of PHPUnit.
4+
*
5+
* (c) Sebastian Bergmann <[email protected]>
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
namespace PHPUnit\Framework\Attributes;
11+
12+
use Attribute;
13+
14+
#[Attribute(Attribute::IS_REPEATABLE)]
15+
final class DataProviderMethod
16+
{
17+
/**
18+
* @var string
19+
*/
20+
private $className;
21+
22+
/**
23+
* @var string
24+
*/
25+
private $methodName;
26+
27+
public function __construct(string $className, string $methodName)
28+
{
29+
$this->className = $className;
30+
$this->methodName = $methodName;
31+
}
32+
33+
public function className(): string
34+
{
35+
return $this->className;
36+
}
37+
38+
public function methodName(): string
39+
{
40+
return $this->methodName;
41+
}
42+
}

src/Framework/Attributes/Depends.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php declare(strict_types=1);
2+
/*
3+
* This file is part of PHPUnit.
4+
*
5+
* (c) Sebastian Bergmann <[email protected]>
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
namespace PHPUnit\Framework\Attributes;
11+
12+
use Attribute;
13+
14+
#[Attribute(Attribute::IS_REPEATABLE)]
15+
final class Depends
16+
{
17+
/**
18+
* @var string
19+
*/
20+
private $methodName;
21+
22+
public function __construct(string $methodName)
23+
{
24+
$this->methodName = $methodName;
25+
}
26+
27+
public function methodName(): string
28+
{
29+
return $this->methodName;
30+
}
31+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php declare(strict_types=1);
2+
/*
3+
* This file is part of PHPUnit.
4+
*
5+
* (c) Sebastian Bergmann <[email protected]>
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
namespace PHPUnit\Framework\Attributes;
11+
12+
use Attribute;
13+
14+
#[Attribute(Attribute::IS_REPEATABLE)]
15+
final class DependsMethod
16+
{
17+
/**
18+
* @var string
19+
*/
20+
private $className;
21+
22+
/**
23+
* @var string
24+
*/
25+
private $methodName;
26+
27+
public function __construct(string $className, string $methodName)
28+
{
29+
$this->className = $className;
30+
$this->methodName = $methodName;
31+
}
32+
33+
public function className(): string
34+
{
35+
return $this->className;
36+
}
37+
38+
public function methodName(): string
39+
{
40+
return $this->methodName;
41+
}
42+
}

0 commit comments

Comments
 (0)