Skip to content

Commit 8b01495

Browse files
Do not use empty()
1 parent 159f1a7 commit 8b01495

File tree

9 files changed

+11
-11
lines changed

9 files changed

+11
-11
lines changed

src/Event/Value/ComparisonFailureBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ public static function from(Throwable $t): ?ComparisonFailure
3434

3535
$expectedAsString = $t->getComparisonFailure()->getExpectedAsString();
3636

37-
if (empty($expectedAsString)) {
37+
if ($expectedAsString === '') {
3838
$expectedAsString = self::mapScalarValueToString($t->getComparisonFailure()->getExpected());
3939
}
4040

4141
$actualAsString = $t->getComparisonFailure()->getActualAsString();
4242

43-
if (empty($actualAsString)) {
43+
if ($actualAsString === '') {
4444
$actualAsString = self::mapScalarValueToString($t->getComparisonFailure()->getActual());
4545
}
4646

src/Framework/MockObject/Runtime/Stub/ConsecutiveCalls.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function __construct(array $stack)
4141
*/
4242
public function invoke(Invocation $invocation): mixed
4343
{
44-
if (empty($this->stack)) {
44+
if ($this->stack === []) {
4545
throw new NoMoreReturnValuesConfiguredException(
4646
$invocation,
4747
$this->numberOfConfiguredReturnValues,

src/Framework/TestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -847,7 +847,7 @@ final public function dataSetAsString(): string
847847
*/
848848
final public function dataSetAsStringWithData(): string
849849
{
850-
if (empty($this->data)) {
850+
if ($this->data === []) {
851851
return '';
852852
}
853853

src/Framework/TestSuite.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ private function throwableToString(Throwable $t): string
579579
{
580580
$message = $t->getMessage();
581581

582-
if (empty(trim($message))) {
582+
if (trim($message) === '') {
583583
$message = '<no message>';
584584
}
585585

src/Logging/TestDox/NamePrettifier.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public function prettifyTestClassName(string $className): string
8989
$className = substr($className, strlen('Test'));
9090
}
9191

92-
if (empty($className)) {
92+
if ($className === '') {
9393
$className = 'UnnamedTests';
9494
}
9595

src/Metadata/Api/Dependencies.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public static function dependencies(string $className, string $methodName): arra
4343

4444
assert($metadata instanceof DependsOnMethod);
4545

46-
if (empty($metadata->methodName())) {
46+
if ($metadata->methodName() === '') {
4747
$dependencies[] = ExecutionOrderDependency::invalid();
4848

4949
continue;

src/Metadata/Version/Requirement.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public static function from(string $versionRequirement): self
4242
return new ComparisonRequirement(
4343
$matches['version'],
4444
new VersionComparisonOperator(
45-
!empty($matches['operator']) ? $matches['operator'] : '>=',
45+
$matches['operator'] !== '' ? $matches['operator'] : '>=',
4646
),
4747
);
4848
}

src/Runner/PHPT/PhptTestCase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ private function parse(): array
569569
continue;
570570
}
571571

572-
if (empty($section)) {
572+
if ($section === '') {
573573
throw new InvalidPhptFileException;
574574
}
575575

@@ -880,7 +880,7 @@ private function locationHint(string $needle, array $sections): array
880880
{
881881
$needle = trim($needle);
882882

883-
if (empty($needle)) {
883+
if ($needle === '') {
884884
return [[
885885
'file' => realpath($this->filename),
886886
'line' => 1,

src/Runner/TestSuiteSorter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public function getExecutionOrder(): array
136136

137137
private function sort(TestSuite $suite, int $order, bool $resolveDependencies, int $orderDefects): void
138138
{
139-
if (empty($suite->tests())) {
139+
if ($suite->tests() === []) {
140140
return;
141141
}
142142

0 commit comments

Comments
 (0)