Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Step 4 Upgrade] Bump requirement to php 8.1 #127

Merged
merged 38 commits into from
Jan 20, 2024
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
80b4640
[Step 3 Upgrade] Bump requirement to php 8.1
samsonasik Jan 15, 2024
084a9bc
update phpunit syntax compatibility
samsonasik Jan 15, 2024
66d040c
rollback rector temporary usage
samsonasik Jan 15, 2024
1404d82
fix default value on ReflectionProperty and ReflectionParameter
samsonasik Jan 15, 2024
7133ac4
general default value display
samsonasik Jan 15, 2024
c9bb8fe
various return type add
samsonasik Jan 15, 2024
f795b7e
fix various return type
samsonasik Jan 15, 2024
daf9d9f
fix various return type
samsonasik Jan 15, 2024
bb41025
more return type
samsonasik Jan 15, 2024
8663cc3
utilize ReturnTypeWillChange on allow return false
samsonasik Jan 15, 2024
3cd467d
more return types
samsonasik Jan 15, 2024
2fb0217
fix return type
samsonasik Jan 15, 2024
042b712
more return type
samsonasik Jan 15, 2024
0710933
Fix default value display on ReflectionProperty
samsonasik Jan 15, 2024
35fc2a5
use str_starts_with()
samsonasik Jan 15, 2024
511838f
debugging
samsonasik Jan 15, 2024
34699a2
use array_shift() to ensure = inside default value included
samsonasik Jan 15, 2024
c8658d7
implode fix
samsonasik Jan 15, 2024
ec3d9de
more test
samsonasik Jan 17, 2024
2324122
more test
samsonasik Jan 17, 2024
3be7ab6
add more test
samsonasik Jan 17, 2024
40aadce
print special class: self, parent, static
samsonasik Jan 18, 2024
1a42011
append
samsonasik Jan 18, 2024
6019431
use ParentConnectingVisitor
samsonasik Jan 18, 2024
b5c4e85
add return string on __toString()
samsonasik Jan 18, 2024
97c71d4
Add isParameter flag on detect as default value on parameter
samsonasik Jan 18, 2024
893893f
Concat handling
samsonasik Jan 18, 2024
3aa23ed
cs fix
samsonasik Jan 18, 2024
6871bd4
get
samsonasik Jan 18, 2024
3f62a99
constant name from const fetch
samsonasik Jan 18, 2024
cbd5720
namespaced const fetch
samsonasik Jan 18, 2024
73aed34
fix array
samsonasik Jan 18, 2024
d096c07
use phpunit 10.5.7
samsonasik Jan 18, 2024
babcd9e
remove dbeug
samsonasik Jan 18, 2024
768537f
isDefaultValueAvailable() is false when next parameter is required si…
samsonasik Jan 19, 2024
b05b6ae
finally green :tada:
samsonasik Jan 19, 2024
b44de11
Final touch: only check next iteration
samsonasik Jan 20, 2024
f002967
Final touch: fix array param
samsonasik Jan 20, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- "lowest"
- "highest"
php-version:
- "8.0"
- "8.1"
operating-system:
- "ubuntu-latest"

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
}
},
"require": {
"php": ">=8.0",
"php": ">=8.1",
"nikic/php-parser": "^4.0"
},
"require-dev": {
"phpunit/phpunit": "^9.0",
"phpunit/phpunit": "^10.0",
"tracy/tracy": "^2.10"
},
"extra": {
Expand Down
12 changes: 6 additions & 6 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" colors="true" bootstrap="./vendor/autoload.php">
<coverage>
<include>
<directory>./src/</directory>
</include>
</coverage>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" colors="true" bootstrap="./vendor/autoload.php">
<testsuites>
<testsuite name="Parser Reflection Test Suite">
<directory>./tests/</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory>./src/</directory>
</include>
</source>
</phpunit>
12 changes: 6 additions & 6 deletions src/ReflectionClassConstant.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,15 @@ public function __debugInfo(): array
/**
* @inheritDoc
*/
public function getDeclaringClass()
public function getDeclaringClass(): \ReflectionClass
{
return new ReflectionClass($this->className);
}

/**
* @inheritDoc
*/
public function getDocComment()
public function getDocComment(): string|false
{
$docBlock = $this->classConstantNode->getDocComment();

Expand All @@ -129,7 +129,7 @@ public function getDocComment()
/**
* @inheritDoc
*/
public function getModifiers()
public function getModifiers(): int
{
$modifiers = 0;
if ($this->isPublic()) {
Expand Down Expand Up @@ -166,23 +166,23 @@ public function getValue()
/**
* @inheritDoc
*/
public function isPrivate()
public function isPrivate(): bool
{
return $this->classConstantNode->isPrivate();
}

/**
* @inheritDoc
*/
public function isProtected()
public function isProtected(): bool
{
return $this->classConstantNode->isProtected();
}

/**
* @inheritDoc
*/
public function isPublic()
public function isPublic(): bool
{
return $this->classConstantNode->isPublic();
}
Expand Down
2 changes: 1 addition & 1 deletion src/ReflectionFileNamespace.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public function getConstants(bool $withDefined = false): array
*
* @return string|false The doc comment if it exists, otherwise "false"
*/
public function getDocComment()
public function getDocComment(): string|false
{
$docComment = false;
$comments = $this->namespaceNode->getAttribute('comments');
Expand Down
4 changes: 2 additions & 2 deletions src/ReflectionFunction.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function getNode(): Function_
/**
* {@inheritDoc}
*/
public function getClosure()
public function getClosure(): \Closure
{
$this->initializeInternalReflection();

Expand Down Expand Up @@ -100,7 +100,7 @@ public function invokeArgs(array $args)
* Only internal functions can be disabled using disable_functions directive.
* User-defined functions are unaffected.
*/
public function isDisabled()
public function isDisabled(): bool
{
return false;
}
Expand Down
26 changes: 13 additions & 13 deletions src/ReflectionMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public function __toString()
/**
* {@inheritDoc}
*/
public function getClosure($object = null)
public function getClosure($object = null): \Closure
{
$this->initializeInternalReflection();

Expand All @@ -148,15 +148,15 @@ public function getClosure($object = null)
/**
* {@inheritDoc}
*/
public function getDeclaringClass()
public function getDeclaringClass(): \ReflectionClass
{
return $this->declaringClass ?? new ReflectionClass($this->className);
}

/**
* {@inheritDoc}
*/
public function getModifiers()
public function getModifiers(): int
{
$modifiers = 0;
if ($this->isPublic()) {
Expand Down Expand Up @@ -184,7 +184,7 @@ public function getModifiers()
/**
* {@inheritDoc}
*/
public function getPrototype()
public function getPrototype(): \ReflectionMethod
{
$parent = $this->getDeclaringClass()->getParentClass();
if (!$parent) {
Expand Down Expand Up @@ -222,71 +222,71 @@ public function invokeArgs(?object $object, array $args): mixed
/**
* {@inheritDoc}
*/
public function isAbstract()
public function isAbstract(): bool
{
return $this->getDeclaringClass()->isInterface() || $this->getClassMethodNode()->isAbstract();
}

/**
* {@inheritDoc}
*/
public function isConstructor()
public function isConstructor(): bool
{
return $this->getClassMethodNode()->name->toLowerString() === '__construct';
}

/**
* {@inheritDoc}
*/
public function isDestructor()
public function isDestructor(): bool
{
return $this->getClassMethodNode()->name->toLowerString() === '__destruct';
}

/**
* {@inheritDoc}
*/
public function isFinal()
public function isFinal(): bool
{
return $this->getClassMethodNode()->isFinal();
}

/**
* {@inheritDoc}
*/
public function isPrivate()
public function isPrivate(): bool
{
return $this->getClassMethodNode()->isPrivate();
}

/**
* {@inheritDoc}
*/
public function isProtected()
public function isProtected(): bool
{
return $this->getClassMethodNode()->isProtected();
}

/**
* {@inheritDoc}
*/
public function isPublic()
public function isPublic(): bool
{
return $this->getClassMethodNode()->isPublic();
}

/**
* {@inheritDoc}
*/
public function isStatic()
public function isStatic(): bool
{
return $this->getClassMethodNode()->isStatic();
}

/**
* {@inheritDoc}
*/
public function setAccessible($accessible)
public function setAccessible($accessible): void
{
$this->initializeInternalReflection();

Expand Down
8 changes: 4 additions & 4 deletions src/ReflectionNamedType.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,31 +51,31 @@ public function __construct($type, $allowsNull, $isBuiltin)
/**
* @inheritDoc
*/
public function allowsNull()
public function allowsNull(): bool
{
return $this->allowsNull;
}

/**
* @inheritDoc
*/
public function isBuiltin()
public function isBuiltin(): bool
{
return $this->isBuiltin;
}

/**
* @inheritDoc
*/
public function __toString()
public function __toString(): string
{
return $this->type;
}

/**
* @inheritDoc
*/
public function getName()
public function getName(): string
{
return $this->type;
}
Expand Down
Loading
Loading