Skip to content

Commit

Permalink
Remove obsolete skips
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Sep 6, 2024
1 parent df300b9 commit 731ac4c
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 46 deletions.
4 changes: 0 additions & 4 deletions tests/Rules/DeadCode/UnusedPrivatePropertyRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ public static function getAdditionalConfigFiles(): array

public function testRule(): void
{
if (PHP_VERSION_ID < 70400) {
self::markTestSkipped('Test requires PHP 7.4.');
}

$this->analyse([__DIR__ . '/data/unused-private-property.php'], [
[
'Property PHPStan\Rules\Doctrine\ORM\UnusedPrivateProperty\EntityWithAGeneratedId::$unused is never written, only read.',
Expand Down
4 changes: 0 additions & 4 deletions tests/Rules/Doctrine/ORM/QueryBuilderDqlRuleSlowTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use PHPStan\Rules\Rule;
use PHPStan\Testing\RuleTestCase;
use PHPStan\Type\Doctrine\ObjectMetadataResolver;
use const PHP_VERSION_ID;

/**
* @extends RuleTestCase<QueryBuilderDqlRule>
Expand All @@ -23,9 +22,6 @@ protected function getRule(): Rule

public function testRule(): void
{
if (PHP_VERSION_ID < 70300) {
self::markTestSkipped('For some reason PHP 7.2 cannot recover from Trying to get property value of non-object');
}
$this->analyse([__DIR__ . '/data/query-builder-dql.php'], [
[
"QueryBuilder: [Syntax Error] line 0, col 66: Error: Expected end of string, got ')'\nDQL: SELECT e FROM PHPStan\Rules\Doctrine\ORM\MyEntity e WHERE e.id = 1)",
Expand Down
5 changes: 0 additions & 5 deletions tests/Rules/Doctrine/ORM/QueryBuilderDqlRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use PHPStan\Rules\Rule;
use PHPStan\Testing\RuleTestCase;
use PHPStan\Type\Doctrine\ObjectMetadataResolver;
use const PHP_VERSION_ID;

/**
* @extends RuleTestCase<QueryBuilderDqlRule>
Expand All @@ -23,10 +22,6 @@ protected function getRule(): Rule

public function testRule(): void
{
if (PHP_VERSION_ID < 70300) {
self::markTestSkipped('For some reason PHP 7.2 cannot recover from Trying to get property value of non-object');
}

$this->analyse([__DIR__ . '/data/query-builder-dql.php'], [
[
"QueryBuilder: [Syntax Error] line 0, col 66: Error: Expected end of string, got ')'\nDQL: SELECT e FROM PHPStan\Rules\Doctrine\ORM\MyEntity e WHERE e.id = 1)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use PHPStan\Rules\Rule;
use PHPStan\Testing\RuleTestCase;
use PHPStan\Type\Doctrine\ObjectMetadataResolver;
use const PHP_VERSION_ID;

/**
* @extends RuleTestCase<UnusedPrivatePropertyRule>
Expand All @@ -34,10 +33,6 @@ public static function getAdditionalConfigFiles(): array

public function testRule(): void
{
if (PHP_VERSION_ID < 70400) {
self::markTestSkipped('Test requires PHP 7.4.');
}

$this->analyse([__DIR__ . '/data/gedmo-property-assign-phpdoc.php'], [
// No errors expected
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use PHPStan\Rules\Rule;
use PHPStan\Testing\RuleTestCase;
use const PHP_VERSION_ID;

/**
* @extends RuleTestCase<MissingReadOnlyByPhpDocPropertyAssignRule>
Expand All @@ -24,10 +23,6 @@ public static function getAdditionalConfigFiles(): array

public function testRule(): void
{
if (PHP_VERSION_ID < 70400) {
self::markTestSkipped('Test requires PHP 7.4.');
}

$this->analyse([__DIR__ . '/data/missing-readonly-property-assign-phpdoc.php'], [
[
'Class MissingReadOnlyPropertyAssignPhpDoc\EntityWithAGeneratedId has an uninitialized @readonly property $unassigned. Assign it in the constructor.',
Expand Down
44 changes: 21 additions & 23 deletions tests/Type/Doctrine/Query/QueryResultTypeWalkerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1533,35 +1533,33 @@ private function yieldConditionalDataset(): iterable
];
}

if (PHP_VERSION_ID >= 70400) {
yield 'locate function' => [
$this->constantArray([
[new ConstantIntegerType(1), $this->uintOrStringified()],
[new ConstantIntegerType(2), TypeCombinator::addNull($this->uintOrStringified())],
[new ConstantIntegerType(3), TypeCombinator::addNull($this->uintOrStringified())],
[new ConstantIntegerType(4), $this->uintOrStringified()],
]),
'
yield 'locate function' => [
$this->constantArray([
[new ConstantIntegerType(1), $this->uintOrStringified()],
[new ConstantIntegerType(2), TypeCombinator::addNull($this->uintOrStringified())],
[new ConstantIntegerType(3), TypeCombinator::addNull($this->uintOrStringified())],
[new ConstantIntegerType(4), $this->uintOrStringified()],
]),
'
SELECT LOCATE(m.stringColumn, m.stringColumn, 0),
LOCATE(m.stringNullColumn, m.stringColumn, 0),
LOCATE(m.stringColumn, m.stringNullColumn, 0),
LOCATE(\'f\', \'foo\', 0)
FROM QueryResult\Entities\Many m
',
null,
InstalledVersions::satisfies(new VersionParser(), 'doctrine/dbal', '>=3.4')
? null
: (
PHP_VERSION_ID >= 80100
? 'strpos(): Passing null to parameter #2 ($needle) of type string is deprecated'
: (
PHP_VERSION_ID < 80000
? 'strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior'
: null
)
),
];
}
null,
InstalledVersions::satisfies(new VersionParser(), 'doctrine/dbal', '>=3.4')
? null
: (
PHP_VERSION_ID >= 80100
? 'strpos(): Passing null to parameter #2 ($needle) of type string is deprecated'
: (
PHP_VERSION_ID < 80000
? 'strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior'
: null
)
),
];

$ormVersion = InstalledVersions::getVersion('doctrine/orm');
$hasOrm3 = $ormVersion !== null && strpos($ormVersion, '3.') === 0;
Expand Down

0 comments on commit 731ac4c

Please sign in to comment.