mirror of
https://github.com/doctrine/reflection.git
synced 2026-03-24 00:32:07 +01:00
Compare commits
81 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1034e5e71f | ||
|
|
d5ae5d3a5b | ||
|
|
02097bc0fe | ||
|
|
381bfa425f | ||
|
|
d186376821 | ||
|
|
04367f0db3 | ||
|
|
e44961f0af | ||
|
|
970fe98e79 | ||
|
|
6c3096dd9b | ||
|
|
26ba62bc4b | ||
|
|
4ac6925893 | ||
|
|
1e02418cf8 | ||
|
|
fa587178be | ||
|
|
dc269e064a | ||
|
|
a8d82251c6 | ||
|
|
f3ade869eb | ||
|
|
06eec07aa3 | ||
|
|
2336d15b1a | ||
|
|
a82bebf801 | ||
|
|
e65c2eb6a8 | ||
|
|
e3c48f5fbd | ||
|
|
cac3bcb8fc | ||
|
|
db4b566464 | ||
|
|
486d0cbea5 | ||
|
|
cea2760c34 | ||
|
|
4f143d5384 | ||
|
|
efdbb0f82a | ||
|
|
edfb312da0 | ||
|
|
344bc74ba8 | ||
|
|
1b33070b49 | ||
|
|
41a2f0f445 | ||
|
|
d11bac73db | ||
|
|
1c7272c98a | ||
|
|
8f7fdc01b3 | ||
|
|
55e71912df | ||
|
|
fbc77cc1c8 | ||
|
|
79de2517ba | ||
|
|
827618c360 | ||
|
|
1a5837f909 | ||
|
|
1ab281861b | ||
|
|
b699ecc7f2 | ||
|
|
cd4811c644 | ||
|
|
aa0689034e | ||
|
|
2fc2828857 | ||
|
|
c7588e0baa | ||
|
|
d9cf1f3deb | ||
|
|
12fea966b2 | ||
|
|
c390808aca | ||
|
|
bc420ead87 | ||
|
|
68b6aa3299 | ||
|
|
895c94dcee | ||
|
|
45270d8e58 | ||
|
|
76bb6bc20a | ||
|
|
9acbb8ccce | ||
|
|
8299ca45da | ||
|
|
7fba840747 | ||
|
|
bbf9810b57 | ||
|
|
6efdc3f15a | ||
|
|
0ac0da52c1 | ||
|
|
70707057f6 | ||
|
|
f3e4e24667 | ||
|
|
2c2888effb | ||
|
|
512a4f0ec1 | ||
|
|
07b0d59986 | ||
|
|
5eefae4186 | ||
|
|
7a2c95aa7c | ||
|
|
859446e967 | ||
|
|
81f27df605 | ||
|
|
de66230870 | ||
|
|
4a97a22032 | ||
|
|
6e00e048a8 | ||
|
|
ad11fb5d5d | ||
|
|
a5c4170bcc | ||
|
|
12b6dfcab6 | ||
|
|
e4286e5a08 | ||
|
|
ca1b0e4137 | ||
|
|
093041f967 | ||
|
|
9848bff07d | ||
|
|
fe6a06f31d | ||
|
|
d1db8cee08 | ||
|
|
b5ab045685 |
30
.doctrine-project.json
Normal file
30
.doctrine-project.json
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"active": true,
|
||||
"name": "Reflection",
|
||||
"slug": "reflection",
|
||||
"docsSlug": "doctrine-reflection",
|
||||
"versions": [
|
||||
{
|
||||
"name": "1.2",
|
||||
"branchName": "1.2.x",
|
||||
"slug": "1.2",
|
||||
"current": true,
|
||||
"aliases": [
|
||||
"current",
|
||||
"stable"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "1.1",
|
||||
"branchName": "1.1.x",
|
||||
"slug": "1.1",
|
||||
"maintained": false
|
||||
},
|
||||
{
|
||||
"name": "1.0",
|
||||
"branchName": "1.0",
|
||||
"slug": "1.0",
|
||||
"maintained": false
|
||||
}
|
||||
]
|
||||
}
|
||||
2
.gitattributes
vendored
2
.gitattributes
vendored
@@ -1,7 +1,7 @@
|
||||
/docs export-ignore
|
||||
/tests export-ignore
|
||||
/.gitattributes export-ignore
|
||||
/.gitignore export-ignore
|
||||
/.travis.yml export-ignore
|
||||
/phpunit.xml.dist export-ignore
|
||||
/phpcs.xml.dist export-ignore
|
||||
/composer.lock export-ignore
|
||||
|
||||
16
.github/workflows/coding-standards.yml
vendored
Normal file
16
.github/workflows/coding-standards.yml
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
name: "Coding Standards"
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- "*.x"
|
||||
push:
|
||||
branches:
|
||||
- "*.x"
|
||||
|
||||
jobs:
|
||||
coding-standards:
|
||||
uses: "doctrine/.github/.github/workflows/coding-standards.yml@1.4.1"
|
||||
with:
|
||||
php-version: "8.1"
|
||||
composer-root-version: "1.2"
|
||||
17
.github/workflows/continuous-integration.yml
vendored
Normal file
17
.github/workflows/continuous-integration.yml
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
name: "Continuous Integration"
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- "*.x"
|
||||
push:
|
||||
branches:
|
||||
- "*.x"
|
||||
|
||||
jobs:
|
||||
phpunit:
|
||||
name: "PHPUnit"
|
||||
uses: "doctrine/.github/.github/workflows/continuous-integration.yml@1.4.1"
|
||||
with:
|
||||
php-versions: '["7.1", "7.2", "7.3", "7.4", "8.0", "8.1"]'
|
||||
composer-root-version: "1.2"
|
||||
15
.github/workflows/release-on-milestone-closed.yml
vendored
Normal file
15
.github/workflows/release-on-milestone-closed.yml
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
name: "Automatic Releases"
|
||||
|
||||
on:
|
||||
milestone:
|
||||
types:
|
||||
- "closed"
|
||||
|
||||
jobs:
|
||||
release:
|
||||
uses: "doctrine/.github/.github/workflows/release-on-milestone-closed.yml@1.4.1"
|
||||
secrets:
|
||||
GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }}
|
||||
GIT_AUTHOR_NAME: ${{ secrets.GIT_AUTHOR_NAME }}
|
||||
ORGANIZATION_ADMIN_TOKEN: ${{ secrets.ORGANIZATION_ADMIN_TOKEN }}
|
||||
SIGNING_SECRET_KEY: ${{ secrets.SIGNING_SECRET_KEY }}
|
||||
39
.github/workflows/static-analysis.yml
vendored
Normal file
39
.github/workflows/static-analysis.yml
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
name: "Static Analysis"
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- "*.x"
|
||||
push:
|
||||
branches:
|
||||
- "*.x"
|
||||
|
||||
jobs:
|
||||
phpstan:
|
||||
name: "PHPStan"
|
||||
runs-on: "ubuntu-20.04"
|
||||
env:
|
||||
COMPOSER_ROOT_VERSION: "1.2"
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
php-version:
|
||||
- "8.1"
|
||||
|
||||
steps:
|
||||
- name: "Checkout code"
|
||||
uses: "actions/checkout@v2"
|
||||
|
||||
- name: "Install PHP"
|
||||
uses: "shivammathur/setup-php@v2"
|
||||
with:
|
||||
coverage: "none"
|
||||
php-version: "${{ matrix.php-version }}"
|
||||
|
||||
- name: "Install dependencies with Composer"
|
||||
uses: "ramsey/composer-install@v1"
|
||||
with:
|
||||
dependency-versions: "highest"
|
||||
|
||||
- name: "Run a static analysis with phpstan/phpstan"
|
||||
run: "vendor/bin/phpstan analyse"
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,4 +1,6 @@
|
||||
/vendor/
|
||||
/composer.lock
|
||||
/phpunit.xml
|
||||
/phpcs.xml
|
||||
/.phpcs-cache
|
||||
/.phpunit.result.cache
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
build:
|
||||
nodes:
|
||||
analysis:
|
||||
environment:
|
||||
php:
|
||||
version: 7.1
|
||||
cache:
|
||||
disabled: false
|
||||
directories:
|
||||
- ~/.composer/cache
|
||||
project_setup:
|
||||
override: true
|
||||
tests:
|
||||
override:
|
||||
- php-scrutinizer-run
|
||||
- phpcs-run
|
||||
dependencies:
|
||||
override:
|
||||
- composer install -noa
|
||||
|
||||
tools:
|
||||
external_code_coverage:
|
||||
timeout: 600
|
||||
|
||||
build_failure_conditions:
|
||||
- 'elements.rating(<= C).new.exists' # No new classes/methods with a rating of C or worse allowed
|
||||
- 'issues.label("coding-style").new.exists' # No new coding style issues allowed
|
||||
- 'issues.severity(>= MAJOR).new.exists' # New issues of major or higher severity
|
||||
- 'project.metric_change("scrutinizer.test_coverage", < 0)' # Code Coverage decreased from previous inspection
|
||||
45
.travis.yml
45
.travis.yml
@@ -1,45 +0,0 @@
|
||||
dist: trusty
|
||||
sudo: false
|
||||
language: php
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.composer/cache
|
||||
|
||||
php:
|
||||
- 7.1
|
||||
- 7.2
|
||||
- nightly
|
||||
|
||||
before_install:
|
||||
- mv ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini{,.disabled} || echo "xdebug not available"
|
||||
|
||||
install:
|
||||
- rm composer.lock
|
||||
- travis_retry composer update -n --prefer-dist
|
||||
|
||||
script: ./vendor/bin/phpunit
|
||||
|
||||
jobs:
|
||||
allow_failures:
|
||||
- php: nightly
|
||||
|
||||
include:
|
||||
- stage: Coverage
|
||||
before_script:
|
||||
- mv ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini{.disabled,}
|
||||
- if [[ ! $(php -m | grep -si xdebug) ]]; then echo "xdebug required for coverage"; exit 1; fi
|
||||
script:
|
||||
- ./vendor/bin/phpunit --coverage-clover clover.xml
|
||||
after_script:
|
||||
- wget https://scrutinizer-ci.com/ocular.phar
|
||||
- php ocular.phar code-coverage:upload --format=php-clover clover.xml
|
||||
|
||||
- stage: Coding standard
|
||||
install:
|
||||
- travis_retry composer install -n --prefer-dist
|
||||
script:
|
||||
- ./vendor/bin/phpcs
|
||||
|
||||
- stage: Lint
|
||||
script: vendor/bin/phpstan analyse -l 3 -c phpstan.neon lib tests
|
||||
@@ -1,8 +1,11 @@
|
||||
⚠ This package is abandoned, consider migrating to alternatives, such as
|
||||
`roave/better-reflection`. Features that are still useful to Doctrine have been
|
||||
moved to `doctrine/persistence`⚠
|
||||
|
||||
# Doctrine Reflection
|
||||
|
||||
[](https://travis-ci.org/doctrine/reflection)
|
||||
[](https://scrutinizer-ci.com/g/doctrine/reflection/?branch=master)
|
||||
[](https://scrutinizer-ci.com/g/doctrine/reflection/?branch=master)
|
||||
[](https://codecov.io/gh/doctrine/reflection/branch/1.2.x)
|
||||
|
||||
The Doctrine Reflection project is a simple library used by the various Doctrine projects which adds some additional functionality on top of the reflection functionality that comes with PHP. It allows you to get the reflection information about classes, methods and properties statically.
|
||||
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
{
|
||||
"name": "doctrine/reflection",
|
||||
"type": "library",
|
||||
"description": "Doctrine Reflection component",
|
||||
"keywords": ["reflection"],
|
||||
"description": "The Doctrine Reflection project is a simple library used by the various Doctrine projects which adds some additional functionality on top of the reflection functionality that comes with PHP. It allows you to get the reflection information about classes, methods and properties statically.",
|
||||
"keywords": [
|
||||
"reflection",
|
||||
"static"
|
||||
],
|
||||
"homepage": "https://www.doctrine-project.org/projects/reflection.html",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
@@ -14,17 +17,19 @@
|
||||
{"name": "Marco Pivetta", "email": "ocramius@gmail.com"}
|
||||
],
|
||||
"require": {
|
||||
"php": "^7.1",
|
||||
"php": "^7.1 || ^8.0",
|
||||
"ext-tokenizer": "*",
|
||||
"doctrine/annotations": "^1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpstan/phpstan": "^0.9.2",
|
||||
"phpstan/phpstan-phpunit": "^0.9.4",
|
||||
"phpunit/phpunit": "^7.0",
|
||||
"doctrine/coding-standard": "^4.0",
|
||||
"doctrine/common": "^2.8",
|
||||
"squizlabs/php_codesniffer": "^3.0"
|
||||
"doctrine/coding-standard": "^9",
|
||||
"doctrine/common": "^3.3",
|
||||
"phpstan/phpstan": "^1.4.10",
|
||||
"phpstan/phpstan-phpunit": "^1",
|
||||
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.5"
|
||||
},
|
||||
"conflict": {
|
||||
"doctrine/common": "<2.9"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
@@ -33,12 +38,15 @@
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Doctrine\\Tests\\": "tests/Doctrine/Tests"
|
||||
"Doctrine\\Tests\\": "tests/Doctrine/Tests",
|
||||
"Doctrine\\Tests_PHP74\\": "tests/Doctrine/Tests_PHP74"
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0.x-dev"
|
||||
}
|
||||
}
|
||||
"config": {
|
||||
"allow-plugins": {
|
||||
"dealerdirect/phpcodesniffer-composer-installer": true
|
||||
},
|
||||
"sort-packages": true
|
||||
},
|
||||
"abandoned": "roave/better-reflection"
|
||||
}
|
||||
|
||||
2990
composer.lock
generated
2990
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -11,7 +11,7 @@ If this documentation is not helping to answer questions you have about
|
||||
Doctrine Reflection don't panic. You can get help from different sources:
|
||||
|
||||
- The `Doctrine Mailing List <https://groups.google.com/group/doctrine-user>`_
|
||||
- Gitter chat room `#doctrine/reflection <https://gitter.im/doctrine/reflection>`_
|
||||
- Slack chat room `#reflection <https://www.doctrine-project.org/slack>`_
|
||||
- Report a bug on `GitHub <https://github.com/doctrine/reflection/issues>`_.
|
||||
- On `StackOverflow <https://stackoverflow.com/questions/tagged/doctrine-reflection>`_
|
||||
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Common\Reflection\Compatibility\Php7;
|
||||
|
||||
use ReflectionException;
|
||||
|
||||
trait ReflectionClass
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getConstants()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function newInstance($args)
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Common\Reflection\Compatibility\Php7;
|
||||
|
||||
use ReflectionException;
|
||||
|
||||
trait ReflectionMethod
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function invoke($object, $parameter = null)
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Common\Reflection\Compatibility\Php8;
|
||||
|
||||
use ReflectionException;
|
||||
use ReturnTypeWillChange;
|
||||
|
||||
trait ReflectionClass
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getConstants(?int $filter = null)
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function newInstance(mixed ...$args)
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Common\Reflection\Compatibility\Php8;
|
||||
|
||||
use ReflectionException;
|
||||
use ReturnTypeWillChange;
|
||||
|
||||
trait ReflectionMethod
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function invoke(?object $object, mixed ...$args)
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Common\Reflection\Compatibility;
|
||||
|
||||
use function class_alias;
|
||||
|
||||
use const PHP_VERSION_ID;
|
||||
|
||||
if (PHP_VERSION_ID >= 80000) {
|
||||
class_alias('Doctrine\Common\Reflection\Compatibility\Php8\ReflectionClass', 'Doctrine\Common\Reflection\Compatibility\ReflectionClass');
|
||||
} else {
|
||||
class_alias('Doctrine\Common\Reflection\Compatibility\Php7\ReflectionClass', 'Doctrine\Common\Reflection\Compatibility\ReflectionClass');
|
||||
}
|
||||
|
||||
if (false) {
|
||||
trait ReflectionClass
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Common\Reflection\Compatibility;
|
||||
|
||||
use function class_alias;
|
||||
|
||||
use const PHP_VERSION_ID;
|
||||
|
||||
if (PHP_VERSION_ID >= 80000) {
|
||||
class_alias('Doctrine\Common\Reflection\Compatibility\Php8\ReflectionMethod', 'Doctrine\Common\Reflection\Compatibility\ReflectionMethod');
|
||||
} else {
|
||||
class_alias('Doctrine\Common\Reflection\Compatibility\Php7\ReflectionMethod', 'Doctrine\Common\Reflection\Compatibility\ReflectionMethod');
|
||||
}
|
||||
|
||||
if (false) {
|
||||
trait ReflectionMethod
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -2,13 +2,14 @@
|
||||
|
||||
namespace Doctrine\Common\Reflection;
|
||||
|
||||
use const DIRECTORY_SEPARATOR;
|
||||
use function is_file;
|
||||
use function str_replace;
|
||||
use function strpos;
|
||||
use function strrpos;
|
||||
use function substr;
|
||||
|
||||
use const DIRECTORY_SEPARATOR;
|
||||
|
||||
/**
|
||||
* Finds a class in a PSR-0 structure.
|
||||
*/
|
||||
|
||||
@@ -2,12 +2,16 @@
|
||||
|
||||
namespace Doctrine\Common\Reflection;
|
||||
|
||||
use ReflectionClass;
|
||||
use ReflectionMethod;
|
||||
use ReflectionProperty;
|
||||
|
||||
interface ReflectionProviderInterface
|
||||
{
|
||||
/**
|
||||
* Gets the ReflectionClass equivalent for this class.
|
||||
*
|
||||
* @return \ReflectionClass
|
||||
* @return ReflectionClass
|
||||
*/
|
||||
public function getReflectionClass();
|
||||
|
||||
@@ -16,7 +20,7 @@ interface ReflectionProviderInterface
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return \ReflectionMethod
|
||||
* @return ReflectionMethod
|
||||
*/
|
||||
public function getReflectionMethod($name);
|
||||
|
||||
@@ -25,7 +29,7 @@ interface ReflectionProviderInterface
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return \ReflectionProperty
|
||||
* @return ReflectionProperty
|
||||
*/
|
||||
public function getReflectionProperty($name);
|
||||
}
|
||||
|
||||
@@ -4,10 +4,10 @@ namespace Doctrine\Common\Reflection;
|
||||
|
||||
use Doctrine\Common\Proxy\Proxy;
|
||||
use ReflectionProperty;
|
||||
use ReturnTypeWillChange;
|
||||
|
||||
/**
|
||||
* PHP Runtime Reflection Public Property - special overrides for public properties.
|
||||
*
|
||||
*/
|
||||
class RuntimePublicReflectionProperty extends ReflectionProperty
|
||||
{
|
||||
@@ -18,6 +18,7 @@ class RuntimePublicReflectionProperty extends ReflectionProperty
|
||||
* This is to avoid calling `__get` on the provided $object if it
|
||||
* is a {@see \Doctrine\Common\Proxy\Proxy}.
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getValue($object = null)
|
||||
{
|
||||
$name = $this->getName();
|
||||
@@ -39,8 +40,10 @@ class RuntimePublicReflectionProperty extends ReflectionProperty
|
||||
*
|
||||
* Avoids triggering lazy loading via `__set` if the provided object
|
||||
* is a {@see \Doctrine\Common\Proxy\Proxy}.
|
||||
*
|
||||
* @link https://bugs.php.net/bug.php?id=63463
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function setValue($object, $value = null)
|
||||
{
|
||||
if (! ($object instanceof Proxy && ! $object->__isInitialized())) {
|
||||
|
||||
@@ -2,11 +2,15 @@
|
||||
|
||||
namespace Doctrine\Common\Reflection;
|
||||
|
||||
use Doctrine\Common\Reflection\Compatibility\ReflectionClass as CompatibilityReflectionClass;
|
||||
use ReflectionClass;
|
||||
use ReflectionException;
|
||||
use ReturnTypeWillChange;
|
||||
|
||||
class StaticReflectionClass extends ReflectionClass
|
||||
{
|
||||
use CompatibilityReflectionClass;
|
||||
|
||||
/**
|
||||
* The static reflection parser object.
|
||||
*
|
||||
@@ -22,6 +26,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getName()
|
||||
{
|
||||
return $this->staticReflectionParser->getClassName();
|
||||
@@ -30,6 +35,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getDocComment()
|
||||
{
|
||||
return $this->staticReflectionParser->getDocComment();
|
||||
@@ -38,6 +44,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getNamespaceName()
|
||||
{
|
||||
return $this->staticReflectionParser->getNamespaceName();
|
||||
@@ -54,6 +61,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getMethod($name)
|
||||
{
|
||||
return $this->staticReflectionParser->getReflectionMethod($name);
|
||||
@@ -62,6 +70,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getProperty($name)
|
||||
{
|
||||
return $this->staticReflectionParser->getReflectionProperty($name);
|
||||
@@ -78,6 +87,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getConstant($name)
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -86,14 +96,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getConstants()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getConstructor()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -102,6 +105,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getDefaultProperties()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -110,6 +114,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getEndLine()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -118,6 +123,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getExtension()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -126,6 +132,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getExtensionName()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -134,6 +141,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getFileName()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -142,6 +150,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getInterfaceNames()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -150,6 +159,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getInterfaces()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -158,6 +168,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getMethods($filter = null)
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -166,6 +177,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getModifiers()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -174,6 +186,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getParentClass()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -182,6 +195,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getProperties($filter = null)
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -190,6 +204,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getShortName()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -198,6 +213,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getStartLine()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -206,6 +222,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getStaticProperties()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -214,6 +231,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getStaticPropertyValue($name, $default = '')
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -222,6 +240,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getTraitAliases()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -230,6 +249,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getTraitNames()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -238,6 +258,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getTraits()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -246,6 +267,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function hasConstant($name)
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -254,6 +276,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function hasMethod($name)
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -262,6 +285,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function hasProperty($name)
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -270,6 +294,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function implementsInterface($interface)
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -278,6 +303,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function inNamespace()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -286,6 +312,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function isAbstract()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -294,6 +321,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function isCloneable()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -302,6 +330,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function isFinal()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -310,6 +339,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function isInstance($object)
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -318,6 +348,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function isInstantiable()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -326,6 +357,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function isInterface()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -334,6 +366,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function isInternal()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -342,6 +375,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function isIterateable()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -350,6 +384,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function isSubclassOf($class)
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -358,6 +393,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function isTrait()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -366,6 +402,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function isUserDefined()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -374,14 +411,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function newInstance($args)
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function newInstanceArgs(array $args = [])
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -390,6 +420,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function newInstanceWithoutConstructor()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -398,6 +429,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function setStaticPropertyValue($name, $value)
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
|
||||
@@ -2,11 +2,15 @@
|
||||
|
||||
namespace Doctrine\Common\Reflection;
|
||||
|
||||
use Doctrine\Common\Reflection\Compatibility\ReflectionMethod as CompatibilityReflectionMethod;
|
||||
use ReflectionException;
|
||||
use ReflectionMethod;
|
||||
use ReturnTypeWillChange;
|
||||
|
||||
class StaticReflectionMethod extends ReflectionMethod
|
||||
{
|
||||
use CompatibilityReflectionMethod;
|
||||
|
||||
/**
|
||||
* The PSR-0 parser object.
|
||||
*
|
||||
@@ -33,6 +37,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getName()
|
||||
{
|
||||
return $this->methodName;
|
||||
@@ -49,6 +54,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getDeclaringClass()
|
||||
{
|
||||
return $this->getStaticReflectionParser()->getReflectionClass();
|
||||
@@ -57,6 +63,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getNamespaceName()
|
||||
{
|
||||
return $this->getStaticReflectionParser()->getNamespaceName();
|
||||
@@ -65,6 +72,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getDocComment()
|
||||
{
|
||||
return $this->getStaticReflectionParser()->getDocComment('method', $this->methodName);
|
||||
@@ -89,7 +97,8 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getClosure($object)
|
||||
#[ReturnTypeWillChange]
|
||||
public function getClosure($object = null)
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
}
|
||||
@@ -97,6 +106,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getModifiers()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -105,6 +115,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getPrototype()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -113,14 +124,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function invoke($object, $parameter = null)
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function invokeArgs($object, array $args)
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -129,6 +133,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function isAbstract()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -137,6 +142,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function isConstructor()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -145,6 +151,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function isDestructor()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -153,6 +160,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function isFinal()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -161,6 +169,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function isPrivate()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -169,6 +178,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function isProtected()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -177,6 +187,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function isPublic()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -185,6 +196,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function isStatic()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -193,6 +205,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function setAccessible($accessible)
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -209,6 +222,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getClosureThis()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -217,6 +231,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getEndLine()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -225,6 +240,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getExtension()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -233,6 +249,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getExtensionName()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -241,6 +258,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getFileName()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -249,6 +267,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getNumberOfParameters()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -257,6 +276,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getNumberOfRequiredParameters()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -265,6 +285,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getParameters()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -273,6 +294,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getShortName()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -281,6 +303,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getStartLine()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -289,6 +312,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getStaticVariables()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -297,6 +321,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function inNamespace()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -305,6 +330,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function isClosure()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -313,6 +339,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function isDeprecated()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -321,6 +348,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function isInternal()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -329,6 +357,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function isUserDefined()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -337,6 +366,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function returnsReference()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
|
||||
@@ -4,20 +4,10 @@ namespace Doctrine\Common\Reflection;
|
||||
|
||||
use Doctrine\Common\Annotations\TokenParser;
|
||||
use ReflectionException;
|
||||
use const T_CLASS;
|
||||
use const T_DOC_COMMENT;
|
||||
use const T_EXTENDS;
|
||||
use const T_FUNCTION;
|
||||
use const T_PAAMAYIM_NEKUDOTAYIM;
|
||||
use const T_PRIVATE;
|
||||
use const T_PROTECTED;
|
||||
use const T_PUBLIC;
|
||||
use const T_STRING;
|
||||
use const T_USE;
|
||||
use const T_VAR;
|
||||
use const T_VARIABLE;
|
||||
|
||||
use function array_merge;
|
||||
use function file_get_contents;
|
||||
use function is_array;
|
||||
use function ltrim;
|
||||
use function preg_match;
|
||||
use function sprintf;
|
||||
@@ -26,8 +16,24 @@ use function strrpos;
|
||||
use function strtolower;
|
||||
use function substr;
|
||||
|
||||
use const T_CLASS;
|
||||
use const T_DOC_COMMENT;
|
||||
use const T_EXTENDS;
|
||||
use const T_FUNCTION;
|
||||
use const T_NEW;
|
||||
use const T_PAAMAYIM_NEKUDOTAYIM;
|
||||
use const T_PRIVATE;
|
||||
use const T_PROTECTED;
|
||||
use const T_PUBLIC;
|
||||
use const T_STRING;
|
||||
use const T_USE;
|
||||
use const T_VAR;
|
||||
use const T_VARIABLE;
|
||||
|
||||
/**
|
||||
* Parses a file for namespaces/use/class declarations.
|
||||
*
|
||||
* @phpstan-consistent-constructor
|
||||
*/
|
||||
class StaticReflectionParser implements ReflectionProviderInterface
|
||||
{
|
||||
@@ -101,7 +107,7 @@ class StaticReflectionParser implements ReflectionProviderInterface
|
||||
/**
|
||||
* The parent PSR-0 Parser.
|
||||
*
|
||||
* @var \Doctrine\Common\Reflection\StaticReflectionParser
|
||||
* @var StaticReflectionParser
|
||||
*/
|
||||
protected $parentStaticReflectionParser;
|
||||
|
||||
@@ -139,6 +145,7 @@ class StaticReflectionParser implements ReflectionProviderInterface
|
||||
if ($this->parsed || ! $fileName) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->parsed = true;
|
||||
$contents = file_get_contents($fileName);
|
||||
if ($this->classAnnotationOptimize) {
|
||||
@@ -148,9 +155,10 @@ class StaticReflectionParser implements ReflectionProviderInterface
|
||||
$contents = $matches[0];
|
||||
}
|
||||
}
|
||||
|
||||
$tokenParser = new TokenParser($contents);
|
||||
$docComment = '';
|
||||
$last_token = false;
|
||||
$lastToken = false;
|
||||
|
||||
while ($token = $tokenParser->next(false)) {
|
||||
switch ($token[0]) {
|
||||
@@ -161,10 +169,11 @@ class StaticReflectionParser implements ReflectionProviderInterface
|
||||
$docComment = $token[1];
|
||||
break;
|
||||
case T_CLASS:
|
||||
if ($last_token !== T_PAAMAYIM_NEKUDOTAYIM) {
|
||||
if ($lastToken !== T_PAAMAYIM_NEKUDOTAYIM && $lastToken !== T_NEW) {
|
||||
$this->docComment['class'] = $docComment;
|
||||
$docComment = '';
|
||||
}
|
||||
|
||||
break;
|
||||
case T_VAR:
|
||||
case T_PRIVATE:
|
||||
@@ -176,6 +185,7 @@ class StaticReflectionParser implements ReflectionProviderInterface
|
||||
$this->docComment['property'][$propertyName] = $docComment;
|
||||
continue 2;
|
||||
}
|
||||
|
||||
if ($token[0] !== T_FUNCTION) {
|
||||
// For example, it can be T_FINAL.
|
||||
continue 2;
|
||||
@@ -188,6 +198,11 @@ class StaticReflectionParser implements ReflectionProviderInterface
|
||||
while (($token = $tokenParser->next()) && $token[0] !== T_STRING) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($token === null) {
|
||||
break;
|
||||
}
|
||||
|
||||
$methodName = $token[1];
|
||||
$this->docComment['method'][$methodName] = $docComment;
|
||||
$docComment = '';
|
||||
@@ -206,6 +221,7 @@ class StaticReflectionParser implements ReflectionProviderInterface
|
||||
$prefix = strtolower($this->parentClassName);
|
||||
$postfix = '';
|
||||
}
|
||||
|
||||
foreach ($this->useStatements as $alias => $use) {
|
||||
if ($alias !== $prefix) {
|
||||
continue;
|
||||
@@ -215,13 +231,15 @@ class StaticReflectionParser implements ReflectionProviderInterface
|
||||
$fullySpecified = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $fullySpecified) {
|
||||
$this->parentClassName = '\\' . $this->namespace . '\\' . $this->parentClassName;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
$last_token = $token[0];
|
||||
$lastToken = is_array($token) ? $token[0] : false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -320,9 +338,11 @@ class StaticReflectionParser implements ReflectionProviderInterface
|
||||
if (isset($this->docComment[$type][$name])) {
|
||||
return $this;
|
||||
}
|
||||
|
||||
if (! empty($this->parentClassName)) {
|
||||
return $this->getParentStaticReflectionParser()->getStaticReflectionParserForDeclaringClass($type, $name);
|
||||
}
|
||||
|
||||
throw new ReflectionException('Invalid ' . $type . ' "' . $name . '"');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace Doctrine\Common\Reflection;
|
||||
|
||||
use ReflectionException;
|
||||
use ReflectionProperty;
|
||||
use ReturnTypeWillChange;
|
||||
|
||||
class StaticReflectionProperty extends ReflectionProperty
|
||||
{
|
||||
@@ -33,6 +34,7 @@ class StaticReflectionProperty extends ReflectionProperty
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getName()
|
||||
{
|
||||
return $this->propertyName;
|
||||
@@ -49,6 +51,7 @@ class StaticReflectionProperty extends ReflectionProperty
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getDeclaringClass()
|
||||
{
|
||||
return $this->getStaticReflectionParser()->getReflectionClass();
|
||||
@@ -57,6 +60,7 @@ class StaticReflectionProperty extends ReflectionProperty
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getDocComment()
|
||||
{
|
||||
return $this->getStaticReflectionParser()->getDocComment('property', $this->propertyName);
|
||||
@@ -81,6 +85,7 @@ class StaticReflectionProperty extends ReflectionProperty
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getModifiers()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -89,6 +94,7 @@ class StaticReflectionProperty extends ReflectionProperty
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getValue($object = null)
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -97,6 +103,7 @@ class StaticReflectionProperty extends ReflectionProperty
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function isDefault()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -105,6 +112,7 @@ class StaticReflectionProperty extends ReflectionProperty
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function isPrivate()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -113,6 +121,7 @@ class StaticReflectionProperty extends ReflectionProperty
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function isProtected()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -121,6 +130,7 @@ class StaticReflectionProperty extends ReflectionProperty
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function isPublic()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -129,6 +139,7 @@ class StaticReflectionProperty extends ReflectionProperty
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function isStatic()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -137,6 +148,7 @@ class StaticReflectionProperty extends ReflectionProperty
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function setAccessible($accessible)
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -145,6 +157,7 @@ class StaticReflectionProperty extends ReflectionProperty
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function setValue($object, $value = null)
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Common\Reflection;
|
||||
|
||||
use ReflectionProperty;
|
||||
use ReturnTypeWillChange;
|
||||
|
||||
/**
|
||||
* PHP Typed No Default Reflection Property - special override for typed properties without a default value.
|
||||
*/
|
||||
class TypedNoDefaultReflectionProperty extends ReflectionProperty
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* Checks that a typed property is initialized before accessing its value.
|
||||
* This is necessary to avoid PHP error "Error: Typed property must not be accessed before initialization".
|
||||
* Should be used only for reflecting typed properties without a default value.
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getValue($object = null)
|
||||
{
|
||||
return $object !== null && $this->isInitialized($object) ? parent::getValue($object) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* Works around the problem with setting typed no default properties to
|
||||
* NULL which is not supported, instead unset() to uninitialize.
|
||||
*
|
||||
* @link https://github.com/doctrine/orm/issues/7999
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function setValue($object, $value = null)
|
||||
{
|
||||
if ($value === null && $this->hasType() && ! $this->getType()->allowsNull()) {
|
||||
$propertyName = $this->getName();
|
||||
|
||||
$unsetter = function () use ($propertyName) {
|
||||
unset($this->$propertyName);
|
||||
};
|
||||
$unsetter = $unsetter->bindTo($object, $this->getDeclaringClass()->getName());
|
||||
$unsetter();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
parent::setValue($object, $value);
|
||||
}
|
||||
}
|
||||
@@ -7,13 +7,17 @@
|
||||
<arg name="colors"/>
|
||||
|
||||
<!-- Ignore warnings and show progress of the run -->
|
||||
<arg value="np"/>
|
||||
<arg value="nps"/>
|
||||
|
||||
<config name="php_version" value="70100"/>
|
||||
|
||||
<file>lib</file>
|
||||
<file>tests</file>
|
||||
|
||||
<rule ref="Doctrine">
|
||||
<exclude name="SlevomatCodingStandard.TypeHints.DeclareStrictTypes"/>
|
||||
<exclude name="SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint"/>
|
||||
<exclude name="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingNativeTypeHint"/>
|
||||
<exclude name="SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint"/>
|
||||
<exclude name="SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingReturnTypeHint"/>
|
||||
</rule>
|
||||
@@ -26,8 +30,20 @@
|
||||
<exclude-pattern>*/tests/*</exclude-pattern>
|
||||
</rule>
|
||||
|
||||
<rule ref="Squiz.NamingConventions.ValidVariableName.NotCamelCaps">
|
||||
<exclude-pattern>tests/*</exclude-pattern>
|
||||
</rule>
|
||||
|
||||
<rule ref="SlevomatCodingStandard.Classes.SuperfluousInterfaceNaming">
|
||||
<exclude-pattern>lib/Doctrine/Common/Reflection/ClassFinderInterface.php</exclude-pattern>
|
||||
<exclude-pattern>lib/Doctrine/Common/Reflection/ReflectionProviderInterface.php</exclude-pattern>
|
||||
</rule>
|
||||
|
||||
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingAnyTypeHint">
|
||||
<exclude-pattern>tests/*</exclude-pattern>
|
||||
</rule>
|
||||
|
||||
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingAnyTypeHint">
|
||||
<exclude-pattern>tests/*</exclude-pattern>
|
||||
</rule>
|
||||
</ruleset>
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
includes:
|
||||
- vendor/phpstan/phpstan-phpunit/extension.neon
|
||||
|
||||
parameters:
|
||||
ignoreErrors:
|
||||
- '#Doctrine\\Common\\Reflection\\StaticReflection[a-zA-Z0-9_]+::__construct\(\) does not call parent constructor from Reflection[a-zA-Z0-9_]+#'
|
||||
9
phpstan.neon.dist
Normal file
9
phpstan.neon.dist
Normal file
@@ -0,0 +1,9 @@
|
||||
parameters:
|
||||
level: 3
|
||||
paths:
|
||||
- lib
|
||||
- tests
|
||||
phpVersion: 80106
|
||||
|
||||
includes:
|
||||
- vendor/phpstan/phpstan-phpunit/extension.neon
|
||||
@@ -8,7 +8,8 @@
|
||||
>
|
||||
<testsuites>
|
||||
<testsuite name="Doctrine Event Manager Test Suite">
|
||||
<directory>./tests/Doctrine/</directory>
|
||||
<directory>./tests/Doctrine/Tests</directory>
|
||||
<directory phpVersion="7.4" phpVersionOperator=">=">./tests/Doctrine/Tests_PHP74</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Common\Reflection;
|
||||
|
||||
use Doctrine\Common\Annotations\Annotation;
|
||||
|
||||
/**
|
||||
* @Annotation(
|
||||
* key = "value"
|
||||
* )
|
||||
*/
|
||||
class AnnotationClassWithAnonymousClass
|
||||
{
|
||||
public function foo()
|
||||
{
|
||||
$new_class = new class () {
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace Doctrine\Tests\Common\Reflection;
|
||||
|
||||
use Doctrine\Common\Annotations\Annotation;
|
||||
use stdClass;
|
||||
|
||||
/**
|
||||
* @Annotation(
|
||||
@@ -11,10 +12,10 @@ use Doctrine\Common\Annotations\Annotation;
|
||||
*/
|
||||
class AnnotationClassWithScopeResolution
|
||||
{
|
||||
public const FOO = \stdClass::class;
|
||||
public const FOO = stdClass::class;
|
||||
|
||||
/**
|
||||
* Example with comment.
|
||||
*/
|
||||
public const BAR = \stdClass::class;
|
||||
public const BAR = stdClass::class;
|
||||
}
|
||||
|
||||
@@ -4,42 +4,45 @@ namespace Doctrine\Tests\Common\Reflection;
|
||||
|
||||
use Doctrine\Common\Reflection\Psr0FindFile;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
use function sprintf;
|
||||
use function strlen;
|
||||
use function substr;
|
||||
|
||||
use const DIRECTORY_SEPARATOR;
|
||||
|
||||
class Psr0FindFileTest extends TestCase
|
||||
{
|
||||
/** @var Psr0FindFile */
|
||||
private $psr0FindFile;
|
||||
|
||||
public function testFindFile() : void
|
||||
public function testFindFile(): void
|
||||
{
|
||||
$file = $this->psr0FindFile->findFile(NoParent::class);
|
||||
|
||||
self::assertSame(sprintf('%s/NoParent.php', __DIR__), $file);
|
||||
self::assertSame(sprintf('%s%sNoParent.php', __DIR__, DIRECTORY_SEPARATOR), $file);
|
||||
}
|
||||
|
||||
public function testFindFileNotFound() : void
|
||||
public function testFindFileNotFound(): void
|
||||
{
|
||||
self::assertNull($this->psr0FindFile->findFile('DoesNotExist'));
|
||||
}
|
||||
|
||||
public function testFindFileWithLeadingNamespaceSeparator() : void
|
||||
public function testFindFileWithLeadingNamespaceSeparator(): void
|
||||
{
|
||||
$file = $this->psr0FindFile->findFile('\Doctrine\Tests\Common\Reflection\NoParent');
|
||||
|
||||
self::assertSame(sprintf('%s/NoParent.php', __DIR__), $file);
|
||||
self::assertSame(sprintf('%s%sNoParent.php', __DIR__, DIRECTORY_SEPARATOR), $file);
|
||||
}
|
||||
|
||||
public function testFindFileFromPearLikeClassName() : void
|
||||
public function testFindFileFromPearLikeClassName(): void
|
||||
{
|
||||
$file = $this->psr0FindFile->findFile('Doctrine_Tests_Common_Reflection_NoParent');
|
||||
|
||||
self::assertSame(sprintf('%s/NoParent.php', __DIR__), $file);
|
||||
self::assertSame(sprintf('%s%sNoParent.php', __DIR__, DIRECTORY_SEPARATOR), $file);
|
||||
}
|
||||
|
||||
protected function setUp() : void
|
||||
protected function setUp(): void
|
||||
{
|
||||
$testsRoot = substr(__DIR__, 0, -strlen(__NAMESPACE__) - 1);
|
||||
|
||||
|
||||
@@ -2,14 +2,17 @@
|
||||
|
||||
namespace Doctrine\Tests\Common\Reflection;
|
||||
|
||||
use BadMethodCallException;
|
||||
use Closure;
|
||||
use Doctrine\Common\Proxy\Proxy;
|
||||
use Doctrine\Common\Reflection\RuntimePublicReflectionProperty;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
use function call_user_func;
|
||||
|
||||
class RuntimePublicReflectionPropertyTest extends TestCase
|
||||
{
|
||||
public function testGetValue() : void
|
||||
public function testGetValue(): void
|
||||
{
|
||||
$object = new RuntimePublicReflectionPropertyTestClass();
|
||||
|
||||
@@ -22,7 +25,7 @@ class RuntimePublicReflectionPropertyTest extends TestCase
|
||||
self::assertNull($reflProperty->getValue($object));
|
||||
}
|
||||
|
||||
public function testSetValue() : void
|
||||
public function testSetValue(): void
|
||||
{
|
||||
$object = new RuntimePublicReflectionPropertyTestClass();
|
||||
|
||||
@@ -35,11 +38,11 @@ class RuntimePublicReflectionPropertyTest extends TestCase
|
||||
self::assertSame('changedValue', $reflProperty->getValue($object));
|
||||
}
|
||||
|
||||
public function testGetValueOnProxyPublicProperty() : void
|
||||
public function testGetValueOnProxyPublicProperty(): void
|
||||
{
|
||||
$getCheckMock = $this->getMockBuilder('stdClass')->setMethods(['callGet'])->getMock();
|
||||
$getCheckMock->expects($this->never())->method('callGet');
|
||||
$initializer = function () use ($getCheckMock) {
|
||||
$initializer = static function () use ($getCheckMock) {
|
||||
call_user_func($getCheckMock);
|
||||
};
|
||||
|
||||
@@ -56,11 +59,11 @@ class RuntimePublicReflectionPropertyTest extends TestCase
|
||||
self::assertNull($reflProperty->getValue($mockProxy));
|
||||
}
|
||||
|
||||
public function testSetValueOnProxyPublicProperty() : void
|
||||
public function testSetValueOnProxyPublicProperty(): void
|
||||
{
|
||||
$setCheckMock = $this->getMockBuilder('stdClass')->setMethods(['neverCallSet'])->getMock();
|
||||
$setCheckMock->expects($this->never())->method('neverCallSet');
|
||||
$initializer = function () use ($setCheckMock) {
|
||||
$initializer = static function () use ($setCheckMock) {
|
||||
call_user_func([$setCheckMock, 'neverCallSet']);
|
||||
};
|
||||
|
||||
@@ -81,7 +84,7 @@ class RuntimePublicReflectionPropertyTest extends TestCase
|
||||
|
||||
$setCheckMock = $this->getMockBuilder('stdClass')->setMethods(['callSet'])->getMock();
|
||||
$setCheckMock->expects($this->once())->method('callSet');
|
||||
$initializer = function () use ($setCheckMock) {
|
||||
$initializer = static function () use ($setCheckMock) {
|
||||
call_user_func([$setCheckMock, 'callSet']);
|
||||
};
|
||||
|
||||
@@ -99,7 +102,7 @@ class RuntimePublicReflectionPropertyTest extends TestCase
|
||||
*/
|
||||
class RuntimePublicReflectionPropertyTestProxyMock implements Proxy
|
||||
{
|
||||
/** @var \Closure|null */
|
||||
/** @var Closure|null */
|
||||
private $initializer = null;
|
||||
|
||||
/** @var bool */
|
||||
@@ -119,7 +122,7 @@ class RuntimePublicReflectionPropertyTestProxyMock implements Proxy
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function __setInitializer(?\Closure $initializer = null)
|
||||
public function __setInitializer(?Closure $initializer = null)
|
||||
{
|
||||
$this->initializer = $initializer;
|
||||
}
|
||||
@@ -129,6 +132,7 @@ class RuntimePublicReflectionPropertyTestProxyMock implements Proxy
|
||||
*/
|
||||
public function __getLazyProperties()
|
||||
{
|
||||
throw new BadMethodCallException('Not implemented.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -200,7 +204,7 @@ class RuntimePublicReflectionPropertyTestProxyMock implements Proxy
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function __setCloner(?\Closure $cloner = null)
|
||||
public function __setCloner(?Closure $cloner = null)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -209,6 +213,7 @@ class RuntimePublicReflectionPropertyTestProxyMock implements Proxy
|
||||
*/
|
||||
public function __getCloner()
|
||||
{
|
||||
throw new BadMethodCallException('Not implemented.');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@ use Doctrine\Common\Reflection\StaticReflectionClass;
|
||||
use Doctrine\Common\Reflection\StaticReflectionMethod;
|
||||
use Doctrine\Common\Reflection\StaticReflectionParser;
|
||||
use Doctrine\Common\Reflection\StaticReflectionProperty;
|
||||
use PHPStan\Testing\TestCase;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use ReflectionException;
|
||||
|
||||
class StaticReflectionClassTest extends TestCase
|
||||
@@ -18,7 +18,7 @@ class StaticReflectionClassTest extends TestCase
|
||||
/** @var StaticReflectionClass */
|
||||
private $staticReflectionClass;
|
||||
|
||||
public function testGetName() : void
|
||||
public function testGetName(): void
|
||||
{
|
||||
$this->staticReflectionParser->expects($this->once())
|
||||
->method('getClassName')
|
||||
@@ -27,7 +27,7 @@ class StaticReflectionClassTest extends TestCase
|
||||
self::assertSame('ClassName', $this->staticReflectionClass->getName());
|
||||
}
|
||||
|
||||
public function testGetDocComment() : void
|
||||
public function testGetDocComment(): void
|
||||
{
|
||||
$this->staticReflectionParser->expects($this->once())
|
||||
->method('getDocComment')
|
||||
@@ -36,7 +36,7 @@ class StaticReflectionClassTest extends TestCase
|
||||
self::assertSame('test doc comment', $this->staticReflectionClass->getDocComment());
|
||||
}
|
||||
|
||||
public function testGetNamespaceName() : void
|
||||
public function testGetNamespaceName(): void
|
||||
{
|
||||
$this->staticReflectionParser->expects($this->once())
|
||||
->method('getNamespaceName')
|
||||
@@ -45,7 +45,7 @@ class StaticReflectionClassTest extends TestCase
|
||||
self::assertSame('Namespace', $this->staticReflectionClass->getNamespaceName());
|
||||
}
|
||||
|
||||
public function testGetUseStatements() : void
|
||||
public function testGetUseStatements(): void
|
||||
{
|
||||
$this->staticReflectionParser->expects($this->once())
|
||||
->method('getUseStatements')
|
||||
@@ -54,9 +54,9 @@ class StaticReflectionClassTest extends TestCase
|
||||
self::assertSame(['ClassName'], $this->staticReflectionClass->getUseStatements());
|
||||
}
|
||||
|
||||
public function testGetMethod() : void
|
||||
public function testGetMethod(): void
|
||||
{
|
||||
$staticReflectionMethod = $this->createMock(StaticReflectionMethod::class);
|
||||
$staticReflectionMethod = $this->createPartialMock(StaticReflectionMethod::class, []);
|
||||
|
||||
$this->staticReflectionParser->expects($this->once())
|
||||
->method('getReflectionMethod')
|
||||
@@ -66,7 +66,7 @@ class StaticReflectionClassTest extends TestCase
|
||||
self::assertSame($staticReflectionMethod, $this->staticReflectionClass->getMethod('method'));
|
||||
}
|
||||
|
||||
public function testGetProperty() : void
|
||||
public function testGetProperty(): void
|
||||
{
|
||||
$staticReflectionProperty = $this->createMock(StaticReflectionProperty::class);
|
||||
|
||||
@@ -79,11 +79,11 @@ class StaticReflectionClassTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getNotImplementedMethods
|
||||
*
|
||||
* @param mixed[] $args
|
||||
*
|
||||
* @dataProvider getNotImplementedMethods
|
||||
*/
|
||||
public function testNotImplemented(string $method, array $args) : void
|
||||
public function testNotImplemented(string $method, array $args): void
|
||||
{
|
||||
$this->expectException(ReflectionException::class);
|
||||
$this->expectExceptionMessage('Method not implemented');
|
||||
@@ -94,7 +94,7 @@ class StaticReflectionClassTest extends TestCase
|
||||
/**
|
||||
* @return mixed[]
|
||||
*/
|
||||
public function getNotImplementedMethods() : array
|
||||
public function getNotImplementedMethods(): array
|
||||
{
|
||||
return [
|
||||
['export', ['Test', 'Test', true]],
|
||||
@@ -143,7 +143,7 @@ class StaticReflectionClassTest extends TestCase
|
||||
];
|
||||
}
|
||||
|
||||
protected function setUp() : void
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->staticReflectionParser = $this->createMock(StaticReflectionParser::class);
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@ namespace Doctrine\Tests\Common\Reflection;
|
||||
use Doctrine\Common\Reflection\StaticReflectionClass;
|
||||
use Doctrine\Common\Reflection\StaticReflectionMethod;
|
||||
use Doctrine\Common\Reflection\StaticReflectionParser;
|
||||
use PHPStan\Testing\TestCase;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use ReflectionException;
|
||||
|
||||
class StaticReflectionMethodTest extends TestCase
|
||||
@@ -20,14 +20,14 @@ class StaticReflectionMethodTest extends TestCase
|
||||
/** @var StaticReflectionMethod */
|
||||
private $staticReflectionMethod;
|
||||
|
||||
public function testGetName() : void
|
||||
public function testGetName(): void
|
||||
{
|
||||
self::assertSame($this->methodName, $this->staticReflectionMethod->getName());
|
||||
}
|
||||
|
||||
public function testGetDeclaringClass() : void
|
||||
public function testGetDeclaringClass(): void
|
||||
{
|
||||
$staticReflectionClass = $this->createMock(StaticReflectionClass::class);
|
||||
$staticReflectionClass = $this->createPartialMock(StaticReflectionClass::class, []);
|
||||
|
||||
$this->staticReflectionParser->expects($this->once())
|
||||
->method('getReflectionClass')
|
||||
@@ -36,7 +36,7 @@ class StaticReflectionMethodTest extends TestCase
|
||||
self::assertSame($staticReflectionClass, $this->staticReflectionMethod->getDeclaringClass());
|
||||
}
|
||||
|
||||
public function testGetNamespaceName() : void
|
||||
public function testGetNamespaceName(): void
|
||||
{
|
||||
$this->staticReflectionParser->expects($this->once())
|
||||
->method('getNamespaceName')
|
||||
@@ -45,9 +45,9 @@ class StaticReflectionMethodTest extends TestCase
|
||||
self::assertSame('test', $this->staticReflectionMethod->getNamespaceName());
|
||||
}
|
||||
|
||||
public function testGetDocComment() : void
|
||||
public function testGetDocComment(): void
|
||||
{
|
||||
$staticReflectionClass = $this->createMock(StaticReflectionClass::class);
|
||||
$staticReflectionClass = $this->createPartialMock(StaticReflectionClass::class, []);
|
||||
|
||||
$this->staticReflectionParser->expects($this->once())
|
||||
->method('getDocComment')
|
||||
@@ -57,9 +57,9 @@ class StaticReflectionMethodTest extends TestCase
|
||||
self::assertSame('test doc comment', $this->staticReflectionMethod->getDocComment());
|
||||
}
|
||||
|
||||
public function testGetUseStatements() : void
|
||||
public function testGetUseStatements(): void
|
||||
{
|
||||
$staticReflectionClass = $this->createMock(StaticReflectionClass::class);
|
||||
$staticReflectionClass = $this->createPartialMock(StaticReflectionClass::class, []);
|
||||
|
||||
$this->staticReflectionParser->expects($this->once())
|
||||
->method('getUseStatements')
|
||||
@@ -69,11 +69,11 @@ class StaticReflectionMethodTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getNotImplementedMethods
|
||||
*
|
||||
* @param mixed[] $args
|
||||
*
|
||||
* @dataProvider getNotImplementedMethods
|
||||
*/
|
||||
public function testNotImplemented(string $method, array $args) : void
|
||||
public function testNotImplemented(string $method, array $args): void
|
||||
{
|
||||
$this->expectException(ReflectionException::class);
|
||||
$this->expectExceptionMessage('Method not implemented');
|
||||
@@ -84,7 +84,7 @@ class StaticReflectionMethodTest extends TestCase
|
||||
/**
|
||||
* @return mixed[]
|
||||
*/
|
||||
public function getNotImplementedMethods() : array
|
||||
public function getNotImplementedMethods(): array
|
||||
{
|
||||
return [
|
||||
['export', ['Test', 'Test', true]],
|
||||
@@ -123,7 +123,7 @@ class StaticReflectionMethodTest extends TestCase
|
||||
];
|
||||
}
|
||||
|
||||
protected function setUp() : void
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->staticReflectionParser = $this->createMock(StaticReflectionParser::class);
|
||||
$this->methodName = 'methodName';
|
||||
|
||||
@@ -7,19 +7,20 @@ use Doctrine\Common\Reflection\StaticReflectionParser;
|
||||
use Doctrine\Tests\Common\Reflection\Dummies\NoParent as NoParentDummy;
|
||||
use Doctrine\Tests\DoctrineTestCase;
|
||||
use ReflectionException;
|
||||
|
||||
use function strlen;
|
||||
use function substr;
|
||||
|
||||
class StaticReflectionParserTest extends DoctrineTestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider parentClassData
|
||||
*
|
||||
* @param bool $classAnnotationOptimize
|
||||
* @param string $parsedClassName
|
||||
* @param string $expectedClassName
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @dataProvider parentClassData
|
||||
*/
|
||||
public function testParentClass($classAnnotationOptimize, $parsedClassName, $expectedClassName)
|
||||
{
|
||||
@@ -89,7 +90,7 @@ class StaticReflectionParserTest extends DoctrineTestCase
|
||||
{
|
||||
$testsRoot = substr(__DIR__, 0, -strlen(__NAMESPACE__) - 1);
|
||||
$paths = [
|
||||
'Doctrine\\Tests' => [$testsRoot],
|
||||
'Doctrine\\Tests' => [$testsRoot],
|
||||
];
|
||||
$staticReflectionParser = new StaticReflectionParser($class, new Psr0FindFile($paths), $classAnnotationOptimize);
|
||||
$expectedDocComment = '/**
|
||||
@@ -101,7 +102,7 @@ class StaticReflectionParserTest extends DoctrineTestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]|bool[]
|
||||
* @return array<array<bool|string>>
|
||||
*/
|
||||
public function classAnnotationOptimize()
|
||||
{
|
||||
@@ -110,6 +111,8 @@ class StaticReflectionParserTest extends DoctrineTestCase
|
||||
[ExampleAnnotationClass::class, true],
|
||||
[AnnotationClassWithScopeResolution::class, false],
|
||||
[AnnotationClassWithScopeResolution::class, true],
|
||||
[AnnotationClassWithAnonymousClass::class, false],
|
||||
[AnnotationClassWithAnonymousClass::class, true],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@ namespace Doctrine\Tests\Common\Reflection;
|
||||
use Doctrine\Common\Reflection\StaticReflectionClass;
|
||||
use Doctrine\Common\Reflection\StaticReflectionParser;
|
||||
use Doctrine\Common\Reflection\StaticReflectionProperty;
|
||||
use PHPStan\Testing\TestCase;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use ReflectionException;
|
||||
|
||||
class StaticReflectionPropertyTest extends TestCase
|
||||
@@ -20,14 +20,14 @@ class StaticReflectionPropertyTest extends TestCase
|
||||
/** @var StaticReflectionProperty */
|
||||
private $staticReflectionProperty;
|
||||
|
||||
public function testGetName() : void
|
||||
public function testGetName(): void
|
||||
{
|
||||
self::assertSame($this->propertyName, $this->staticReflectionProperty->getName());
|
||||
}
|
||||
|
||||
public function testGetDeclaringClass() : void
|
||||
public function testGetDeclaringClass(): void
|
||||
{
|
||||
$staticReflectionClass = $this->createMock(StaticReflectionClass::class);
|
||||
$staticReflectionClass = $this->createPartialMock(StaticReflectionClass::class, []);
|
||||
|
||||
$this->staticReflectionParser->expects($this->once())
|
||||
->method('getReflectionClass')
|
||||
@@ -36,9 +36,9 @@ class StaticReflectionPropertyTest extends TestCase
|
||||
self::assertSame($staticReflectionClass, $this->staticReflectionProperty->getDeclaringClass());
|
||||
}
|
||||
|
||||
public function testGetDocComment() : void
|
||||
public function testGetDocComment(): void
|
||||
{
|
||||
$staticReflectionClass = $this->createMock(StaticReflectionClass::class);
|
||||
$staticReflectionClass = $this->createPartialMock(StaticReflectionClass::class, []);
|
||||
|
||||
$this->staticReflectionParser->expects($this->once())
|
||||
->method('getDocComment')
|
||||
@@ -48,9 +48,9 @@ class StaticReflectionPropertyTest extends TestCase
|
||||
self::assertSame('test doc comment', $this->staticReflectionProperty->getDocComment());
|
||||
}
|
||||
|
||||
public function testGetUseStatements() : void
|
||||
public function testGetUseStatements(): void
|
||||
{
|
||||
$staticReflectionClass = $this->createMock(StaticReflectionClass::class);
|
||||
$staticReflectionClass = $this->createPartialMock(StaticReflectionClass::class, []);
|
||||
|
||||
$this->staticReflectionParser->expects($this->once())
|
||||
->method('getUseStatements')
|
||||
@@ -60,11 +60,11 @@ class StaticReflectionPropertyTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getNotImplementedMethods
|
||||
*
|
||||
* @param mixed[] $args
|
||||
*
|
||||
* @dataProvider getNotImplementedMethods
|
||||
*/
|
||||
public function testNotImplemented(string $method, array $args) : void
|
||||
public function testNotImplemented(string $method, array $args): void
|
||||
{
|
||||
$this->expectException(ReflectionException::class);
|
||||
$this->expectExceptionMessage('Method not implemented');
|
||||
@@ -75,7 +75,7 @@ class StaticReflectionPropertyTest extends TestCase
|
||||
/**
|
||||
* @return mixed[]
|
||||
*/
|
||||
public function getNotImplementedMethods() : array
|
||||
public function getNotImplementedMethods(): array
|
||||
{
|
||||
return [
|
||||
['export', ['Test', 'Test', true]],
|
||||
@@ -92,7 +92,7 @@ class StaticReflectionPropertyTest extends TestCase
|
||||
];
|
||||
}
|
||||
|
||||
protected function setUp() : void
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->staticReflectionParser = $this->createMock(StaticReflectionParser::class);
|
||||
$this->propertyName = 'propertyName';
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
namespace Doctrine\Tests;
|
||||
|
||||
use const E_ALL;
|
||||
use const E_STRICT;
|
||||
use function error_reporting;
|
||||
use function is_file;
|
||||
use function is_readable;
|
||||
@@ -11,10 +9,13 @@ use function spl_autoload_register;
|
||||
use function strpos;
|
||||
use function strtr;
|
||||
|
||||
use const E_ALL;
|
||||
use const E_STRICT;
|
||||
|
||||
error_reporting(E_ALL | E_STRICT);
|
||||
|
||||
// register silently failing autoloader
|
||||
spl_autoload_register(function ($class) {
|
||||
spl_autoload_register(static function ($class) {
|
||||
if (strpos($class, 'Doctrine\Tests\\') !== 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests_PHP74\Common\Reflection\Dummies;
|
||||
|
||||
trait TokenParserAnonymousFunctionTestClass
|
||||
{
|
||||
protected function method()
|
||||
{
|
||||
return static function ($value) {
|
||||
return $value;
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests_PHP74\Common\Reflection;
|
||||
|
||||
use Doctrine\Common\Reflection\Psr0FindFile;
|
||||
use Doctrine\Common\Reflection\StaticReflectionParser;
|
||||
use Doctrine\Tests_PHP74\Common\Reflection\Dummies\TokenParserAnonymousFunctionTestClass;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
use function strlen;
|
||||
use function substr;
|
||||
|
||||
class TokenParserAnonymousFunctionTest extends TestCase
|
||||
{
|
||||
public function testGetValue(): void
|
||||
{
|
||||
$testsRoot = substr(__DIR__, 0, -strlen(__NAMESPACE__) - 1);
|
||||
$paths = [
|
||||
'Doctrine\\Tests_PHP74' => [$testsRoot],
|
||||
];
|
||||
$staticReflectionParser = new StaticReflectionParser(TokenParserAnonymousFunctionTestClass::class, new Psr0FindFile($paths));
|
||||
|
||||
self::assertEquals('', $staticReflectionParser->getDocComment());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
namespace Doctrine\Tests_PHP74\Common\Reflection;
|
||||
|
||||
use Doctrine\Common\Reflection\TypedNoDefaultReflectionProperty;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class TypedNoDefaultReflectionPropertyTest extends TestCase
|
||||
{
|
||||
public function testGetValue(): void
|
||||
{
|
||||
$object = new TypedNoDefaultReflectionPropertyTestClass();
|
||||
|
||||
$reflProperty = new TypedNoDefaultReflectionProperty(TypedNoDefaultReflectionPropertyTestClass::class, 'test');
|
||||
|
||||
self::assertNull($reflProperty->getValue($object));
|
||||
|
||||
$object->test = 'testValue';
|
||||
|
||||
self::assertSame('testValue', $reflProperty->getValue($object));
|
||||
|
||||
unset($object->test);
|
||||
|
||||
self::assertNull($reflProperty->getValue($object));
|
||||
}
|
||||
|
||||
public function testSetValueNull(): void
|
||||
{
|
||||
$reflection = new TypedNoDefaultReflectionProperty(TypedFoo::class, 'id');
|
||||
$reflection->setAccessible(true);
|
||||
|
||||
$object = new TypedFoo();
|
||||
$object->setId(1);
|
||||
|
||||
self::assertTrue($reflection->isInitialized($object));
|
||||
|
||||
$reflection->setValue($object, null);
|
||||
|
||||
self::assertNull($reflection->getValue($object));
|
||||
self::assertFalse($reflection->isInitialized($object));
|
||||
}
|
||||
|
||||
public function testSetValueNullOnNullableProperty(): void
|
||||
{
|
||||
$reflection = new TypedNoDefaultReflectionProperty(TypedNullableFoo::class, 'value');
|
||||
$reflection->setAccessible(true);
|
||||
|
||||
$object = new TypedNullableFoo();
|
||||
|
||||
$reflection->setValue($object, null);
|
||||
|
||||
self::assertNull($reflection->getValue($object));
|
||||
self::assertTrue($reflection->isInitialized($object));
|
||||
self::assertNull($object->getValue());
|
||||
}
|
||||
}
|
||||
|
||||
class TypedNoDefaultReflectionPropertyTestClass
|
||||
{
|
||||
public string $test;
|
||||
}
|
||||
|
||||
class TypedFoo
|
||||
{
|
||||
private int $id;
|
||||
|
||||
public function setId($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
}
|
||||
|
||||
class TypedNullableFoo
|
||||
{
|
||||
private ?string $value;
|
||||
|
||||
public function setValue($value)
|
||||
{
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
public function getValue()
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user