Skip to content

Commit

Permalink
Merge branch '4.4' into 5.1
Browse files Browse the repository at this point in the history
* 4.4:
  Use ::class keyword when possible
  • Loading branch information
fabpot committed Jan 11, 2021
2 parents 4f5792c + 491036d commit 03ff881
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Tests/Comparator/ComparatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function testGetSetOperator()
$comparator->setOperator('foo');
$this->fail('->setOperator() throws an \InvalidArgumentException if the operator is not valid.');
} catch (\Exception $e) {
$this->assertInstanceOf('InvalidArgumentException', $e, '->setOperator() throws an \InvalidArgumentException if the operator is not valid.');
$this->assertInstanceOf(\InvalidArgumentException::class, $e, '->setOperator() throws an \InvalidArgumentException if the operator is not valid.');
}

$comparator = new Comparator();
Expand Down
4 changes: 2 additions & 2 deletions Tests/Comparator/DateComparatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ public function testConstructor()
new DateComparator('foobar');
$this->fail('__construct() throws an \InvalidArgumentException if the test expression is not valid.');
} catch (\Exception $e) {
$this->assertInstanceOf('InvalidArgumentException', $e, '__construct() throws an \InvalidArgumentException if the test expression is not valid.');
$this->assertInstanceOf(\InvalidArgumentException::class, $e, '__construct() throws an \InvalidArgumentException if the test expression is not valid.');
}

try {
new DateComparator('');
$this->fail('__construct() throws an \InvalidArgumentException if the test expression is not valid.');
} catch (\Exception $e) {
$this->assertInstanceOf('InvalidArgumentException', $e, '__construct() throws an \InvalidArgumentException if the test expression is not valid.');
$this->assertInstanceOf(\InvalidArgumentException::class, $e, '__construct() throws an \InvalidArgumentException if the test expression is not valid.');
}
}

Expand Down
2 changes: 1 addition & 1 deletion Tests/Comparator/NumberComparatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function testConstructor($successes, $failures)
new NumberComparator($f);
$this->fail('__construct() throws an \InvalidArgumentException if the test expression is not valid.');
} catch (\Exception $e) {
$this->assertInstanceOf('InvalidArgumentException', $e, '__construct() throws an \InvalidArgumentException if the test expression is not valid.');
$this->assertInstanceOf(\InvalidArgumentException::class, $e, '__construct() throws an \InvalidArgumentException if the test expression is not valid.');
}
}
}
Expand Down
14 changes: 7 additions & 7 deletions Tests/FinderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
{
public function testCreate()
{
$this->assertInstanceOf('Symfony\Component\Finder\Finder', Finder::create());
$this->assertInstanceOf(Finder::class, Finder::create());
}

public function testDirectories()
Expand Down Expand Up @@ -922,14 +922,14 @@ public function testIn()

public function testInWithNonExistentDirectory()
{
$this->expectException('Symfony\Component\Finder\Exception\DirectoryNotFoundException');
$this->expectException(\Symfony\Component\Finder\Exception\DirectoryNotFoundException::class);
$finder = new Finder();
$finder->in('foobar');
}

public function testInWithNonExistentDirectoryLegacyException()
{
$this->expectException('InvalidArgumentException');
$this->expectException(\InvalidArgumentException::class);
$finder = new Finder();
$finder->in('foobar');
}
Expand All @@ -944,7 +944,7 @@ public function testInWithGlob()

public function testInWithNonDirectoryGlob()
{
$this->expectException('InvalidArgumentException');
$this->expectException(\InvalidArgumentException::class);
$finder = new Finder();
$finder->in(__DIR__.'/Fixtures/A/a*');
}
Expand All @@ -963,7 +963,7 @@ public function testInWithGlobBrace()

public function testGetIteratorWithoutIn()
{
$this->expectException('LogicException');
$this->expectException(\LogicException::class);
$finder = Finder::create();
$finder->getIterator();
}
Expand Down Expand Up @@ -1104,7 +1104,7 @@ public function testAppendWithAnArray()

public function testAppendReturnsAFinder()
{
$this->assertInstanceOf('Symfony\\Component\\Finder\\Finder', Finder::create()->append([]));
$this->assertInstanceOf(Finder::class, Finder::create()->append([]));
}

public function testAppendDoesNotRequireIn()
Expand Down Expand Up @@ -1143,7 +1143,7 @@ public function testCountFiles()

public function testCountWithoutIn()
{
$this->expectException('LogicException');
$this->expectException(\LogicException::class);
$finder = Finder::create()->files();
\count($finder);
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/Iterator/CustomFilterIteratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class CustomFilterIteratorTest extends IteratorTestCase
{
public function testWithInvalidFilter()
{
$this->expectException('InvalidArgumentException');
$this->expectException(\InvalidArgumentException::class);
new CustomFilterIterator(new Iterator(), ['foo']);
}

Expand Down
4 changes: 2 additions & 2 deletions Tests/Iterator/IteratorTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ protected function assertIteratorInForeach(array $expected, \Traversable $iterat
{
$values = [];
foreach ($iterator as $file) {
$this->assertInstanceOf('Symfony\\Component\\Finder\\SplFileInfo', $file);
$this->assertInstanceOf(\Symfony\Component\Finder\SplFileInfo::class, $file);
$values[] = $file->getPathname();
}

Expand All @@ -85,7 +85,7 @@ protected function assertOrderedIteratorInForeach(array $expected, \Traversable
{
$values = [];
foreach ($iterator as $file) {
$this->assertInstanceOf('Symfony\\Component\\Finder\\SplFileInfo', $file);
$this->assertInstanceOf(\Symfony\Component\Finder\SplFileInfo::class, $file);
$values[] = $file->getPathname();
}

Expand Down
2 changes: 1 addition & 1 deletion Tests/Iterator/SortableIteratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function testConstructor()
new SortableIterator(new Iterator([]), 'foobar');
$this->fail('__construct() throws an \InvalidArgumentException exception if the mode is not valid');
} catch (\Exception $e) {
$this->assertInstanceOf('InvalidArgumentException', $e, '__construct() throws an \InvalidArgumentException exception if the mode is not valid');
$this->assertInstanceOf(\InvalidArgumentException::class, $e, '__construct() throws an \InvalidArgumentException exception if the mode is not valid');
}
}

Expand Down

0 comments on commit 03ff881

Please sign in to comment.