Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php: [8.1, 8.2, 8.3]
php: [8.1, 8.2, 8.3, 8.4]
dependency-versions: [locked, lowest, highest]
steps:
- uses: actions/checkout@v4
Expand All @@ -76,7 +76,7 @@ jobs:
with:
composer-options: --optimize-autoloader
dependency-versions: ${{ matrix.dependency-versions }}
- run: composer test -- --colors=always --coverage-clover coverage.xml
- run: composer test -- --colors=always --coverage-clover=coverage.xml ${{ matrix.php == '8.4' && '--testsuite=php84' || '' }}
- if: ${{ matrix.php == '8.1' && matrix.dependency-versions == 'locked' }}
uses: codecov/codecov-action@v4
env:
Expand Down
7 changes: 6 additions & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,19 @@
>
<php>
<ini name="display_errors" value="1"/>
<ini name="error_reporting" value="-1"/>
<ini name="error_reporting" value="22527"/>
</php>

<testsuites>
<testsuite name="default">
<directory>tests</directory>
</testsuite>

<testsuite name="php84">
<directory>tests</directory>
<exclude>tests/Internal/NativeAdapter/AdapterCompatibilityTest.php</exclude>
</testsuite>

<testsuite name="infection">
<file>tests/Internal/Inheritance/TypeResolversTest.php</file>
<file>tests/Internal/PhpDoc/PhpDocTypeReflectorTest.php</file>
Expand Down
1 change: 1 addition & 0 deletions psalm.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -115,5 +115,6 @@
<file name="tests/Internal/NativeAdapter/Fixtures/classes.php" preloadClasses="true"/>
<file name="tests/Internal/NativeAdapter/Fixtures/classes_php82.php" preloadClasses="true"/>
<file name="tests/Internal/NativeAdapter/Fixtures/classes_php83.php" preloadClasses="true"/>
<file name="src/Internal/NativeAdapter/PropertyHookType.php" preloadClasses="true"/>
</stubs>
</psalm>
80 changes: 80 additions & 0 deletions src/Internal/NativeAdapter/ClassAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,86 @@ public function setStaticPropertyValue(string $name, mixed $value): void
parent::setStaticPropertyValue($name, $value);
}

/**
* @psalm-suppress MixedInferredReturnType, MixedReturnStatement, UndefinedMethod
*/
public function newLazyGhost(callable $initializer, int $options = 0): object
{
$this->loadNative();

return parent::newLazyGhost($initializer, $options);
}

/**
* @psalm-suppress MixedInferredReturnType, MixedReturnStatement, UndefinedMethod
*/
public function newLazyProxy(callable $factory, int $options = 0): object
{
$this->loadNative();

return parent::newLazyProxy($factory, $options);
}

/**
* @psalm-suppress UndefinedMethod
*/
public function resetAsLazyGhost(object $object, callable $initializer, int $options = 0): void
{
$this->loadNative();

parent::resetAsLazyGhost($object, $initializer, $options);
}

/**
* @psalm-suppress UndefinedMethod
*/
public function resetAsLazyProxy(object $object, callable $factory, int $options = 0): void
{
$this->loadNative();

parent::resetAsLazyProxy($object, $factory, $options);
}

/**
* @psalm-suppress MixedInferredReturnType, MixedReturnStatement, UndefinedMethod
*/
public function initializeLazyObject(object $object): object
{
$this->loadNative();

return parent::initializeLazyObject($object);
}

/**
* @psalm-suppress MixedInferredReturnType, MixedReturnStatement, UndefinedMethod
*/
public function markLazyObjectAsInitialized(object $object): object
{
$this->loadNative();

return parent::markLazyObjectAsInitialized($object);
}

/**
* @psalm-suppress MixedInferredReturnType, MixedReturnStatement, UndefinedMethod
*/
public function getLazyInitializer(object $object): ?callable
{
$this->loadNative();

return parent::getLazyInitializer($object);
}

/**
* @psalm-suppress MixedInferredReturnType, MixedReturnStatement, UndefinedMethod
*/
public function isUninitializedLazyObject(object $object): bool
{
$this->loadNative();

return parent::isUninitializedLazyObject($object);
}

/**
* @return Properties
*/
Expand Down
9 changes: 9 additions & 0 deletions src/Internal/NativeAdapter/ClassConstantAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,15 @@ public function hasType(): bool
return $this->reflection->type(TypeKind::Native) !== null;
}

/**
* @psalm-suppress PossiblyUnusedMethod, UnusedPsalmSuppress
* @TODO
*/
public function isDeprecated(): bool
{
return false;
}

public function isEnumCase(): bool
{
return $this->reflection->isEnumCase();
Expand Down
64 changes: 64 additions & 0 deletions src/Internal/NativeAdapter/EnumAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -361,4 +361,68 @@ public function setStaticPropertyValue(string $name, mixed $value): void
{
$this->_class->setStaticPropertyValue($name, $value);
}

/**
* @psalm-suppress PossiblyUnusedMethod
*/
public function newLazyGhost(callable $initializer, int $options = 0): object
{
return $this->_class->newLazyGhost($initializer, $options);
}

/**
* @psalm-suppress PossiblyUnusedMethod
*/
public function newLazyProxy(callable $factory, int $options = 0): object
{
return $this->_class->newLazyProxy($factory, $options);
}

/**
* @psalm-suppress PossiblyUnusedMethod
*/
public function resetAsLazyGhost(object $object, callable $initializer, int $options = 0): void
{
$this->_class->resetAsLazyGhost($object, $initializer, $options);
}

/**
* @psalm-suppress PossiblyUnusedMethod
*/
public function resetAsLazyProxy(object $object, callable $factory, int $options = 0): void
{
$this->_class->resetAsLazyProxy($object, $factory, $options);
}

/**
* @psalm-suppress PossiblyUnusedMethod
*/
public function initializeLazyObject(object $object): object
{
return $this->_class->initializeLazyObject($object);
}

/**
* @psalm-suppress PossiblyUnusedMethod
*/
public function markLazyObjectAsInitialized(object $object): object
{
return $this->_class->markLazyObjectAsInitialized($object);
}

/**
* @psalm-suppress PossiblyUnusedMethod
*/
public function getLazyInitializer(object $object): ?callable
{
return $this->_class->getLazyInitializer($object);
}

/**
* @psalm-suppress PossiblyUnusedMethod
*/
public function isUninitializedLazyObject(object $object): bool
{
return $this->_class->isUninitializedLazyObject($object);
}
}
8 changes: 8 additions & 0 deletions src/Internal/NativeAdapter/EnumBackedCaseAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,14 @@ public function hasType(): bool
return $this->constant->hasType();
}

/**
* @psalm-suppress PossiblyUnusedMethod
*/
public function isDeprecated(): bool
{
return $this->constant->isDeprecated();
}

public function isEnumCase(): bool
{
return $this->constant->isEnumCase();
Expand Down
148 changes: 148 additions & 0 deletions src/Internal/NativeAdapter/PropertyAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,154 @@ public function setValue(mixed $objectOrValue, mixed $value = null): void
parent::setValue($objectOrValue, $value);
}

/**
* @psalm-suppress PossiblyUnusedMethod, MixedInferredReturnType, MixedReturnStatement, UndefinedMethod
*/
public function getHooks(): array
{
$this->loadNative();

return parent::getHooks();
}

/**
* @psalm-suppress PossiblyUnusedMethod, MixedInferredReturnType, MixedReturnStatement, UndefinedMethod
*/
public function getHook(\PropertyHookType $hook): ?\ReflectionMethod
{
$this->loadNative();

return parent::getHook($hook);
}

/**
* @psalm-suppress PossiblyUnusedMethod, MixedInferredReturnType, MixedReturnStatement, UndefinedMethod
*/
public function isVirtual(): bool
{
$this->loadNative();

return parent::isVirtual();
}

/**
* @psalm-suppress PossiblyUnusedMethod, MixedInferredReturnType, MixedReturnStatement, UndefinedMethod
*/
public function getSettableType(): ?\ReflectionType
{
$this->loadNative();

return parent::getSettableType();
}

/**
* @psalm-suppress PossiblyUnusedMethod, UndefinedMethod
*/
public function getRawValue(object $object): mixed
{
$this->loadNative();

return parent::getRawValue($object);
}

/**
* @psalm-suppress PossiblyUnusedMethod, UndefinedMethod
*/
public function setRawValue(object $object, mixed $value): void
{
$this->loadNative();

parent::setRawValue($object, $value);
}

/**
* @psalm-suppress PossiblyUnusedMethod, UndefinedMethod
*/
public function setRawValueWithoutLazyInitialization(object $object, mixed $value): void
{
$this->loadNative();

parent::setRawValueWithoutLazyInitialization($object, $value);
}

/**
* @psalm-suppress PossiblyUnusedMethod, UndefinedMethod
*/
public function skipLazyInitialization(object $object): void
{
$this->loadNative();

parent::skipLazyInitialization($object);
}

/**
* @psalm-suppress PossiblyUnusedMethod, MixedInferredReturnType, MixedReturnStatement, UndefinedMethod
*/
public function isPrivateSet(): bool
{
$this->loadNative();

return parent::isPrivateSet();
}

/**
* @psalm-suppress PossiblyUnusedMethod, MixedInferredReturnType, MixedReturnStatement, UndefinedMethod
*/
public function isProtectedSet(): bool
{
$this->loadNative();

return parent::isProtectedSet();
}

/**
* @psalm-suppress PossiblyUnusedMethod
*/
public function isDynamic(): bool
{
return false;
}

/**
* @psalm-suppress PossiblyUnusedMethod, MixedInferredReturnType, MixedReturnStatement, UndefinedMethod
*/
public function isAbstract(): bool
{
$this->loadNative();

return parent::isAbstract();
}

/**
* @psalm-suppress PossiblyUnusedMethod, MixedInferredReturnType, MixedReturnStatement, UndefinedMethod
*/
public function isFinal(): bool
{
$this->loadNative();

return parent::isFinal();
}

/**
* @psalm-suppress PossiblyUnusedMethod, MixedInferredReturnType, MixedReturnStatement, UndefinedMethod
*/
public function hasHooks(): bool
{
$this->loadNative();

return parent::hasHooks();
}

/**
* @psalm-suppress PossiblyUnusedMethod, MixedInferredReturnType, MixedReturnStatement, UndefinedMethod
*/
public function hasHook(\PropertyHookType $hook): bool
{
$this->loadNative();

return parent::hasHook($hook);
}

private bool $nativeLoaded = false;

private function loadNative(): void
Expand Down
Loading