mirror of
https://github.com/doctrine/reflection.git
synced 2026-03-24 08:42:07 +01:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6bcea3e81a | ||
|
|
1034e5e71f | ||
|
|
d5ae5d3a5b | ||
|
|
02097bc0fe | ||
|
|
381bfa425f | ||
|
|
d186376821 | ||
|
|
04367f0db3 | ||
|
|
e44961f0af | ||
|
|
970fe98e79 | ||
|
|
6c3096dd9b | ||
|
|
26ba62bc4b | ||
|
|
4ac6925893 | ||
|
|
1e02418cf8 |
@@ -4,12 +4,6 @@
|
||||
"slug": "reflection",
|
||||
"docsSlug": "doctrine-reflection",
|
||||
"versions": [
|
||||
{
|
||||
"name": "1.3",
|
||||
"branchName": "master",
|
||||
"slug": "latest",
|
||||
"upcoming": true
|
||||
},
|
||||
{
|
||||
"name": "1.2",
|
||||
"branchName": "1.2.x",
|
||||
|
||||
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -5,4 +5,3 @@
|
||||
/.travis.yml export-ignore
|
||||
/phpunit.xml.dist export-ignore
|
||||
/phpcs.xml.dist export-ignore
|
||||
/composer.lock export-ignore
|
||||
|
||||
42
.github/workflows/coding-standards.yml
vendored
42
.github/workflows/coding-standards.yml
vendored
@@ -1,50 +1,16 @@
|
||||
|
||||
name: "Coding Standards"
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- "*.x"
|
||||
- "master"
|
||||
push:
|
||||
branches:
|
||||
- "*.x"
|
||||
- "master"
|
||||
|
||||
env:
|
||||
COMPOSER_ROOT_VERSION: "1.2"
|
||||
|
||||
jobs:
|
||||
coding-standards:
|
||||
name: "Coding Standards"
|
||||
runs-on: "ubuntu-20.04"
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
php-version:
|
||||
- "7.4"
|
||||
|
||||
steps:
|
||||
- name: "Checkout"
|
||||
uses: "actions/checkout@v2"
|
||||
|
||||
- name: "Install PHP"
|
||||
uses: "shivammathur/setup-php@v2"
|
||||
with:
|
||||
coverage: "none"
|
||||
php-version: "${{ matrix.php-version }}"
|
||||
tools: "cs2pr"
|
||||
|
||||
- name: "Cache dependencies installed with Composer"
|
||||
uses: "actions/cache@v2"
|
||||
with:
|
||||
path: "~/.composer/cache"
|
||||
key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}"
|
||||
restore-keys: "php-${{ matrix.php-version }}-composer-locked-"
|
||||
|
||||
- name: "Install dependencies with Composer"
|
||||
run: "composer install --no-interaction --no-progress --no-suggest"
|
||||
|
||||
# https://github.com/doctrine/.github/issues/3
|
||||
- name: "Run PHP_CodeSniffer"
|
||||
run: "vendor/bin/phpcs -q --no-colors --report=checkstyle | cs2pr"
|
||||
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"
|
||||
@@ -7,39 +7,9 @@ on:
|
||||
|
||||
jobs:
|
||||
release:
|
||||
name: "Git tag, release & create merge-up PR"
|
||||
runs-on: "ubuntu-20.04"
|
||||
|
||||
steps:
|
||||
- name: "Checkout"
|
||||
uses: "actions/checkout@v2"
|
||||
|
||||
- name: "Release"
|
||||
uses: "laminas/automatic-releases@v1"
|
||||
with:
|
||||
command-name: "laminas:automatic-releases:release"
|
||||
env:
|
||||
"GITHUB_TOKEN": ${{ secrets.GITHUB_TOKEN }}
|
||||
"SIGNING_SECRET_KEY": ${{ secrets.SIGNING_SECRET_KEY }}
|
||||
"GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }}
|
||||
"GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }}
|
||||
|
||||
- name: "Create Merge-Up Pull Request"
|
||||
uses: "laminas/automatic-releases@v1"
|
||||
with:
|
||||
command-name: "laminas:automatic-releases:create-merge-up-pull-request"
|
||||
env:
|
||||
"GITHUB_TOKEN": ${{ secrets.GITHUB_TOKEN }}
|
||||
"SIGNING_SECRET_KEY": ${{ secrets.SIGNING_SECRET_KEY }}
|
||||
"GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }}
|
||||
"GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }}
|
||||
|
||||
- name: "Create new milestones"
|
||||
uses: "laminas/automatic-releases@v1"
|
||||
with:
|
||||
command-name: "laminas:automatic-releases:create-milestones"
|
||||
env:
|
||||
"GITHUB_TOKEN": ${{ secrets.GITHUB_TOKEN }}
|
||||
"SIGNING_SECRET_KEY": ${{ secrets.SIGNING_SECRET_KEY }}
|
||||
"GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }}
|
||||
"GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }}
|
||||
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
|
||||
|
||||
49
.travis.yml
49
.travis.yml
@@ -1,49 +0,0 @@
|
||||
dist: xenial
|
||||
sudo: false
|
||||
language: php
|
||||
|
||||
env:
|
||||
global:
|
||||
- COMPOSER_ROOT_VERSION=1.2
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.composer/cache
|
||||
|
||||
php:
|
||||
- 7.1
|
||||
- 7.2
|
||||
- 7.3
|
||||
- 7.4
|
||||
- nightly
|
||||
|
||||
before_install:
|
||||
- mv ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini{,.disabled} || echo "xdebug not available"
|
||||
|
||||
install:
|
||||
- composer validate --strict
|
||||
- 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_success:
|
||||
- bash <(curl -s https://codecov.io/bash)
|
||||
|
||||
- stage: Lint
|
||||
install:
|
||||
# Use lock file for install so old version of phpstan is used.
|
||||
- travis_retry composer install -n --prefer-dist
|
||||
php: 7.4
|
||||
script: vendor/bin/phpstan analyse
|
||||
@@ -1,7 +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://codecov.io/gh/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.
|
||||
|
||||
|
||||
@@ -19,14 +19,14 @@
|
||||
"require": {
|
||||
"php": "^7.1 || ^8.0",
|
||||
"ext-tokenizer": "*",
|
||||
"doctrine/annotations": "^1.0"
|
||||
"doctrine/annotations": "^1.0 || ^2.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/coding-standard": "^6.0 || ^8.2.0",
|
||||
"doctrine/common": "^2.10",
|
||||
"phpstan/phpstan": "^0.11.0 || ^0.12.20",
|
||||
"phpstan/phpstan-phpunit": "^0.11.0 || ^0.12.16",
|
||||
"phpunit/phpunit": "^7.5 || ^9.1.5"
|
||||
"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"
|
||||
@@ -43,11 +43,10 @@
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"allow-plugins": {
|
||||
"dealerdirect/phpcodesniffer-composer-installer": true
|
||||
},
|
||||
"sort-packages": true
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.2.x-dev"
|
||||
}
|
||||
}
|
||||
"abandoned": "roave/better-reflection"
|
||||
}
|
||||
|
||||
3927
composer.lock
generated
3927
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -3,12 +3,14 @@
|
||||
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');
|
||||
@@ -17,6 +19,7 @@ trait ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function newInstance(mixed ...$args)
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
|
||||
@@ -3,12 +3,14 @@
|
||||
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');
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
|
||||
namespace Doctrine\Common\Reflection\Compatibility;
|
||||
|
||||
use const PHP_VERSION_ID;
|
||||
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 {
|
||||
@@ -12,7 +13,7 @@ if (PHP_VERSION_ID >= 80000) {
|
||||
}
|
||||
|
||||
if (false) {
|
||||
class ReflectionClass
|
||||
trait ReflectionClass
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
|
||||
namespace Doctrine\Common\Reflection\Compatibility;
|
||||
|
||||
use const PHP_VERSION_ID;
|
||||
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 {
|
||||
@@ -12,7 +13,7 @@ if (PHP_VERSION_ID >= 80000) {
|
||||
}
|
||||
|
||||
if (false) {
|
||||
class ReflectionMethod
|
||||
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.
|
||||
*/
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace Doctrine\Common\Reflection;
|
||||
|
||||
use Doctrine\Common\Proxy\Proxy;
|
||||
use ReflectionProperty;
|
||||
use ReturnTypeWillChange;
|
||||
|
||||
/**
|
||||
* PHP Runtime Reflection Public Property - special overrides for public properties.
|
||||
@@ -17,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();
|
||||
@@ -41,6 +43,7 @@ class RuntimePublicReflectionProperty extends ReflectionProperty
|
||||
*
|
||||
* @link https://bugs.php.net/bug.php?id=63463
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function setValue($object, $value = null)
|
||||
{
|
||||
if (! ($object instanceof Proxy && ! $object->__isInitialized())) {
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace Doctrine\Common\Reflection;
|
||||
use Doctrine\Common\Reflection\Compatibility\ReflectionClass as CompatibilityReflectionClass;
|
||||
use ReflectionClass;
|
||||
use ReflectionException;
|
||||
use ReturnTypeWillChange;
|
||||
|
||||
class StaticReflectionClass extends ReflectionClass
|
||||
{
|
||||
@@ -25,6 +26,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getName()
|
||||
{
|
||||
return $this->staticReflectionParser->getClassName();
|
||||
@@ -33,6 +35,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getDocComment()
|
||||
{
|
||||
return $this->staticReflectionParser->getDocComment();
|
||||
@@ -41,6 +44,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getNamespaceName()
|
||||
{
|
||||
return $this->staticReflectionParser->getNamespaceName();
|
||||
@@ -57,6 +61,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getMethod($name)
|
||||
{
|
||||
return $this->staticReflectionParser->getReflectionMethod($name);
|
||||
@@ -65,6 +70,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getProperty($name)
|
||||
{
|
||||
return $this->staticReflectionParser->getReflectionProperty($name);
|
||||
@@ -81,6 +87,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getConstant($name)
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -89,6 +96,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getConstructor()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -97,6 +105,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getDefaultProperties()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -105,6 +114,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getEndLine()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -113,6 +123,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getExtension()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -121,6 +132,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getExtensionName()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -129,6 +141,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getFileName()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -137,6 +150,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getInterfaceNames()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -145,6 +159,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getInterfaces()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -153,6 +168,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getMethods($filter = null)
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -161,6 +177,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getModifiers()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -169,6 +186,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getParentClass()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -177,6 +195,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getProperties($filter = null)
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -185,6 +204,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getShortName()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -193,6 +213,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getStartLine()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -201,6 +222,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getStaticProperties()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -209,6 +231,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getStaticPropertyValue($name, $default = '')
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -217,6 +240,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getTraitAliases()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -225,6 +249,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getTraitNames()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -233,6 +258,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getTraits()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -241,6 +267,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function hasConstant($name)
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -249,6 +276,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function hasMethod($name)
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -257,6 +285,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function hasProperty($name)
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -265,6 +294,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function implementsInterface($interface)
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -273,6 +303,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function inNamespace()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -281,6 +312,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function isAbstract()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -289,6 +321,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function isCloneable()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -297,6 +330,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function isFinal()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -305,6 +339,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function isInstance($object)
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -313,6 +348,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function isInstantiable()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -321,6 +357,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function isInterface()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -329,6 +366,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function isInternal()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -337,6 +375,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function isIterateable()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -345,6 +384,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function isSubclassOf($class)
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -353,6 +393,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function isTrait()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -361,6 +402,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function isUserDefined()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -369,6 +411,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function newInstanceArgs(array $args = [])
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -377,6 +420,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function newInstanceWithoutConstructor()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -385,6 +429,7 @@ class StaticReflectionClass extends ReflectionClass
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function setStaticPropertyValue($name, $value)
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace Doctrine\Common\Reflection;
|
||||
use Doctrine\Common\Reflection\Compatibility\ReflectionMethod as CompatibilityReflectionMethod;
|
||||
use ReflectionException;
|
||||
use ReflectionMethod;
|
||||
use ReturnTypeWillChange;
|
||||
|
||||
class StaticReflectionMethod extends ReflectionMethod
|
||||
{
|
||||
@@ -36,6 +37,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getName()
|
||||
{
|
||||
return $this->methodName;
|
||||
@@ -52,6 +54,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getDeclaringClass()
|
||||
{
|
||||
return $this->getStaticReflectionParser()->getReflectionClass();
|
||||
@@ -60,6 +63,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getNamespaceName()
|
||||
{
|
||||
return $this->getStaticReflectionParser()->getNamespaceName();
|
||||
@@ -68,6 +72,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getDocComment()
|
||||
{
|
||||
return $this->getStaticReflectionParser()->getDocComment('method', $this->methodName);
|
||||
@@ -92,6 +97,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getClosure($object = null)
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -100,6 +106,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getModifiers()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -108,6 +115,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getPrototype()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -116,6 +124,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function invokeArgs($object, array $args)
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -124,6 +133,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function isAbstract()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -132,6 +142,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function isConstructor()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -140,6 +151,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function isDestructor()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -148,6 +160,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function isFinal()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -156,6 +169,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function isPrivate()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -164,6 +178,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function isProtected()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -172,6 +187,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function isPublic()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -180,6 +196,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function isStatic()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -188,6 +205,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function setAccessible($accessible)
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -204,6 +222,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getClosureThis()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -212,6 +231,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getEndLine()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -220,6 +240,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getExtension()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -228,6 +249,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getExtensionName()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -236,6 +258,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getFileName()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -244,6 +267,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getNumberOfParameters()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -252,6 +276,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getNumberOfRequiredParameters()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -260,6 +285,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getParameters()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -268,6 +294,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getShortName()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -276,6 +303,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getStartLine()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -284,6 +312,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function getStaticVariables()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -292,6 +321,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function inNamespace()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -300,6 +330,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function isClosure()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -308,6 +339,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function isDeprecated()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -316,6 +348,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function isInternal()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -324,6 +357,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function isUserDefined()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
@@ -332,6 +366,7 @@ class StaticReflectionMethod extends ReflectionMethod
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function returnsReference()
|
||||
{
|
||||
throw new ReflectionException('Method not implemented');
|
||||
|
||||
@@ -4,6 +4,18 @@ namespace Doctrine\Common\Reflection;
|
||||
|
||||
use Doctrine\Common\Annotations\TokenParser;
|
||||
use ReflectionException;
|
||||
|
||||
use function array_merge;
|
||||
use function file_get_contents;
|
||||
use function is_array;
|
||||
use function ltrim;
|
||||
use function preg_match;
|
||||
use function sprintf;
|
||||
use function strpos;
|
||||
use function strrpos;
|
||||
use function strtolower;
|
||||
use function substr;
|
||||
|
||||
use const T_CLASS;
|
||||
use const T_DOC_COMMENT;
|
||||
use const T_EXTENDS;
|
||||
@@ -17,19 +29,11 @@ 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;
|
||||
use function strpos;
|
||||
use function strrpos;
|
||||
use function strtolower;
|
||||
use function substr;
|
||||
|
||||
/**
|
||||
* Parses a file for namespaces/use/class declarations.
|
||||
*
|
||||
* @phpstan-consistent-constructor
|
||||
*/
|
||||
class StaticReflectionParser implements ReflectionProviderInterface
|
||||
{
|
||||
@@ -103,7 +107,7 @@ class StaticReflectionParser implements ReflectionProviderInterface
|
||||
/**
|
||||
* The parent PSR-0 Parser.
|
||||
*
|
||||
* @var \Doctrine\Common\Reflection\StaticReflectionParser
|
||||
* @var StaticReflectionParser
|
||||
*/
|
||||
protected $parentStaticReflectionParser;
|
||||
|
||||
@@ -141,6 +145,7 @@ class StaticReflectionParser implements ReflectionProviderInterface
|
||||
if ($this->parsed || ! $fileName) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->parsed = true;
|
||||
$contents = file_get_contents($fileName);
|
||||
if ($this->classAnnotationOptimize) {
|
||||
@@ -150,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]) {
|
||||
@@ -163,10 +169,11 @@ class StaticReflectionParser implements ReflectionProviderInterface
|
||||
$docComment = $token[1];
|
||||
break;
|
||||
case T_CLASS:
|
||||
if ($last_token !== T_PAAMAYIM_NEKUDOTAYIM && $last_token !== T_NEW) {
|
||||
if ($lastToken !== T_PAAMAYIM_NEKUDOTAYIM && $lastToken !== T_NEW) {
|
||||
$this->docComment['class'] = $docComment;
|
||||
$docComment = '';
|
||||
}
|
||||
|
||||
break;
|
||||
case T_VAR:
|
||||
case T_PRIVATE:
|
||||
@@ -178,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;
|
||||
@@ -190,9 +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 = '';
|
||||
@@ -211,6 +221,7 @@ class StaticReflectionParser implements ReflectionProviderInterface
|
||||
$prefix = strtolower($this->parentClassName);
|
||||
$postfix = '';
|
||||
}
|
||||
|
||||
foreach ($this->useStatements as $alias => $use) {
|
||||
if ($alias !== $prefix) {
|
||||
continue;
|
||||
@@ -220,13 +231,15 @@ class StaticReflectionParser implements ReflectionProviderInterface
|
||||
$fullySpecified = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $fullySpecified) {
|
||||
$this->parentClassName = '\\' . $this->namespace . '\\' . $this->parentClassName;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
$last_token = is_array($token) ? $token[0] : false;
|
||||
$lastToken = is_array($token) ? $token[0] : false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -325,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');
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace Doctrine\Common\Reflection;
|
||||
|
||||
use ReflectionProperty;
|
||||
use ReturnTypeWillChange;
|
||||
|
||||
/**
|
||||
* PHP Typed No Default Reflection Property - special override for typed properties without a default value.
|
||||
@@ -16,6 +17,7 @@ class TypedNoDefaultReflectionProperty extends ReflectionProperty
|
||||
* 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;
|
||||
@@ -29,6 +31,7 @@ class TypedNoDefaultReflectionProperty extends ReflectionProperty
|
||||
*
|
||||
* @link https://github.com/doctrine/orm/issues/7999
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function setValue($object, $value = null)
|
||||
{
|
||||
if ($value === null && $this->hasType() && ! $this->getType()->allowsNull()) {
|
||||
|
||||
@@ -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,14 +1,9 @@
|
||||
parameters:
|
||||
level: 3
|
||||
paths:
|
||||
- %rootDir%/../../../lib
|
||||
- %rootDir%/../../../tests
|
||||
- lib
|
||||
- tests
|
||||
phpVersion: 80106
|
||||
|
||||
ignoreErrors:
|
||||
- '#Doctrine\\Common\\Reflection\\StaticReflection[a-zA-Z0-9_]+::__construct\(\) does not call parent constructor from Reflection[a-zA-Z0-9_]+#'
|
||||
|
||||
excludes_analyse:
|
||||
- lib/Doctrine/Common/Reflection/Compatibility/ReflectionClass.php
|
||||
- lib/Doctrine/Common/Reflection/Compatibility/ReflectionMethod.php
|
||||
includes:
|
||||
- vendor/phpstan/phpstan-phpunit/extension.neon
|
||||
|
||||
@@ -4,43 +4,45 @@ namespace Doctrine\Tests\Common\Reflection;
|
||||
|
||||
use Doctrine\Common\Reflection\Psr0FindFile;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use const DIRECTORY_SEPARATOR;
|
||||
|
||||
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%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%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%sNoParent.php', __DIR__, DIRECTORY_SEPARATOR), $file);
|
||||
}
|
||||
|
||||
protected function setUp() : void
|
||||
protected function setUp(): void
|
||||
{
|
||||
$testsRoot = substr(__DIR__, 0, -strlen(__NAMESPACE__) - 1);
|
||||
|
||||
|
||||
@@ -2,15 +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();
|
||||
|
||||
@@ -23,7 +25,7 @@ class RuntimePublicReflectionPropertyTest extends TestCase
|
||||
self::assertNull($reflProperty->getValue($object));
|
||||
}
|
||||
|
||||
public function testSetValue() : void
|
||||
public function testSetValue(): void
|
||||
{
|
||||
$object = new RuntimePublicReflectionPropertyTestClass();
|
||||
|
||||
@@ -36,7 +38,7 @@ 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');
|
||||
@@ -57,7 +59,7 @@ 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');
|
||||
@@ -130,6 +132,7 @@ class RuntimePublicReflectionPropertyTestProxyMock implements Proxy
|
||||
*/
|
||||
public function __getLazyProperties()
|
||||
{
|
||||
throw new BadMethodCallException('Not implemented.');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -210,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,7 +54,7 @@ class StaticReflectionClassTest extends TestCase
|
||||
self::assertSame(['ClassName'], $this->staticReflectionClass->getUseStatements());
|
||||
}
|
||||
|
||||
public function testGetMethod() : void
|
||||
public function testGetMethod(): void
|
||||
{
|
||||
$staticReflectionMethod = $this->createPartialMock(StaticReflectionMethod::class, []);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -83,7 +83,7 @@ class StaticReflectionClassTest extends TestCase
|
||||
*
|
||||
* @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,12 +20,12 @@ 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->createPartialMock(StaticReflectionClass::class, []);
|
||||
|
||||
@@ -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,7 +45,7 @@ class StaticReflectionMethodTest extends TestCase
|
||||
self::assertSame('test', $this->staticReflectionMethod->getNamespaceName());
|
||||
}
|
||||
|
||||
public function testGetDocComment() : void
|
||||
public function testGetDocComment(): void
|
||||
{
|
||||
$staticReflectionClass = $this->createPartialMock(StaticReflectionClass::class, []);
|
||||
|
||||
@@ -57,7 +57,7 @@ class StaticReflectionMethodTest extends TestCase
|
||||
self::assertSame('test doc comment', $this->staticReflectionMethod->getDocComment());
|
||||
}
|
||||
|
||||
public function testGetUseStatements() : void
|
||||
public function testGetUseStatements(): void
|
||||
{
|
||||
$staticReflectionClass = $this->createPartialMock(StaticReflectionClass::class, []);
|
||||
|
||||
@@ -73,7 +73,7 @@ class StaticReflectionMethodTest extends TestCase
|
||||
*
|
||||
* @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,6 +7,7 @@ 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;
|
||||
|
||||
|
||||
@@ -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,12 +20,12 @@ 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->createPartialMock(StaticReflectionClass::class, []);
|
||||
|
||||
@@ -36,7 +36,7 @@ class StaticReflectionPropertyTest extends TestCase
|
||||
self::assertSame($staticReflectionClass, $this->staticReflectionProperty->getDeclaringClass());
|
||||
}
|
||||
|
||||
public function testGetDocComment() : void
|
||||
public function testGetDocComment(): void
|
||||
{
|
||||
$staticReflectionClass = $this->createPartialMock(StaticReflectionClass::class, []);
|
||||
|
||||
@@ -48,7 +48,7 @@ class StaticReflectionPropertyTest extends TestCase
|
||||
self::assertSame('test doc comment', $this->staticReflectionProperty->getDocComment());
|
||||
}
|
||||
|
||||
public function testGetUseStatements() : void
|
||||
public function testGetUseStatements(): void
|
||||
{
|
||||
$staticReflectionClass = $this->createPartialMock(StaticReflectionClass::class, []);
|
||||
|
||||
@@ -64,7 +64,7 @@ class StaticReflectionPropertyTest extends TestCase
|
||||
*
|
||||
* @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,6 +9,9 @@ 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
|
||||
|
||||
@@ -6,12 +6,13 @@ 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
|
||||
public function testGetValue(): void
|
||||
{
|
||||
$testsRoot = substr(__DIR__, 0, -strlen(__NAMESPACE__) - 1);
|
||||
$paths = [
|
||||
|
||||
@@ -7,7 +7,7 @@ use PHPUnit\Framework\TestCase;
|
||||
|
||||
class TypedNoDefaultReflectionPropertyTest extends TestCase
|
||||
{
|
||||
public function testGetValue() : void
|
||||
public function testGetValue(): void
|
||||
{
|
||||
$object = new TypedNoDefaultReflectionPropertyTestClass();
|
||||
|
||||
@@ -24,7 +24,7 @@ class TypedNoDefaultReflectionPropertyTest extends TestCase
|
||||
self::assertNull($reflProperty->getValue($object));
|
||||
}
|
||||
|
||||
public function testSetValueNull() : void
|
||||
public function testSetValueNull(): void
|
||||
{
|
||||
$reflection = new TypedNoDefaultReflectionProperty(TypedFoo::class, 'id');
|
||||
$reflection->setAccessible(true);
|
||||
@@ -40,7 +40,7 @@ class TypedNoDefaultReflectionPropertyTest extends TestCase
|
||||
self::assertFalse($reflection->isInitialized($object));
|
||||
}
|
||||
|
||||
public function testSetValueNullOnNullableProperty() : void
|
||||
public function testSetValueNullOnNullableProperty(): void
|
||||
{
|
||||
$reflection = new TypedNoDefaultReflectionProperty(TypedNullableFoo::class, 'value');
|
||||
$reflection->setAccessible(true);
|
||||
|
||||
Reference in New Issue
Block a user