laravel-6 support

This commit is contained in:
RafficMohammed
2023-01-08 01:17:22 +05:30
parent 1a5c16ae4b
commit 774eed8b0e
4962 changed files with 279380 additions and 297961 deletions

View File

@@ -1 +1,12 @@
/.github export-ignore
/.phive export-ignore
/.php_cs.dist export-ignore
/.psalm export-ignore
/bin export-ignore
/build.xml export-ignore
/phpunit.xml export-ignore
/tests export-ignore
/tools export-ignore
/tools/* binary
*.php diff=php

View File

@@ -1 +0,0 @@
patreon: s_bergmann

View File

@@ -1,3 +1,7 @@
/.idea
/.php_cs
/.php_cs.cache
/.phpunit.result.cache
/.psalm/cache
/composer.lock
/vendor

View File

@@ -1,26 +0,0 @@
language: php
php:
- 7.1
- 7.2
- 7.3
- 7.4snapshot
sudo: false
before_install:
- composer self-update
- composer clear-cache
install:
- travis_retry composer update --no-interaction --no-ansi --no-progress --no-suggest
script:
- ./vendor/bin/phpunit --coverage-clover=coverage.xml
after_success:
- bash <(curl -s https://codecov.io/bash)
notifications:
email: false

View File

@@ -2,23 +2,41 @@
All notable changes to `sebastianbergmann/php-token-stream` are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
## [3.1.3] - 2021-07-26
## [4.0.4] - 2020-08-04
### Changed
### Added
* The declarations of methods in `PHP_Token_Stream` that implement the `ArrayAccess`, `Countable`, and `SeekableIterator` interfaces are now compatible with PHP 8.1
* Support for `NAME_FULLY_QUALIFIED`, `NAME_QUALIFIED`, and `NAME_RELATIVE` tokens
## [3.1.2] - 2020-11-30
## [4.0.3] - 2020-06-27
### Changed
### Added
* Changed PHP version constraint in `composer.json` from `^7.1` to `>=7.1` to allow installation of this version of this library on PHP 8. However, this version of this library does not work on PHP 8. PHPUnit 8.5, which uses this version of this library (through phpunit/php-code-coverage), does not call into this library and instead shows a message that code coverage functionality is not available for PHPUnit 8.5 on PHP 8.
* This component is now supported on PHP 8
## [4.0.2] - 2020-06-16
### Fixed
* Fixed backward compatibility breaks introduced in version 4.0.1
## [4.0.1] - 2020-05-06
### Fixed
* [#93](https://github.com/sebastianbergmann/php-token-stream/issues/93): Class with method that uses anonymous class is not processed correctly
## [4.0.0] - 2020-02-07
### Removed
* This component is no longer supported PHP 7.1 and PHP 7.2
## [3.1.1] - 2019-09-17
### Fixed
* Fixed [#84](https://github.com/sebastianbergmann/php-token-stream/issues/84): Methods named `class` are not handled correctly
* [#84](https://github.com/sebastianbergmann/php-token-stream/issues/84): Methods named `class` are not handled correctly
## [3.1.0] - 2019-07-25
@@ -30,37 +48,40 @@ All notable changes to `sebastianbergmann/php-token-stream` are documented in th
### Changed
* Implemented [#82](https://github.com/sebastianbergmann/php-token-stream/issues/82): Make sure this component works when its classes are prefixed using php-scoper
* [#82](https://github.com/sebastianbergmann/php-token-stream/issues/82): Make sure this component works when its classes are prefixed using php-scoper
## [3.0.1] - 2018-10-30
### Fixed
* Fixed [#78](https://github.com/sebastianbergmann/php-token-stream/pull/78): `getEndTokenId()` does not handle string-dollar (`"${var}"`) interpolation
* [#78](https://github.com/sebastianbergmann/php-token-stream/pull/78): `getEndTokenId()` does not handle string-dollar (`"${var}"`) interpolation
## [3.0.0] - 2018-02-01
### Removed
* Implemented [#71](https://github.com/sebastianbergmann/php-token-stream/issues/71): Remove code specific to Hack language constructs
* Implemented [#72](https://github.com/sebastianbergmann/php-token-stream/issues/72): Drop support for PHP 7.0
* [#71](https://github.com/sebastianbergmann/php-token-stream/issues/71): Remove code specific to Hack language constructs
* [#72](https://github.com/sebastianbergmann/php-token-stream/issues/72): Drop support for PHP 7.0
## [2.0.2] - 2017-11-27
### Fixed
* Fixed [#69](https://github.com/sebastianbergmann/php-token-stream/issues/69): `PHP_Token_USE_FUNCTION` does not serialize correctly
* [#69](https://github.com/sebastianbergmann/php-token-stream/issues/69): `PHP_Token_USE_FUNCTION` does not serialize correctly
## [2.0.1] - 2017-08-20
### Fixed
* Fixed [#68](https://github.com/sebastianbergmann/php-token-stream/issues/68): Method with name `empty` wrongly recognized as anonymous function
* [#68](https://github.com/sebastianbergmann/php-token-stream/issues/68): Method with name `empty` wrongly recognized as anonymous function
## [2.0.0] - 2017-08-03
[3.1.3]: https://github.com/sebastianbergmann/php-token-stream/compare/3.1.2...3.1.3
[3.1.2]: https://github.com/sebastianbergmann/php-token-stream/compare/3.1.1...3.1.2
[4.0.4]: https://github.com/sebastianbergmann/php-token-stream/compare/4.0.3...4.0.4
[4.0.3]: https://github.com/sebastianbergmann/php-token-stream/compare/4.0.2...4.0.3
[4.0.2]: https://github.com/sebastianbergmann/php-token-stream/compare/4.0.1...4.0.2
[4.0.1]: https://github.com/sebastianbergmann/php-token-stream/compare/4.0.0...4.0.1
[4.0.0]: https://github.com/sebastianbergmann/php-token-stream/compare/3.1.1...4.0.0
[3.1.1]: https://github.com/sebastianbergmann/php-token-stream/compare/3.1.0...3.1.1
[3.1.0]: https://github.com/sebastianbergmann/php-token-stream/compare/3.0.2...3.1.0
[3.0.2]: https://github.com/sebastianbergmann/php-token-stream/compare/3.0.1...3.0.2

View File

@@ -1,6 +1,6 @@
php-token-stream
Copyright (c) 2009-2019, Sebastian Bergmann <sebastian@phpunit.de>.
Copyright (c) 2009-2020, Sebastian Bergmann <sebastian@phpunit.de>.
All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@@ -1,14 +1,18 @@
[![Build Status](https://travis-ci.org/sebastianbergmann/php-token-stream.svg?branch=master)](https://travis-ci.org/sebastianbergmann/php-token-stream)
# phpunit/php-token-stream
# php-token-stream
[![CI Status](https://github.com/sebastianbergmann/php-token-stream/workflows/CI/badge.svg)](https://github.com/sebastianbergmann/php-token-stream/actions)
[![Type Coverage](https://shepherd.dev/github/sebastianbergmann/php-token-stream/coverage.svg)](https://shepherd.dev/github/sebastianbergmann/php-token-stream)
## Installation
You can add this library as a local, per-project dependency to your project using [Composer](https://getcomposer.org/):
composer require phpunit/php-token-stream
```
composer require phpunit/php-token-stream
```
If you only need this library during development, for instance to run your project's test suite, then you should add it as a development-time dependency:
composer require --dev phpunit/php-token-stream
```
composer require --dev phpunit/php-token-stream
```

View File

@@ -1,21 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="php-token-stream" default="setup">
<target name="setup" depends="clean,composer"/>
<target name="clean" description="Cleanup build artifacts">
<delete dir="${basedir}/vendor"/>
<delete file="${basedir}/composer.lock"/>
</target>
<target name="composer" depends="clean" description="Install dependencies with Composer">
<exec executable="composer" taskname="composer">
<env key="COMPOSER_DISABLE_XDEBUG_WARN" value="1"/>
<arg value="update"/>
<arg value="--no-interaction"/>
<arg value="--no-progress"/>
<arg value="--no-ansi"/>
<arg value="--no-suggest"/>
</exec>
</target>
</project>

View File

@@ -16,13 +16,16 @@
},
"prefer-stable": true,
"require": {
"php": ">=7.1",
"php": "^7.3 || ^8.0",
"ext-tokenizer": "*"
},
"require-dev": {
"phpunit/phpunit": "^7.0"
"phpunit/phpunit": "^9.0"
},
"config": {
"platform": {
"php": "7.3.0"
},
"optimize-autoloader": true,
"sort-packages": true
},
@@ -33,7 +36,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "3.1-dev"
"dev-master": "4.0-dev"
}
}
}

View File

@@ -1,21 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/7.4/phpunit.xsd"
bootstrap="tests/bootstrap.php"
forceCoversAnnotation="false"
beStrictAboutCoversAnnotation="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
verbose="true">
<testsuites>
<testsuite name="default">
<directory suffix="Test.php">tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src</directory>
</whitelist>
</filter>
</phpunit>

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_ABSTRACT extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_AMPERSAND extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_AND_EQUAL extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_ARRAY extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_ARRAY_CAST extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_AS extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_AT extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_BACKTICK extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_BAD_CHARACTER extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_BOOL_CAST extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_BOOLEAN_AND extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_BOOLEAN_OR extends PHP_Token
{
}

View File

@@ -1,16 +1,12 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of php-token-stream.
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* A caching factory for token stream objects.
*/
class PHP_Token_Stream_CachingFactory
{
/**
@@ -35,9 +31,9 @@ class PHP_Token_Stream_CachingFactory
/**
* @param string $filename
*/
public static function clear($filename = null)
public static function clear($filename = null)/*: void*/
{
if (is_string($filename)) {
if (\is_string($filename)) {
unset(self::$cache[$filename]);
} else {
self::$cache = [];

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_CALLABLE extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_CARET extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_CASE extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_CATCH extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_CHARACTER extends PHP_Token
{
}

View File

@@ -0,0 +1,62 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_CLASS extends PHP_Token_INTERFACE
{
/**
* @var bool
*/
private $anonymous = false;
/**
* @var string
*/
private $name;
/**
* @return string
*/
public function getName()
{
if ($this->name !== null) {
return $this->name;
}
$next = $this->tokenStream[$this->id + 1];
if ($next instanceof PHP_Token_WHITESPACE) {
$next = $this->tokenStream[$this->id + 2];
}
if ($next instanceof PHP_Token_STRING) {
$this->name =(string) $next;
return $this->name;
}
if ($next instanceof PHP_Token_OPEN_CURLY ||
$next instanceof PHP_Token_EXTENDS ||
$next instanceof PHP_Token_IMPLEMENTS) {
$this->name = \sprintf(
'AnonymousClass:%s#%s',
$this->getLine(),
$this->getId()
);
$this->anonymous = true;
return $this->name;
}
}
public function isAnonymous()
{
return $this->anonymous;
}
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_CLASS_C extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_CLASS_NAME_CONSTANT extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_CLONE extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_CLOSE_BRACKET extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_CLOSE_CURLY extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_CLOSE_SQUARE extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_CLOSE_TAG extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_COALESCE extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_COALESCE_EQUAL extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_COLON extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_COMMA extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_COMMENT extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_CONCAT_EQUAL extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_CONST extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_CONSTANT_ENCAPSED_STRING extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_CONTINUE extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_CURLY_OPEN extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_DNUMBER extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_DEC extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_DECLARE extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_DEFAULT extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_DIR extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_DIV extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_DIV_EQUAL extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_DO extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_DOC_COMMENT extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_DOLLAR extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_DOLLAR_OPEN_CURLY_BRACES extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_DOT extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_DOUBLE_ARROW extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_DOUBLE_CAST extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_DOUBLE_COLON extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_DOUBLE_QUOTES extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_ECHO extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_ELLIPSIS extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_ELSE extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_ELSEIF extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_EMPTY extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_ENCAPSED_AND_WHITESPACE extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_END_HEREDOC extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_ENDDECLARE extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_ENDFOR extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_ENDFOREACH extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_ENDIF extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_ENDSWITCH extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_ENDWHILE extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_EQUAL extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_EVAL extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_EXCLAMATION_MARK extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_EXIT extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_EXTENDS extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_FILE extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_FINAL extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_FINALLY extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_FN extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_FOR extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_FOREACH extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_FUNC_C extends PHP_Token
{
}

View File

@@ -0,0 +1,196 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_FUNCTION extends PHP_TokenWithScopeAndVisibility
{
/**
* @var array
*/
protected $arguments;
/**
* @var int
*/
protected $ccn;
/**
* @var string
*/
protected $name;
/**
* @var string
*/
protected $signature;
/**
* @var bool
*/
private $anonymous = false;
/**
* @return array
*/
public function getArguments()
{
if ($this->arguments !== null) {
return $this->arguments;
}
$this->arguments = [];
$tokens = $this->tokenStream->tokens();
$typeDeclaration = null;
// Search for first token inside brackets
$i = $this->id + 2;
while (!$tokens[$i - 1] instanceof PHP_Token_OPEN_BRACKET) {
$i++;
}
while (!$tokens[$i] instanceof PHP_Token_CLOSE_BRACKET) {
if ($tokens[$i] instanceof PHP_Token_STRING) {
$typeDeclaration = (string) $tokens[$i];
} elseif ($tokens[$i] instanceof PHP_Token_VARIABLE) {
$this->arguments[(string) $tokens[$i]] = $typeDeclaration;
$typeDeclaration = null;
}
$i++;
}
return $this->arguments;
}
/**
* @return string
*/
public function getName()
{
if ($this->name !== null) {
return $this->name;
}
$tokens = $this->tokenStream->tokens();
$i = $this->id + 1;
if ($tokens[$i] instanceof PHP_Token_WHITESPACE) {
$i++;
}
if ($tokens[$i] instanceof PHP_Token_AMPERSAND) {
$i++;
}
if ($tokens[$i + 1] instanceof PHP_Token_OPEN_BRACKET) {
$this->name = (string) $tokens[$i];
} elseif ($tokens[$i + 1] instanceof PHP_Token_WHITESPACE && $tokens[$i + 2] instanceof PHP_Token_OPEN_BRACKET) {
$this->name = (string) $tokens[$i];
} else {
$this->anonymous = true;
$this->name = \sprintf(
'anonymousFunction:%s#%s',
$this->getLine(),
$this->getId()
);
}
if (!$this->isAnonymous()) {
for ($i = $this->id; $i; --$i) {
if ($tokens[$i] instanceof PHP_Token_NAMESPACE) {
$this->name = $tokens[$i]->getName() . '\\' . $this->name;
break;
}
if ($tokens[$i] instanceof PHP_Token_INTERFACE) {
break;
}
}
}
return $this->name;
}
/**
* @return int
*/
public function getCCN()
{
if ($this->ccn !== null) {
return $this->ccn;
}
$this->ccn = 1;
$end = $this->getEndTokenId();
$tokens = $this->tokenStream->tokens();
for ($i = $this->id; $i <= $end; $i++) {
switch (\get_class($tokens[$i])) {
case PHP_Token_IF::class:
case PHP_Token_ELSEIF::class:
case PHP_Token_FOR::class:
case PHP_Token_FOREACH::class:
case PHP_Token_WHILE::class:
case PHP_Token_CASE::class:
case PHP_Token_CATCH::class:
case PHP_Token_BOOLEAN_AND::class:
case PHP_Token_LOGICAL_AND::class:
case PHP_Token_BOOLEAN_OR::class:
case PHP_Token_LOGICAL_OR::class:
case PHP_Token_QUESTION_MARK::class:
$this->ccn++;
break;
}
}
return $this->ccn;
}
/**
* @return string
*/
public function getSignature()
{
if ($this->signature !== null) {
return $this->signature;
}
if ($this->isAnonymous()) {
$this->signature = 'anonymousFunction';
$i = $this->id + 1;
} else {
$this->signature = '';
$i = $this->id + 2;
}
$tokens = $this->tokenStream->tokens();
while (isset($tokens[$i]) &&
!$tokens[$i] instanceof PHP_Token_OPEN_CURLY &&
!$tokens[$i] instanceof PHP_Token_SEMICOLON) {
$this->signature .= $tokens[$i++];
}
$this->signature = \trim($this->signature);
return $this->signature;
}
/**
* @return bool
*/
public function isAnonymous()
{
return $this->anonymous;
}
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_GLOBAL extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_GOTO extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_GT extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_HALT_COMPILER extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_IF extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_IMPLEMENTS extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_INC extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_INCLUDE extends PHP_Token_Includes
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_INCLUDE_ONCE extends PHP_Token_Includes
{
}

View File

@@ -0,0 +1,57 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
abstract class PHP_Token_Includes extends PHP_Token
{
/**
* @var string
*/
protected $name;
/**
* @var string
*/
protected $type;
/**
* @return string
*/
public function getName()
{
if ($this->name === null) {
$this->process();
}
return $this->name;
}
/**
* @return string
*/
public function getType()
{
if ($this->type === null) {
$this->process();
}
return $this->type;
}
private function process(): void
{
$tokens = $this->tokenStream->tokens();
if ($tokens[$this->id + 2] instanceof PHP_Token_CONSTANT_ENCAPSED_STRING) {
$this->name = \trim((string) $tokens[$this->id + 2], "'\"");
$this->type = \strtolower(
\str_replace('PHP_Token_', '', PHP_Token_Util::getClass($tokens[$this->id]))
);
}
}
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_INLINE_HTML extends PHP_Token
{
}

View File

@@ -0,0 +1,12 @@
<?php declare(strict_types=1);
/*
* This file is part of phpunit/php-token-stream.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class PHP_Token_INSTANCEOF extends PHP_Token
{
}

Some files were not shown because too many files have changed in this diff Show More