Skip to content

Commit b25c249

Browse files
Remove deprecated methods
1 parent 6fd234d commit b25c249

7 files changed

+2
-377
lines changed

ChangeLog-12.0.md

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt
66

77
### Removed
88

9+
* Methods `CodeCoverage::includeUncoveredFiles()` and `CodeCoverage::excludeUncoveredFiles()`
910
* Optional argument `$linesToBeUsed` of `CodeCoverage::stop()` and `CodeCoverage::append()` methods
1011
* This component is no longer supported on PHP 8.2
1112

src/CodeCoverage.php

+1-20
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ final class CodeCoverage
4848
private readonly Filter $filter;
4949
private readonly Wizard $wizard;
5050
private bool $checkForUnintentionallyCoveredCode = false;
51-
private bool $includeUncoveredFiles = true;
5251
private bool $ignoreDeprecatedCode = false;
5352
private ?string $currentId = null;
5453
private ?TestSize $currentSize = null;
@@ -122,9 +121,7 @@ public function filter(): Filter
122121
public function getData(bool $raw = false): ProcessedCodeCoverageData
123122
{
124123
if (!$raw) {
125-
if ($this->includeUncoveredFiles) {
126-
$this->addUncoveredFilesFromFilter();
127-
}
124+
$this->addUncoveredFilesFromFilter();
128125
}
129126

130127
return $this->data;
@@ -271,22 +268,6 @@ public function disableCheckForUnintentionallyCoveredCode(): void
271268
$this->checkForUnintentionallyCoveredCode = false;
272269
}
273270

274-
/**
275-
* @deprecated
276-
*/
277-
public function includeUncoveredFiles(): void
278-
{
279-
$this->includeUncoveredFiles = true;
280-
}
281-
282-
/**
283-
* @deprecated
284-
*/
285-
public function excludeUncoveredFiles(): void
286-
{
287-
$this->includeUncoveredFiles = false;
288-
}
289-
290271
public function enableAnnotationsForIgnoringCode(): void
291272
{
292273
$this->useAnnotationsForIgnoringCode = true;

tests/TestCase.php

-251
Original file line numberDiff line numberDiff line change
@@ -1165,123 +1165,6 @@ protected function getPathCoverageForSourceWithoutNamespace(): CodeCoverage
11651165
return $coverage;
11661166
}
11671167

1168-
protected function getXdebugDataForNamespacedBankAccount()
1169-
{
1170-
return [
1171-
RawCodeCoverageData::fromXdebugWithoutPathCoverage([
1172-
TEST_FILES_PATH . 'NamespacedBankAccount.php' => [
1173-
13 => 1,
1174-
14 => -2,
1175-
18 => -1,
1176-
19 => -1,
1177-
20 => -1,
1178-
21 => -1,
1179-
23 => -1,
1180-
27 => -1,
1181-
29 => -1,
1182-
30 => -2,
1183-
34 => -1,
1184-
36 => -1,
1185-
37 => -2,
1186-
],
1187-
]),
1188-
RawCodeCoverageData::fromXdebugWithoutPathCoverage([
1189-
TEST_FILES_PATH . 'NamespacedBankAccount.php' => [
1190-
13 => 1,
1191-
18 => 1,
1192-
21 => 1,
1193-
34 => 1,
1194-
],
1195-
]),
1196-
RawCodeCoverageData::fromXdebugWithoutPathCoverage([
1197-
TEST_FILES_PATH . 'NamespacedBankAccount.php' => [
1198-
13 => 1,
1199-
18 => 1,
1200-
21 => 1,
1201-
27 => 1,
1202-
],
1203-
]),
1204-
RawCodeCoverageData::fromXdebugWithoutPathCoverage([
1205-
TEST_FILES_PATH . 'NamespacedBankAccount.php' => [
1206-
13 => 1,
1207-
18 => 1,
1208-
19 => 1,
1209-
20 => 1,
1210-
23 => 1,
1211-
27 => 1,
1212-
29 => 1,
1213-
34 => 1,
1214-
36 => 1,
1215-
],
1216-
]),
1217-
];
1218-
}
1219-
1220-
protected function getLineCoverageForNamespacedBankAccount(): CodeCoverage
1221-
{
1222-
$data = $this->getXdebugDataForNamespacedBankAccount();
1223-
1224-
$stub = $this->createStub(Driver::class);
1225-
1226-
$stub->method('stop')
1227-
->willReturn(...$data);
1228-
1229-
$filter = new Filter;
1230-
$filter->includeFile(TEST_FILES_PATH . 'NamespacedBankAccount.php');
1231-
1232-
$coverage = new CodeCoverage($stub, $filter);
1233-
1234-
$coverage->start(
1235-
'BankAccountTest::testBalanceIsInitiallyZero',
1236-
null,
1237-
true
1238-
);
1239-
1240-
$coverage->stop(
1241-
true,
1242-
null,
1243-
[TEST_FILES_PATH . 'NamespacedBankAccount.php' => range(11, 14)]
1244-
);
1245-
1246-
$coverage->start(
1247-
'BankAccountTest::testBalanceCannotBecomeNegative'
1248-
);
1249-
1250-
$coverage->stop(
1251-
true,
1252-
null,
1253-
[TEST_FILES_PATH . 'NamespacedBankAccount.php' => range(32, 37)]
1254-
);
1255-
1256-
$coverage->start(
1257-
'BankAccountTest::testBalanceCannotBecomeNegative2'
1258-
);
1259-
1260-
$coverage->stop(
1261-
true,
1262-
null,
1263-
[TEST_FILES_PATH . 'NamespacedBankAccount.php' => range(25, 30)]
1264-
);
1265-
1266-
$coverage->start(
1267-
'BankAccountTest::testDepositWithdrawMoney'
1268-
);
1269-
1270-
$coverage->stop(
1271-
true,
1272-
null,
1273-
[
1274-
TEST_FILES_PATH . 'NamespacedBankAccount.php' => array_merge(
1275-
range(11, 14),
1276-
range(25, 30),
1277-
range(32, 37)
1278-
),
1279-
]
1280-
);
1281-
1282-
return $coverage;
1283-
}
1284-
12851168
protected function getLineCoverageForBankAccountForFirstTwoTests(): CodeCoverage
12861169
{
12871170
$data = $this->getLineCoverageXdebugDataForBankAccount();
@@ -1867,138 +1750,4 @@ protected function removeTemporaryFiles(): void
18671750
$fileInfo->isDir() ? rmdir($pathname) : unlink($pathname);
18681751
}
18691752
}
1870-
1871-
protected function getCoverageForFilesWithUncoveredIncluded(): CodeCoverage
1872-
{
1873-
$data = $this->getLineCoverageXdebugDataForBankAccount();
1874-
1875-
$stub = $this->createStub(Driver::class);
1876-
1877-
$stub->method('stop')
1878-
->willReturn(...$data);
1879-
1880-
$filter = new Filter;
1881-
$filter->includeFile(TEST_FILES_PATH . 'BankAccount.php');
1882-
$filter->includeFile(TEST_FILES_PATH . 'NamespacedBankAccount.php');
1883-
1884-
$coverage = new CodeCoverage($stub, $filter);
1885-
$coverage->includeUncoveredFiles();
1886-
1887-
$coverage->start(
1888-
'BankAccountTest::testBalanceIsInitiallyZero',
1889-
null,
1890-
true
1891-
);
1892-
1893-
$coverage->stop(
1894-
true,
1895-
null,
1896-
[TEST_FILES_PATH . 'BankAccount.php' => range(6, 9)]
1897-
);
1898-
1899-
$coverage->start(
1900-
'BankAccountTest::testBalanceCannotBecomeNegative'
1901-
);
1902-
1903-
$coverage->stop(
1904-
true,
1905-
null,
1906-
[TEST_FILES_PATH . 'BankAccount.php' => range(27, 32)]
1907-
);
1908-
1909-
$coverage->start(
1910-
'BankAccountTest::testBalanceCannotBecomeNegative2'
1911-
);
1912-
1913-
$coverage->stop(
1914-
true,
1915-
null,
1916-
[TEST_FILES_PATH . 'BankAccount.php' => range(20, 25)]
1917-
);
1918-
1919-
$coverage->start(
1920-
'BankAccountTest::testDepositWithdrawMoney'
1921-
);
1922-
1923-
$coverage->stop(
1924-
true,
1925-
null,
1926-
[
1927-
TEST_FILES_PATH . 'BankAccount.php' => array_merge(
1928-
range(6, 9),
1929-
range(20, 25),
1930-
range(27, 32)
1931-
),
1932-
]
1933-
);
1934-
1935-
return $coverage;
1936-
}
1937-
1938-
protected function getCoverageForFilesWithUncoveredExcluded(): CodeCoverage
1939-
{
1940-
$data = $this->getLineCoverageXdebugDataForBankAccount();
1941-
1942-
$stub = $this->createStub(Driver::class);
1943-
1944-
$stub->method('stop')
1945-
->willReturn(...$data);
1946-
1947-
$filter = new Filter;
1948-
$filter->includeFile(TEST_FILES_PATH . 'BankAccount.php');
1949-
$filter->includeFile(TEST_FILES_PATH . 'NamespacedBankAccount.php');
1950-
1951-
$coverage = new CodeCoverage($stub, $filter);
1952-
$coverage->excludeUncoveredFiles();
1953-
1954-
$coverage->start(
1955-
'BankAccountTest::testBalanceIsInitiallyZero',
1956-
null,
1957-
true
1958-
);
1959-
1960-
$coverage->stop(
1961-
true,
1962-
null,
1963-
[TEST_FILES_PATH . 'BankAccount.php' => range(6, 9)]
1964-
);
1965-
1966-
$coverage->start(
1967-
'BankAccountTest::testBalanceCannotBecomeNegative'
1968-
);
1969-
1970-
$coverage->stop(
1971-
true,
1972-
null,
1973-
[TEST_FILES_PATH . 'BankAccount.php' => range(27, 32)]
1974-
);
1975-
1976-
$coverage->start(
1977-
'BankAccountTest::testBalanceCannotBecomeNegative2'
1978-
);
1979-
1980-
$coverage->stop(
1981-
true,
1982-
null,
1983-
[TEST_FILES_PATH . 'BankAccount.php' => range(20, 25)]
1984-
);
1985-
1986-
$coverage->start(
1987-
'BankAccountTest::testDepositWithdrawMoney'
1988-
);
1989-
1990-
$coverage->stop(
1991-
true,
1992-
null,
1993-
[
1994-
TEST_FILES_PATH . 'BankAccount.php' => array_merge(
1995-
range(6, 9),
1996-
range(20, 25),
1997-
range(27, 32)
1998-
),
1999-
]
2000-
);
2001-
2002-
return $coverage;
2003-
}
20041753
}

tests/_files/NamespacedBankAccount-text-with-colors.txt

-14
This file was deleted.

tests/_files/NamespacedBankAccount-text.txt

-14
This file was deleted.

tests/_files/NamespacedBankAccount.php

-38
This file was deleted.

0 commit comments

Comments
 (0)