diff -Nru php-token-stream-3.1.1/bin/dump php-token-stream-4.0.4/bin/dump
--- php-token-stream-3.1.1/bin/dump 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/bin/dump 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,50 @@
+#!/usr/bin/env php
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+require __DIR__ . '/../vendor/autoload.php';
+
+if (!isset($argv[1]) || !file_exists($argv[1])) {
+ exit;
+}
+
+$tokens = new PHP_Token_Stream(file_get_contents($argv[1]));
+$tokensLength = strlen((string) count($tokens));
+$linesLength = max(strlen('Line'), strlen((string) $tokens->getLinesOfCode()['loc']));
+
+$header = sprintf(
+ '%-' . $tokensLength . 's %-' . $linesLength . 's %-40s %s',
+ '#',
+ 'Line',
+ 'Token',
+ 'Text'
+);
+
+print $header . PHP_EOL;
+print str_repeat('-', strlen($header)) . PHP_EOL;
+
+foreach ($tokens as $token) {
+ printf(
+ '%-' . $tokensLength . 'd %-' . $linesLength . 'd %-40s %s' . PHP_EOL,
+ $token->getId(),
+ $token->getLine(),
+ str_replace('PHP_Token_', '', get_class($token)),
+ str_replace(
+ [
+ "\r",
+ "\n"
+ ],
+ [
+ '\r',
+ '\n'
+ ],
+ (string) $token
+ )
+ );
+}
diff -Nru php-token-stream-3.1.1/bin/dump-native php-token-stream-4.0.4/bin/dump-native
--- php-token-stream-3.1.1/bin/dump-native 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/bin/dump-native 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,60 @@
+#!/usr/bin/env php
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+if (!isset($argv[1]) || !file_exists($argv[1])) {
+ exit;
+}
+
+$tokens = token_get_all(file_get_contents($argv[1]));
+$tokensLength = strlen((string) count($tokens));
+$linesLength = max(strlen('Line'), substr_count("\n", file_get_contents($argv[1])));
+
+$header = sprintf(
+ '%-' . $tokensLength . 's %-' . $linesLength . 's %-40s %s',
+ '#',
+ 'Line',
+ 'Token',
+ 'Text'
+);
+
+print $header . PHP_EOL;
+print str_repeat('-', strlen($header)) . PHP_EOL;
+
+$i = 0;
+
+foreach ($tokens as $token) {
+ if (is_array($token)) {
+ $name = token_name($token[0]);
+ $text = $token[1];
+ $line = $token[2];
+ } else {
+ $name = '';
+ $text = $token;
+ $line = '';
+ }
+
+ printf(
+ '%-' . $tokensLength . 'd %-' . $linesLength . 's %-40s %s' . PHP_EOL,
+ $i++,
+ $line,
+ str_replace('T_', '', $name),
+ str_replace(
+ [
+ "\r",
+ "\n"
+ ],
+ [
+ '\r',
+ '\n'
+ ],
+ $text
+ )
+ );
+}
diff -Nru php-token-stream-3.1.1/build.xml php-token-stream-4.0.4/build.xml
--- php-token-stream-3.1.1/build.xml 2019-09-17 06:23:10.000000000 +0000
+++ php-token-stream-4.0.4/build.xml 2020-08-17 16:46:03.000000000 +0000
@@ -1,20 +1,30 @@
-
+
-
-
-
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
diff -Nru php-token-stream-3.1.1/ChangeLog.md php-token-stream-4.0.4/ChangeLog.md
--- php-token-stream-3.1.1/ChangeLog.md 2019-09-17 06:23:10.000000000 +0000
+++ php-token-stream-4.0.4/ChangeLog.md 2020-08-17 16:46:03.000000000 +0000
@@ -2,11 +2,41 @@
All notable changes to `sebastianbergmann/php-token-stream` are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
+## [4.0.4] - 2020-08-04
+
+### Added
+
+* Support for `NAME_FULLY_QUALIFIED`, `NAME_QUALIFIED`, and `NAME_RELATIVE` tokens
+
+## [4.0.3] - 2020-06-27
+
+### Added
+
+* 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
@@ -18,35 +48,40 @@
### 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
+[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
diff -Nru php-token-stream-3.1.1/composer.json php-token-stream-4.0.4/composer.json
--- php-token-stream-3.1.1/composer.json 2019-09-17 06:23:10.000000000 +0000
+++ php-token-stream-4.0.4/composer.json 2020-08-17 16:46:03.000000000 +0000
@@ -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"
}
}
}
diff -Nru php-token-stream-3.1.1/debian/changelog php-token-stream-4.0.4/debian/changelog
--- php-token-stream-3.1.1/debian/changelog 2019-09-20 06:27:20.000000000 +0000
+++ php-token-stream-4.0.4/debian/changelog 2020-12-02 15:59:49.000000000 +0000
@@ -1,3 +1,61 @@
+php-token-stream (4.0.4-1) unstable; urgency=medium
+
+ * Upload to unstable now that PHPUnit 8 allows it
+
+ [ Sebastian Bergmann ]
+ * Update tools
+ * Support NAME_FULLY_QUALIFIED, NAME_QUALIFIED, and NAME_RELATIVE tokens
+
+ [ David Prévot ]
+ * Rename main branch to debian/latest (DEP-14)
+ * Update watch file format version to 4.
+ * Set Rules-Requires-Root: no.
+ * Update Standards-Version to 4.5.1
+ * Update packaging to new layout
+
+ -- David Prévot Wed, 02 Dec 2020 11:59:49 -0400
+
+php-token-stream (4.0.3-1) experimental; urgency=medium
+
+ [ Sebastian Bergmann ]
+ * Support PHP 8 for https://github.com/sebastianbergmann/phpunit/issues/4325
+ * Prepare release
+
+ -- David Prévot Sun, 28 Jun 2020 15:03:56 -1000
+
+php-token-stream (4.0.1-1) experimental; urgency=medium
+
+ [ Sebastian Bergmann ]
+ * Prepare release
+
+ [ David Prévot ]
+ * Document gbp import-ref usage
+ * Use debhelper-compat 13
+ * Simplify override_dh_auto_test
+
+ -- David Prévot Sun, 31 May 2020 10:43:22 -1000
+
+php-token-stream (4.0.0-1) experimental; urgency=medium
+
+ * Upload version compatible with PHPUnit 9 to experimental
+
+ [ Sebastian Bergmann ]
+ * Bump copyright year
+ * Drop support for PHP 7.1 and PHP 7.2
+ * Prepare release
+
+ [ David Prévot ]
+ * Compatibility with recent PHPUnit (8)
+ * debian/copyright: Update copyright (years)
+ * debian/upstream/metadata:
+ + Set fields: Bug-Database, Bug-Submit, Repository, Repository-Browse
+ + Remove obsolete fields: Contact, Name
+ * debian/control:
+ + Drop versioned dependency satisfied in (old)stable
+ + Update standards version to 4.5.0
+
+ -- David Prévot Fri, 07 Feb 2020 18:59:47 -1000
+
php-token-stream (3.1.1-1) unstable; urgency=medium
* New upstream version
diff -Nru php-token-stream-3.1.1/debian/clean php-token-stream-4.0.4/debian/clean
--- php-token-stream-3.1.1/debian/clean 2019-09-20 06:24:25.000000000 +0000
+++ php-token-stream-4.0.4/debian/clean 2020-12-02 15:59:49.000000000 +0000
@@ -1,3 +1,3 @@
.phpunit.result.cache
-PHP
-src/Token/Stream/Autoload.php
+PHP/
+src/Autoload.php
diff -Nru php-token-stream-3.1.1/debian/control php-token-stream-4.0.4/debian/control
--- php-token-stream-3.1.1/debian/control 2019-09-20 06:27:12.000000000 +0000
+++ php-token-stream-4.0.4/debian/control 2020-12-02 15:44:27.000000000 +0000
@@ -4,15 +4,12 @@
Maintainer: Debian PHP PEAR Maintainers
Uploaders: Prach Pongpanich ,
David Prévot
-Build-Depends: ant,
- debhelper-compat (= 12),
- phpab,
- phpunit,
- pkg-php-tools (>= 1.7~)
-Standards-Version: 4.4.0
+Build-Depends: ant, debhelper-compat (= 13), phpab, phpunit, pkg-php-tools
+Standards-Version: 4.5.1
Homepage: https://github.com/sebastianbergmann/php-token-stream
-Vcs-Git: https://salsa.debian.org/php-team/pear/php-token-stream.git
+Vcs-Git: https://salsa.debian.org/php-team/pear/php-token-stream.git -b debian/latest
Vcs-Browser: https://salsa.debian.org/php-team/pear/php-token-stream
+Rules-Requires-Root: no
Package: php-token-stream
Architecture: all
diff -Nru php-token-stream-3.1.1/debian/copyright php-token-stream-4.0.4/debian/copyright
--- php-token-stream-3.1.1/debian/copyright 2019-09-20 06:27:12.000000000 +0000
+++ php-token-stream-4.0.4/debian/copyright 2020-12-02 15:41:02.000000000 +0000
@@ -4,7 +4,7 @@
Source: https://github.com/sebastianbergmann/php-token-stream/
Files: *
-Copyright: (c) 2009-2019, Sebastian Bergmann
+Copyright: (c) 2009-2020, Sebastian Bergmann
License: BSD-3-clause
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
diff -Nru php-token-stream-3.1.1/debian/gbp.conf php-token-stream-4.0.4/debian/gbp.conf
--- php-token-stream-3.1.1/debian/gbp.conf 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/debian/gbp.conf 2020-12-02 15:40:47.000000000 +0000
@@ -0,0 +1,9 @@
+[DEFAULT]
+debian-branch = debian/latest
+pristine-tar = True
+pristine-tar-commit = True
+
+## Once --filter support gets added to gbp import-ref, we should be able
+## to simplify the workflow and ignore the upstream branch.
+# filter = [ '.gitattributes' ]
+# upstream-tag = %(version%~%-)s
diff -Nru php-token-stream-3.1.1/debian/install php-token-stream-4.0.4/debian/install
--- php-token-stream-3.1.1/debian/install 2018-11-03 05:49:31.000000000 +0000
+++ php-token-stream-4.0.4/debian/install 2020-12-02 15:59:49.000000000 +0000
@@ -1 +1 @@
-src/* usr/share/php/PHP
+src/* usr/share/php/PHP/Token/Stream
diff -Nru php-token-stream-3.1.1/debian/patches/0002-Adapt-autoload-path.patch php-token-stream-4.0.4/debian/patches/0002-Adapt-autoload-path.patch
--- php-token-stream-3.1.1/debian/patches/0002-Adapt-autoload-path.patch 2019-09-20 06:25:18.000000000 +0000
+++ php-token-stream-4.0.4/debian/patches/0002-Adapt-autoload-path.patch 2020-12-02 15:40:50.000000000 +0000
@@ -8,7 +8,7 @@
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/bootstrap.php b/tests/bootstrap.php
-index bcd0f64..d7a0d45 100644
+index 00ef9c9..643ce4a 100644
--- a/tests/bootstrap.php
+++ b/tests/bootstrap.php
@@ -7,7 +7,7 @@
@@ -18,5 +18,5 @@
-require __DIR__ . '/../vendor/autoload.php';
+require 'PHP/Token/Stream/Autoload.php';
- define(
+ \define(
'TEST_FILES_PATH',
diff -Nru php-token-stream-3.1.1/debian/patches/0002-Compatibility-with-recent-PHPUnit-8.patch php-token-stream-4.0.4/debian/patches/0002-Compatibility-with-recent-PHPUnit-8.patch
--- php-token-stream-3.1.1/debian/patches/0002-Compatibility-with-recent-PHPUnit-8.patch 2019-09-20 06:25:18.000000000 +0000
+++ php-token-stream-4.0.4/debian/patches/0002-Compatibility-with-recent-PHPUnit-8.patch 1970-01-01 00:00:00.000000000 +0000
@@ -1,77 +0,0 @@
-From: =?utf-8?q?David_Pr=C3=A9vot?=
-Date: Sat, 14 Sep 2019 01:18:53 -1000
-Subject: Compatibility with recent PHPUnit (8)
-
----
- tests/Token/ClassTest.php | 2 +-
- tests/Token/ClosureTest.php | 2 +-
- tests/Token/FunctionTest.php | 2 +-
- tests/Token/IncludeTest.php | 2 +-
- tests/Token/InterfaceTest.php | 2 +-
- 5 files changed, 5 insertions(+), 5 deletions(-)
-
-diff --git a/tests/Token/ClassTest.php b/tests/Token/ClassTest.php
-index 05eca32..a12efa1 100644
---- a/tests/Token/ClassTest.php
-+++ b/tests/Token/ClassTest.php
-@@ -22,7 +22,7 @@ class PHP_Token_ClassTest extends TestCase
- */
- private $function;
-
-- protected function setUp()
-+ protected function setUp(): void
- {
- foreach (new PHP_Token_Stream(TEST_FILES_PATH . 'source2.php') as $token) {
- if ($token instanceof PHP_Token_CLASS) {
-diff --git a/tests/Token/ClosureTest.php b/tests/Token/ClosureTest.php
-index 4e893d8..9654f00 100644
---- a/tests/Token/ClosureTest.php
-+++ b/tests/Token/ClosureTest.php
-@@ -17,7 +17,7 @@ class PHP_Token_ClosureTest extends TestCase
- */
- private $functions;
-
-- protected function setUp()
-+ protected function setUp(): void
- {
- foreach (new PHP_Token_Stream(TEST_FILES_PATH . 'closure.php') as $token) {
- if ($token instanceof PHP_Token_FUNCTION) {
-diff --git a/tests/Token/FunctionTest.php b/tests/Token/FunctionTest.php
-index c88454b..81976d4 100644
---- a/tests/Token/FunctionTest.php
-+++ b/tests/Token/FunctionTest.php
-@@ -17,7 +17,7 @@ class PHP_Token_FunctionTest extends TestCase
- */
- private $functions;
-
-- protected function setUp()
-+ protected function setUp(): void
- {
- foreach (new PHP_Token_Stream(TEST_FILES_PATH . 'source.php') as $token) {
- if ($token instanceof PHP_Token_FUNCTION) {
-diff --git a/tests/Token/IncludeTest.php b/tests/Token/IncludeTest.php
-index 7f83a73..97c7604 100644
---- a/tests/Token/IncludeTest.php
-+++ b/tests/Token/IncludeTest.php
-@@ -17,7 +17,7 @@ class PHP_Token_IncludeTest extends TestCase
- */
- private $ts;
-
-- protected function setUp()
-+ protected function setUp(): void
- {
- $this->ts = new PHP_Token_Stream(TEST_FILES_PATH . 'source3.php');
- }
-diff --git a/tests/Token/InterfaceTest.php b/tests/Token/InterfaceTest.php
-index c61ec38..51200a4 100644
---- a/tests/Token/InterfaceTest.php
-+++ b/tests/Token/InterfaceTest.php
-@@ -22,7 +22,7 @@ class PHP_Token_InterfaceTest extends TestCase
- */
- private $interfaces;
-
-- protected function setUp()
-+ protected function setUp(): void
- {
- $ts = new PHP_Token_Stream(TEST_FILES_PATH . 'source4.php');
- $i = 0;
diff -Nru php-token-stream-3.1.1/debian/patches/series php-token-stream-4.0.4/debian/patches/series
--- php-token-stream-3.1.1/debian/patches/series 2019-09-20 06:25:18.000000000 +0000
+++ php-token-stream-4.0.4/debian/patches/series 2020-12-02 15:40:50.000000000 +0000
@@ -1,2 +1 @@
0002-Adapt-autoload-path.patch
-0002-Compatibility-with-recent-PHPUnit-8.patch
diff -Nru php-token-stream-3.1.1/debian/README.source php-token-stream-4.0.4/debian/README.source
--- php-token-stream-3.1.1/debian/README.source 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/debian/README.source 2020-12-02 15:40:36.000000000 +0000
@@ -0,0 +1,8 @@
+Starting with 4.0.1, we are merging the signed upstream tags as
+upstream, instead of using the tarball that doesn’t ship tests.
+
+# Example to import upstream 4.0.2 version
+version=4.0.2
+# We still use the upstream branch to drop the .gitattributes file from upstream
+gbp import-ref --upstream-tag=%\(version%~%-\)s -u$version --debian-branch=upstream
+gbp import-ref --upstream-tree=BRANCH -u$version
diff -Nru php-token-stream-3.1.1/debian/rules php-token-stream-4.0.4/debian/rules
--- php-token-stream-3.1.1/debian/rules 2019-09-20 06:27:12.000000000 +0000
+++ php-token-stream-4.0.4/debian/rules 2020-12-02 15:59:49.000000000 +0000
@@ -3,12 +3,9 @@
dh $@ --with phpcomposer
override_dh_auto_build:
- phpab -o src/Token/Stream/Autoload.php -b src/Token/Stream src
+ phpab -o src/Autoload.php src
+ mkdir -p PHP/Token
+ ln -s ../../src PHP/Token/Stream
override_dh_auto_test:
-ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
- ln -s src PHP
phpunit
-else
- @echo "** tests disabled"
-endif
diff -Nru php-token-stream-3.1.1/debian/upstream/metadata php-token-stream-4.0.4/debian/upstream/metadata
--- php-token-stream-3.1.1/debian/upstream/metadata 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/debian/upstream/metadata 2020-12-02 15:40:36.000000000 +0000
@@ -0,0 +1,4 @@
+Bug-Database: https://github.com/sebastianbergmann/php-token-stream/issues
+Bug-Submit: https://github.com/sebastianbergmann/php-token-stream/issues/new
+Repository: https://github.com/sebastianbergmann/php-token-stream.git
+Repository-Browse: https://github.com/sebastianbergmann/php-token-stream
diff -Nru php-token-stream-3.1.1/debian/watch php-token-stream-4.0.4/debian/watch
--- php-token-stream-3.1.1/debian/watch 2018-11-03 05:49:31.000000000 +0000
+++ php-token-stream-4.0.4/debian/watch 2020-12-02 15:43:51.000000000 +0000
@@ -1,4 +1,4 @@
-version=3
+version=4
options=uversionmangle=s/-?([^\d\.])/~$1/i;tr/A-Z/a-z/ \
https://github.com/sebastianbergmann/php-token-stream/releases \
.*/archive/v?([\d\.]+-?\w*)\.tar\.gz
diff -Nru php-token-stream-3.1.1/.gitattributes php-token-stream-4.0.4/.gitattributes
--- php-token-stream-3.1.1/.gitattributes 2019-09-17 06:23:10.000000000 +0000
+++ php-token-stream-4.0.4/.gitattributes 1970-01-01 00:00:00.000000000 +0000
@@ -1 +0,0 @@
-*.php diff=php
diff -Nru php-token-stream-3.1.1/.github/FUNDING.yml php-token-stream-4.0.4/.github/FUNDING.yml
--- php-token-stream-3.1.1/.github/FUNDING.yml 2019-09-17 06:23:10.000000000 +0000
+++ php-token-stream-4.0.4/.github/FUNDING.yml 2020-08-17 16:46:03.000000000 +0000
@@ -1 +1 @@
-patreon: s_bergmann
+github: sebastianbergmann
diff -Nru php-token-stream-3.1.1/.github/workflows/ci.yml php-token-stream-4.0.4/.github/workflows/ci.yml
--- php-token-stream-3.1.1/.github/workflows/ci.yml 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/.github/workflows/ci.yml 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,114 @@
+# https://help.github.com/en/categories/automating-your-workflow-with-github-actions
+
+on:
+ - "pull_request"
+ - "push"
+
+name: "CI"
+
+jobs:
+ coding-guidelines:
+ name: "Coding Guidelines"
+
+ runs-on: "ubuntu-latest"
+
+ steps:
+ - name: "Checkout"
+ uses: "actions/checkout@v2"
+
+ - name: "Run friendsofphp/php-cs-fixer"
+ run: "php7.3 ./tools/php-cs-fixer fix --diff-format=udiff --dry-run --show-progress=dots --using-cache=no --verbose"
+
+ type-checker:
+ name: "Type Checker"
+
+ runs-on: "ubuntu-latest"
+
+ steps:
+ - name: "Checkout"
+ uses: "actions/checkout@v2"
+
+ - name: "Set COMPOSER_ROOT_VERSION environment variable"
+ uses: "docker://ergebnis/composer-root-version-action:0.1.3"
+
+ - name: "Update dependencies with composer"
+ run: "php7.3 ./tools/composer update --no-ansi --no-interaction --no-progress"
+
+ - name: "Run vimeo/psalm"
+ run: "php7.3 ./tools/psalm --config=.psalm/config.xml --no-progress --shepherd --show-info=false --stats"
+
+ backward-compatibility:
+ name: Backward Compatibility
+
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+ with:
+ fetch-depth: 0
+
+ - name: Fetch tags
+ run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
+
+ - name: Install PHP with extensions
+ uses: shivammathur/setup-php@v2
+ with:
+ php-version: 7.4
+ coverage: none
+ extensions: intl
+
+ - name: Run roave/backward-compatibility-check
+ run: ./tools/roave-backward-compatibility-check --from=4.0.2
+
+ tests:
+ name: "Tests"
+
+ runs-on: "ubuntu-latest"
+
+ strategy:
+ matrix:
+ php-version:
+ - "7.3"
+ - "7.4"
+ - "8.0"
+
+ dependencies:
+ - "lowest"
+ - "highest"
+
+ steps:
+ - name: "Checkout"
+ uses: "actions/checkout@v2"
+
+ - name: "Install PHP with extensions"
+ uses: "shivammathur/setup-php@v1"
+ with:
+ php-version: "${{ matrix.php-version }}"
+ coverage: "pcov"
+
+ - name: "Cache dependencies installed with composer"
+ uses: "actions/cache@v1"
+ with:
+ path: "~/.composer/cache"
+ key: "php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.json') }}"
+ restore-keys: "php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-"
+
+ - name: "Set COMPOSER_ROOT_VERSION environment variable"
+ uses: "docker://ergebnis/composer-root-version-action:0.1.3"
+
+ - name: "Install lowest dependencies with composer"
+ if: "matrix.dependencies == 'lowest'"
+ run: "./tools/composer update --no-ansi --no-interaction --no-progress --prefer-lowest"
+
+ - name: "Install highest dependencies with composer"
+ if: "matrix.dependencies == 'highest'"
+ run: "./tools/composer update --no-ansi --no-interaction --no-progress"
+
+ - name: "Run tests with phpunit/phpunit"
+ run: "vendor/bin/phpunit --coverage-clover=coverage.xml"
+
+ - name: "Send code coverage report to Codecov.io"
+ env:
+ CODECOV_TOKEN: "${{ secrets.CODECOV_TOKEN }}"
+ run: "bash <(curl -s https://codecov.io/bash) || true"
diff -Nru php-token-stream-3.1.1/.gitignore php-token-stream-4.0.4/.gitignore
--- php-token-stream-3.1.1/.gitignore 2019-09-17 06:23:10.000000000 +0000
+++ php-token-stream-4.0.4/.gitignore 2020-08-17 16:46:03.000000000 +0000
@@ -1,3 +1,7 @@
/.idea
+/.php_cs
+/.php_cs.cache
+/.phpunit.result.cache
+/.psalm/cache
/composer.lock
/vendor
diff -Nru php-token-stream-3.1.1/LICENSE php-token-stream-4.0.4/LICENSE
--- php-token-stream-3.1.1/LICENSE 2019-09-17 06:23:10.000000000 +0000
+++ php-token-stream-4.0.4/LICENSE 2020-08-17 16:46:03.000000000 +0000
@@ -1,6 +1,6 @@
php-token-stream
-Copyright (c) 2009-2019, Sebastian Bergmann .
+Copyright (c) 2009-2020, Sebastian Bergmann .
All rights reserved.
Redistribution and use in source and binary forms, with or without
diff -Nru php-token-stream-3.1.1/.phive/phars.xml php-token-stream-4.0.4/.phive/phars.xml
--- php-token-stream-3.1.1/.phive/phars.xml 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/.phive/phars.xml 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff -Nru php-token-stream-3.1.1/.php_cs.dist php-token-stream-4.0.4/.php_cs.dist
--- php-token-stream-3.1.1/.php_cs.dist 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/.php_cs.dist 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,212 @@
+
+
+For the full copyright and license information, please view the LICENSE
+file that was distributed with this source code.
+EOF;
+
+$finder = PhpCsFixer\Finder::create()
+ ->exclude('tests/_fixture')
+ ->in(__DIR__);
+
+return PhpCsFixer\Config::create()
+ ->setFinder($finder)
+ ->setRiskyAllowed(true)
+ ->setRules([
+ 'align_multiline_comment' => true,
+ 'array_indentation' => true,
+ 'array_syntax' => ['syntax' => 'short'],
+ 'binary_operator_spaces' => [
+ 'operators' => [
+ '=' => 'align',
+ '=>' => 'align',
+ ],
+ ],
+ 'blank_line_after_namespace' => true,
+ 'blank_line_before_statement' => [
+ 'statements' => [
+ 'break',
+ 'continue',
+ 'declare',
+ 'do',
+ 'for',
+ 'foreach',
+ 'if',
+ 'include',
+ 'include_once',
+ 'require',
+ 'require_once',
+ 'return',
+ 'switch',
+ 'throw',
+ 'try',
+ 'while',
+ 'yield',
+ ],
+ ],
+ 'braces' => true,
+ 'cast_spaces' => true,
+ 'class_attributes_separation' => ['elements' => ['const', 'method', 'property']],
+ 'combine_consecutive_issets' => true,
+ 'combine_consecutive_unsets' => true,
+ 'compact_nullable_typehint' => true,
+ 'concat_space' => ['spacing' => 'one'],
+ 'declare_equal_normalize' => ['space' => 'none'],
+ 'declare_strict_types' => true,
+ 'dir_constant' => true,
+ 'elseif' => true,
+ 'encoding' => true,
+ 'full_opening_tag' => true,
+ 'function_declaration' => true,
+ 'global_namespace_import' => [
+ 'import_classes' => true,
+ 'import_constants' => true,
+ 'import_functions' => true,
+ ],
+ 'header_comment' => ['header' => $header, 'separate' => 'none'],
+ 'indentation_type' => true,
+ 'is_null' => true,
+ 'line_ending' => true,
+ 'list_syntax' => ['syntax' => 'short'],
+ 'logical_operators' => true,
+ 'lowercase_cast' => true,
+ 'lowercase_constants' => true,
+ 'lowercase_keywords' => true,
+ 'lowercase_static_reference' => true,
+ 'magic_constant_casing' => true,
+ 'method_argument_space' => ['ensure_fully_multiline' => true],
+ 'modernize_types_casting' => true,
+ 'multiline_comment_opening_closing' => true,
+ 'multiline_whitespace_before_semicolons' => true,
+ 'native_constant_invocation' => false,
+ 'native_function_casing' => false,
+ 'native_function_invocation' => false,
+ 'new_with_braces' => false,
+ 'no_alias_functions' => true,
+ 'no_alternative_syntax' => true,
+ 'no_blank_lines_after_class_opening' => true,
+ 'no_blank_lines_after_phpdoc' => true,
+ 'no_blank_lines_before_namespace' => true,
+ 'no_closing_tag' => true,
+ 'no_empty_comment' => true,
+ 'no_empty_phpdoc' => true,
+ 'no_empty_statement' => true,
+ 'no_extra_blank_lines' => true,
+ 'no_homoglyph_names' => true,
+ 'no_leading_import_slash' => true,
+ 'no_leading_namespace_whitespace' => true,
+ 'no_mixed_echo_print' => ['use' => 'print'],
+ 'no_multiline_whitespace_around_double_arrow' => true,
+ 'no_null_property_initialization' => true,
+ 'no_php4_constructor' => true,
+ 'no_short_bool_cast' => true,
+ 'no_short_echo_tag' => true,
+ 'no_singleline_whitespace_before_semicolons' => true,
+ 'no_spaces_after_function_name' => true,
+ 'no_spaces_inside_parenthesis' => true,
+ 'no_superfluous_elseif' => true,
+ 'no_superfluous_phpdoc_tags' => [
+ 'allow_mixed' => true,
+ ],
+ 'no_trailing_comma_in_list_call' => true,
+ 'no_trailing_comma_in_singleline_array' => true,
+ 'no_trailing_whitespace' => true,
+ 'no_trailing_whitespace_in_comment' => true,
+ 'no_unneeded_control_parentheses' => true,
+ 'no_unneeded_curly_braces' => true,
+ 'no_unneeded_final_method' => true,
+ 'no_unreachable_default_argument_value' => true,
+ 'no_unset_on_property' => true,
+ 'no_unused_imports' => true,
+ 'no_useless_else' => true,
+ 'no_useless_return' => true,
+ 'no_whitespace_before_comma_in_array' => true,
+ 'no_whitespace_in_blank_line' => true,
+ 'non_printable_character' => true,
+ 'normalize_index_brace' => true,
+ 'object_operator_without_whitespace' => true,
+ 'ordered_class_elements' => [
+ 'order' => [
+ 'use_trait',
+ 'constant_public',
+ 'constant_protected',
+ 'constant_private',
+ 'property_public_static',
+ 'property_protected_static',
+ 'property_private_static',
+ 'property_public',
+ 'property_protected',
+ 'property_private',
+ 'method_public_static',
+ 'construct',
+ 'destruct',
+ 'magic',
+ 'phpunit',
+ 'method_public',
+ 'method_protected',
+ 'method_private',
+ 'method_protected_static',
+ 'method_private_static',
+ ],
+ ],
+ 'ordered_imports' => [
+ 'imports_order' => [
+ PhpCsFixer\Fixer\Import\OrderedImportsFixer::IMPORT_TYPE_CONST,
+ PhpCsFixer\Fixer\Import\OrderedImportsFixer::IMPORT_TYPE_FUNCTION,
+ PhpCsFixer\Fixer\Import\OrderedImportsFixer::IMPORT_TYPE_CLASS,
+ ]
+ ],
+ 'ordered_interfaces' => [
+ 'direction' => 'ascend',
+ 'order' => 'alpha',
+ ],
+ 'phpdoc_add_missing_param_annotation' => false,
+ 'phpdoc_align' => true,
+ 'phpdoc_annotation_without_dot' => true,
+ 'phpdoc_indent' => true,
+ 'phpdoc_no_access' => true,
+ 'phpdoc_no_empty_return' => true,
+ 'phpdoc_no_package' => true,
+ 'phpdoc_order' => true,
+ 'phpdoc_return_self_reference' => true,
+ 'phpdoc_scalar' => true,
+ 'phpdoc_separation' => true,
+ 'phpdoc_single_line_var_spacing' => true,
+ 'phpdoc_summary' => true,
+ 'phpdoc_to_comment' => true,
+ 'phpdoc_trim' => true,
+ 'phpdoc_trim_consecutive_blank_line_separation' => true,
+ 'phpdoc_types' => ['groups' => ['simple', 'meta']],
+ 'phpdoc_types_order' => true,
+ 'phpdoc_var_without_name' => true,
+ 'pow_to_exponentiation' => true,
+ 'protected_to_private' => true,
+ 'return_assignment' => true,
+ 'return_type_declaration' => ['space_before' => 'none'],
+ 'self_accessor' => true,
+ 'semicolon_after_instruction' => true,
+ 'set_type_to_cast' => true,
+ 'short_scalar_cast' => true,
+ 'simplified_null_return' => false,
+ 'single_blank_line_at_eof' => true,
+ 'single_import_per_statement' => true,
+ 'single_line_after_imports' => true,
+ 'single_quote' => true,
+ 'standardize_not_equals' => true,
+ 'ternary_to_null_coalescing' => true,
+ 'trailing_comma_in_multiline_array' => true,
+ 'trim_array_spaces' => true,
+ 'unary_operator_spaces' => true,
+ 'visibility_required' => [
+ 'elements' => [
+ 'const',
+ 'method',
+ 'property',
+ ],
+ ],
+ 'void_return' => false,
+ 'whitespace_after_comma_in_array' => true,
+ ]);
diff -Nru php-token-stream-3.1.1/phpunit.xml php-token-stream-4.0.4/phpunit.xml
--- php-token-stream-3.1.1/phpunit.xml 2019-09-17 06:23:10.000000000 +0000
+++ php-token-stream-4.0.4/phpunit.xml 2020-08-17 16:46:03.000000000 +0000
@@ -1,7 +1,8 @@
+
+
+
+ string
+
+
+
+
+ array|bool
+
+
+ $this->interfaces
+
+
+ false
+
+
+
+
+ string
+
+
+
diff -Nru php-token-stream-3.1.1/.psalm/config.xml php-token-stream-4.0.4/.psalm/config.xml
--- php-token-stream-3.1.1/.psalm/config.xml 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/.psalm/config.xml 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff -Nru php-token-stream-3.1.1/README.md php-token-stream-4.0.4/README.md
--- php-token-stream-3.1.1/README.md 2019-09-17 06:23:10.000000000 +0000
+++ php-token-stream-4.0.4/README.md 2020-08-17 16:46:03.000000000 +0000
@@ -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
+```
diff -Nru php-token-stream-3.1.1/src/Abstract.php php-token-stream-4.0.4/src/Abstract.php
--- php-token-stream-3.1.1/src/Abstract.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Abstract.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/Ampersand.php php-token-stream-4.0.4/src/Ampersand.php
--- php-token-stream-3.1.1/src/Ampersand.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Ampersand.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/AndEqual.php php-token-stream-4.0.4/src/AndEqual.php
--- php-token-stream-3.1.1/src/AndEqual.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/AndEqual.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/ArrayCast.php php-token-stream-4.0.4/src/ArrayCast.php
--- php-token-stream-3.1.1/src/ArrayCast.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/ArrayCast.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/Array.php php-token-stream-4.0.4/src/Array.php
--- php-token-stream-3.1.1/src/Array.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Array.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/As.php php-token-stream-4.0.4/src/As.php
--- php-token-stream-3.1.1/src/As.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/As.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/At.php php-token-stream-4.0.4/src/At.php
--- php-token-stream-3.1.1/src/At.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/At.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/Backtick.php php-token-stream-4.0.4/src/Backtick.php
--- php-token-stream-3.1.1/src/Backtick.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Backtick.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/BadCharacter.php php-token-stream-4.0.4/src/BadCharacter.php
--- php-token-stream-3.1.1/src/BadCharacter.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/BadCharacter.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/BoolCast.php php-token-stream-4.0.4/src/BoolCast.php
--- php-token-stream-3.1.1/src/BoolCast.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/BoolCast.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/BooleanAnd.php php-token-stream-4.0.4/src/BooleanAnd.php
--- php-token-stream-3.1.1/src/BooleanAnd.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/BooleanAnd.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/BooleanOr.php php-token-stream-4.0.4/src/BooleanOr.php
--- php-token-stream-3.1.1/src/BooleanOr.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/BooleanOr.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/break.php php-token-stream-4.0.4/src/break.php
--- php-token-stream-3.1.1/src/break.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/break.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_BREAK extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/CachingFactory.php php-token-stream-4.0.4/src/CachingFactory.php
--- php-token-stream-3.1.1/src/CachingFactory.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/CachingFactory.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,42 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_Stream_CachingFactory
+{
+ /**
+ * @var array
+ */
+ protected static $cache = [];
+
+ /**
+ * @param string $filename
+ *
+ * @return PHP_Token_Stream
+ */
+ public static function get($filename)
+ {
+ if (!isset(self::$cache[$filename])) {
+ self::$cache[$filename] = new PHP_Token_Stream($filename);
+ }
+
+ return self::$cache[$filename];
+ }
+
+ /**
+ * @param string $filename
+ */
+ public static function clear($filename = null)/*: void*/
+ {
+ if (\is_string($filename)) {
+ unset(self::$cache[$filename]);
+ } else {
+ self::$cache = [];
+ }
+ }
+}
diff -Nru php-token-stream-3.1.1/src/Callable.php php-token-stream-4.0.4/src/Callable.php
--- php-token-stream-3.1.1/src/Callable.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Callable.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/Caret.php php-token-stream-4.0.4/src/Caret.php
--- php-token-stream-3.1.1/src/Caret.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Caret.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/Case.php php-token-stream-4.0.4/src/Case.php
--- php-token-stream-3.1.1/src/Case.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Case.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/Catch.php php-token-stream-4.0.4/src/Catch.php
--- php-token-stream-3.1.1/src/Catch.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Catch.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/Character.php php-token-stream-4.0.4/src/Character.php
--- php-token-stream-3.1.1/src/Character.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Character.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/ClassC.php php-token-stream-4.0.4/src/ClassC.php
--- php-token-stream-3.1.1/src/ClassC.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/ClassC.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/ClassNameConstant.php php-token-stream-4.0.4/src/ClassNameConstant.php
--- php-token-stream-3.1.1/src/ClassNameConstant.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/ClassNameConstant.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/Class.php php-token-stream-4.0.4/src/Class.php
--- php-token-stream-3.1.1/src/Class.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Class.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,62 @@
+
+ *
+ * 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;
+ }
+}
diff -Nru php-token-stream-3.1.1/src/Clone.php php-token-stream-4.0.4/src/Clone.php
--- php-token-stream-3.1.1/src/Clone.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Clone.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/CloseBracket.php php-token-stream-4.0.4/src/CloseBracket.php
--- php-token-stream-3.1.1/src/CloseBracket.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/CloseBracket.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/CloseCurly.php php-token-stream-4.0.4/src/CloseCurly.php
--- php-token-stream-3.1.1/src/CloseCurly.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/CloseCurly.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/CloseSquare.php php-token-stream-4.0.4/src/CloseSquare.php
--- php-token-stream-3.1.1/src/CloseSquare.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/CloseSquare.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/CloseTag.php php-token-stream-4.0.4/src/CloseTag.php
--- php-token-stream-3.1.1/src/CloseTag.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/CloseTag.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/CoalesceEqual.php php-token-stream-4.0.4/src/CoalesceEqual.php
--- php-token-stream-3.1.1/src/CoalesceEqual.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/CoalesceEqual.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/Coalesce.php php-token-stream-4.0.4/src/Coalesce.php
--- php-token-stream-3.1.1/src/Coalesce.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Coalesce.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/Colon.php php-token-stream-4.0.4/src/Colon.php
--- php-token-stream-3.1.1/src/Colon.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Colon.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/Comma.php php-token-stream-4.0.4/src/Comma.php
--- php-token-stream-3.1.1/src/Comma.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Comma.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/Comment.php php-token-stream-4.0.4/src/Comment.php
--- php-token-stream-3.1.1/src/Comment.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Comment.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/ConcatEqual.php php-token-stream-4.0.4/src/ConcatEqual.php
--- php-token-stream-3.1.1/src/ConcatEqual.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/ConcatEqual.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/ConstantEncapsedString.php php-token-stream-4.0.4/src/ConstantEncapsedString.php
--- php-token-stream-3.1.1/src/ConstantEncapsedString.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/ConstantEncapsedString.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/Const.php php-token-stream-4.0.4/src/Const.php
--- php-token-stream-3.1.1/src/Const.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Const.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/Continue.php php-token-stream-4.0.4/src/Continue.php
--- php-token-stream-3.1.1/src/Continue.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Continue.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/CurlyOpen.php php-token-stream-4.0.4/src/CurlyOpen.php
--- php-token-stream-3.1.1/src/CurlyOpen.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/CurlyOpen.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/Declare.php php-token-stream-4.0.4/src/Declare.php
--- php-token-stream-3.1.1/src/Declare.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Declare.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/Dec.php php-token-stream-4.0.4/src/Dec.php
--- php-token-stream-3.1.1/src/Dec.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Dec.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/Default.php php-token-stream-4.0.4/src/Default.php
--- php-token-stream-3.1.1/src/Default.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Default.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/Dir.php php-token-stream-4.0.4/src/Dir.php
--- php-token-stream-3.1.1/src/Dir.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Dir.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/DivEqual.php php-token-stream-4.0.4/src/DivEqual.php
--- php-token-stream-3.1.1/src/DivEqual.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/DivEqual.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/Div.php php-token-stream-4.0.4/src/Div.php
--- php-token-stream-3.1.1/src/Div.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Div.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/DNumber.php php-token-stream-4.0.4/src/DNumber.php
--- php-token-stream-3.1.1/src/DNumber.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/DNumber.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/DocComment.php php-token-stream-4.0.4/src/DocComment.php
--- php-token-stream-3.1.1/src/DocComment.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/DocComment.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/DollarOpenCurlyBraces.php php-token-stream-4.0.4/src/DollarOpenCurlyBraces.php
--- php-token-stream-3.1.1/src/DollarOpenCurlyBraces.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/DollarOpenCurlyBraces.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/Dollar.php php-token-stream-4.0.4/src/Dollar.php
--- php-token-stream-3.1.1/src/Dollar.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Dollar.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/Do.php php-token-stream-4.0.4/src/Do.php
--- php-token-stream-3.1.1/src/Do.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Do.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/Dot.php php-token-stream-4.0.4/src/Dot.php
--- php-token-stream-3.1.1/src/Dot.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Dot.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/DoubleArrow.php php-token-stream-4.0.4/src/DoubleArrow.php
--- php-token-stream-3.1.1/src/DoubleArrow.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/DoubleArrow.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/DoubleCast.php php-token-stream-4.0.4/src/DoubleCast.php
--- php-token-stream-3.1.1/src/DoubleCast.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/DoubleCast.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/DoubleColon.php php-token-stream-4.0.4/src/DoubleColon.php
--- php-token-stream-3.1.1/src/DoubleColon.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/DoubleColon.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/DoubleQuotes.php php-token-stream-4.0.4/src/DoubleQuotes.php
--- php-token-stream-3.1.1/src/DoubleQuotes.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/DoubleQuotes.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/Echo.php php-token-stream-4.0.4/src/Echo.php
--- php-token-stream-3.1.1/src/Echo.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Echo.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/Ellipsis.php php-token-stream-4.0.4/src/Ellipsis.php
--- php-token-stream-3.1.1/src/Ellipsis.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Ellipsis.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/Elseif.php php-token-stream-4.0.4/src/Elseif.php
--- php-token-stream-3.1.1/src/Elseif.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Elseif.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/Else.php php-token-stream-4.0.4/src/Else.php
--- php-token-stream-3.1.1/src/Else.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Else.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/Empty.php php-token-stream-4.0.4/src/Empty.php
--- php-token-stream-3.1.1/src/Empty.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Empty.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/EncapsedAndWhitespace.php php-token-stream-4.0.4/src/EncapsedAndWhitespace.php
--- php-token-stream-3.1.1/src/EncapsedAndWhitespace.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/EncapsedAndWhitespace.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/Enddeclare.php php-token-stream-4.0.4/src/Enddeclare.php
--- php-token-stream-3.1.1/src/Enddeclare.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Enddeclare.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/Endforeach.php php-token-stream-4.0.4/src/Endforeach.php
--- php-token-stream-3.1.1/src/Endforeach.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Endforeach.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/Endfor.php php-token-stream-4.0.4/src/Endfor.php
--- php-token-stream-3.1.1/src/Endfor.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Endfor.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/EndHeredoc.php php-token-stream-4.0.4/src/EndHeredoc.php
--- php-token-stream-3.1.1/src/EndHeredoc.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/EndHeredoc.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/Endif.php php-token-stream-4.0.4/src/Endif.php
--- php-token-stream-3.1.1/src/Endif.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Endif.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/Endswitch.php php-token-stream-4.0.4/src/Endswitch.php
--- php-token-stream-3.1.1/src/Endswitch.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Endswitch.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/Endwhile.php php-token-stream-4.0.4/src/Endwhile.php
--- php-token-stream-3.1.1/src/Endwhile.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Endwhile.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/Equal.php php-token-stream-4.0.4/src/Equal.php
--- php-token-stream-3.1.1/src/Equal.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Equal.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/Eval.php php-token-stream-4.0.4/src/Eval.php
--- php-token-stream-3.1.1/src/Eval.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Eval.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/ExclamationMark.php php-token-stream-4.0.4/src/ExclamationMark.php
--- php-token-stream-3.1.1/src/ExclamationMark.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/ExclamationMark.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/Exit.php php-token-stream-4.0.4/src/Exit.php
--- php-token-stream-3.1.1/src/Exit.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Exit.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/Extends.php php-token-stream-4.0.4/src/Extends.php
--- php-token-stream-3.1.1/src/Extends.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Extends.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/File.php php-token-stream-4.0.4/src/File.php
--- php-token-stream-3.1.1/src/File.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/File.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/Finally.php php-token-stream-4.0.4/src/Finally.php
--- php-token-stream-3.1.1/src/Finally.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Finally.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/Final.php php-token-stream-4.0.4/src/Final.php
--- php-token-stream-3.1.1/src/Final.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Final.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/Fn.php php-token-stream-4.0.4/src/Fn.php
--- php-token-stream-3.1.1/src/Fn.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Fn.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/Foreach.php php-token-stream-4.0.4/src/Foreach.php
--- php-token-stream-3.1.1/src/Foreach.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Foreach.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/For.php php-token-stream-4.0.4/src/For.php
--- php-token-stream-3.1.1/src/For.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/For.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/FuncC.php php-token-stream-4.0.4/src/FuncC.php
--- php-token-stream-3.1.1/src/FuncC.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/FuncC.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/Function.php php-token-stream-4.0.4/src/Function.php
--- php-token-stream-3.1.1/src/Function.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Function.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,196 @@
+
+ *
+ * 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;
+ }
+}
diff -Nru php-token-stream-3.1.1/src/Global.php php-token-stream-4.0.4/src/Global.php
--- php-token-stream-3.1.1/src/Global.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Global.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/Goto.php php-token-stream-4.0.4/src/Goto.php
--- php-token-stream-3.1.1/src/Goto.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Goto.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/Gt.php php-token-stream-4.0.4/src/Gt.php
--- php-token-stream-3.1.1/src/Gt.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Gt.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/HaltCompiler.php php-token-stream-4.0.4/src/HaltCompiler.php
--- php-token-stream-3.1.1/src/HaltCompiler.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/HaltCompiler.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/If.php php-token-stream-4.0.4/src/If.php
--- php-token-stream-3.1.1/src/If.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/If.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/Implements.php php-token-stream-4.0.4/src/Implements.php
--- php-token-stream-3.1.1/src/Implements.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Implements.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/IncludeOnce.php php-token-stream-4.0.4/src/IncludeOnce.php
--- php-token-stream-3.1.1/src/IncludeOnce.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/IncludeOnce.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/Include.php php-token-stream-4.0.4/src/Include.php
--- php-token-stream-3.1.1/src/Include.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Include.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/Includes.php php-token-stream-4.0.4/src/Includes.php
--- php-token-stream-3.1.1/src/Includes.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Includes.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,57 @@
+
+ *
+ * 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]))
+ );
+ }
+ }
+}
diff -Nru php-token-stream-3.1.1/src/Inc.php php-token-stream-4.0.4/src/Inc.php
--- php-token-stream-3.1.1/src/Inc.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Inc.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/InlineHtml.php php-token-stream-4.0.4/src/InlineHtml.php
--- php-token-stream-3.1.1/src/InlineHtml.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/InlineHtml.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/Instanceof.php php-token-stream-4.0.4/src/Instanceof.php
--- php-token-stream-3.1.1/src/Instanceof.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Instanceof.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * 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
+{
+}
diff -Nru php-token-stream-3.1.1/src/Insteadof.php php-token-stream-4.0.4/src/Insteadof.php
--- php-token-stream-3.1.1/src/Insteadof.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Insteadof.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_INSTEADOF extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/IntCast.php php-token-stream-4.0.4/src/IntCast.php
--- php-token-stream-3.1.1/src/IntCast.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/IntCast.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_INT_CAST extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/Interface.php php-token-stream-4.0.4/src/Interface.php
--- php-token-stream-3.1.1/src/Interface.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Interface.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,166 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_INTERFACE extends PHP_TokenWithScopeAndVisibility
+{
+ /**
+ * @var array
+ */
+ protected $interfaces;
+
+ /**
+ * @return string
+ */
+ public function getName()
+ {
+ return (string) $this->tokenStream[$this->id + 2];
+ }
+
+ /**
+ * @return bool
+ */
+ public function hasParent()
+ {
+ return $this->tokenStream[$this->id + 4] instanceof PHP_Token_EXTENDS;
+ }
+
+ /**
+ * @return array
+ */
+ public function getPackage()
+ {
+ $result = [
+ 'namespace' => '',
+ 'fullPackage' => '',
+ 'category' => '',
+ 'package' => '',
+ 'subpackage' => '',
+ ];
+
+ $docComment = $this->getDocblock();
+ $className = $this->getName();
+
+ for ($i = $this->id; $i; --$i) {
+ if ($this->tokenStream[$i] instanceof PHP_Token_NAMESPACE) {
+ $result['namespace'] = $this->tokenStream[$i]->getName();
+
+ break;
+ }
+ }
+
+ if ($docComment === null) {
+ return $result;
+ }
+
+ if (\preg_match('/@category[\s]+([\.\w]+)/', $docComment, $matches)) {
+ $result['category'] = $matches[1];
+ }
+
+ if (\preg_match('/@package[\s]+([\.\w]+)/', $docComment, $matches)) {
+ $result['package'] = $matches[1];
+ $result['fullPackage'] = $matches[1];
+ }
+
+ if (\preg_match('/@subpackage[\s]+([\.\w]+)/', $docComment, $matches)) {
+ $result['subpackage'] = $matches[1];
+ $result['fullPackage'] .= '.' . $matches[1];
+ }
+
+ if (empty($result['fullPackage'])) {
+ $result['fullPackage'] = $this->arrayToName(
+ \explode('_', \str_replace('\\', '_', $className)),
+ '.'
+ );
+ }
+
+ return $result;
+ }
+
+ /**
+ * @return bool|string
+ */
+ public function getParent()
+ {
+ if (!$this->hasParent()) {
+ return false;
+ }
+
+ $i = $this->id + 6;
+ $tokens = $this->tokenStream->tokens();
+ $className = (string) $tokens[$i];
+
+ while (isset($tokens[$i + 1]) &&
+ !$tokens[$i + 1] instanceof PHP_Token_WHITESPACE) {
+ $className .= (string) $tokens[++$i];
+ }
+
+ return $className;
+ }
+
+ /**
+ * @return bool
+ */
+ public function hasInterfaces()
+ {
+ return (isset($this->tokenStream[$this->id + 4]) &&
+ $this->tokenStream[$this->id + 4] instanceof PHP_Token_IMPLEMENTS) ||
+ (isset($this->tokenStream[$this->id + 8]) &&
+ $this->tokenStream[$this->id + 8] instanceof PHP_Token_IMPLEMENTS);
+ }
+
+ /**
+ * @return array|bool
+ */
+ public function getInterfaces()
+ {
+ if ($this->interfaces !== null) {
+ return $this->interfaces;
+ }
+
+ if (!$this->hasInterfaces()) {
+ return $this->interfaces = false;
+ }
+
+ if ($this->tokenStream[$this->id + 4] instanceof PHP_Token_IMPLEMENTS) {
+ $i = $this->id + 3;
+ } else {
+ $i = $this->id + 7;
+ }
+
+ $tokens = $this->tokenStream->tokens();
+
+ while (!$tokens[$i + 1] instanceof PHP_Token_OPEN_CURLY) {
+ $i++;
+
+ if ($tokens[$i] instanceof PHP_Token_STRING) {
+ $this->interfaces[] = (string) $tokens[$i];
+ }
+ }
+
+ return $this->interfaces;
+ }
+
+ /**
+ * @param string $join
+ *
+ * @return string
+ */
+ protected function arrayToName(array $parts, $join = '\\')
+ {
+ $result = '';
+
+ if (\count($parts) > 1) {
+ \array_pop($parts);
+
+ $result = \implode($join, $parts);
+ }
+
+ return $result;
+ }
+}
diff -Nru php-token-stream-3.1.1/src/IsEqual.php php-token-stream-4.0.4/src/IsEqual.php
--- php-token-stream-3.1.1/src/IsEqual.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/IsEqual.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_IS_EQUAL extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/IsGreaterOrEqual.php php-token-stream-4.0.4/src/IsGreaterOrEqual.php
--- php-token-stream-3.1.1/src/IsGreaterOrEqual.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/IsGreaterOrEqual.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_IS_GREATER_OR_EQUAL extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/IsIdentical.php php-token-stream-4.0.4/src/IsIdentical.php
--- php-token-stream-3.1.1/src/IsIdentical.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/IsIdentical.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_IS_IDENTICAL extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/IsNotEqual.php php-token-stream-4.0.4/src/IsNotEqual.php
--- php-token-stream-3.1.1/src/IsNotEqual.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/IsNotEqual.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_IS_NOT_EQUAL extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/IsNotIdentical.php php-token-stream-4.0.4/src/IsNotIdentical.php
--- php-token-stream-3.1.1/src/IsNotIdentical.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/IsNotIdentical.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_IS_NOT_IDENTICAL extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/Isset.php php-token-stream-4.0.4/src/Isset.php
--- php-token-stream-3.1.1/src/Isset.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Isset.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_ISSET extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/IsSmallerOrEqual.php php-token-stream-4.0.4/src/IsSmallerOrEqual.php
--- php-token-stream-3.1.1/src/IsSmallerOrEqual.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/IsSmallerOrEqual.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_IS_SMALLER_OR_EQUAL extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/Line.php php-token-stream-4.0.4/src/Line.php
--- php-token-stream-3.1.1/src/Line.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Line.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_LINE extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/List.php php-token-stream-4.0.4/src/List.php
--- php-token-stream-3.1.1/src/List.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/List.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_LIST extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/Lnumber.php php-token-stream-4.0.4/src/Lnumber.php
--- php-token-stream-3.1.1/src/Lnumber.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Lnumber.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_LNUMBER extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/LogicalAnd.php php-token-stream-4.0.4/src/LogicalAnd.php
--- php-token-stream-3.1.1/src/LogicalAnd.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/LogicalAnd.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_LOGICAL_AND extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/LogicalOr.php php-token-stream-4.0.4/src/LogicalOr.php
--- php-token-stream-3.1.1/src/LogicalOr.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/LogicalOr.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_LOGICAL_OR extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/LogicalXor.php php-token-stream-4.0.4/src/LogicalXor.php
--- php-token-stream-3.1.1/src/LogicalXor.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/LogicalXor.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_LOGICAL_XOR extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/Lt.php php-token-stream-4.0.4/src/Lt.php
--- php-token-stream-3.1.1/src/Lt.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Lt.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_LT extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/MethodC.php php-token-stream-4.0.4/src/MethodC.php
--- php-token-stream-3.1.1/src/MethodC.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/MethodC.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_METHOD_C extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/MinusEqual.php php-token-stream-4.0.4/src/MinusEqual.php
--- php-token-stream-3.1.1/src/MinusEqual.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/MinusEqual.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_MINUS_EQUAL extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/Minus.php php-token-stream-4.0.4/src/Minus.php
--- php-token-stream-3.1.1/src/Minus.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Minus.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_MINUS extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/ModEqual.php php-token-stream-4.0.4/src/ModEqual.php
--- php-token-stream-3.1.1/src/ModEqual.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/ModEqual.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_MOD_EQUAL extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/MulEqual.php php-token-stream-4.0.4/src/MulEqual.php
--- php-token-stream-3.1.1/src/MulEqual.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/MulEqual.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_MUL_EQUAL extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/Mult.php php-token-stream-4.0.4/src/Mult.php
--- php-token-stream-3.1.1/src/Mult.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Mult.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_MULT extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/NameFullyQualified.php php-token-stream-4.0.4/src/NameFullyQualified.php
--- php-token-stream-3.1.1/src/NameFullyQualified.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/NameFullyQualified.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_NAME_FULLY_QUALIFIED extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/NameQualified.php php-token-stream-4.0.4/src/NameQualified.php
--- php-token-stream-3.1.1/src/NameQualified.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/NameQualified.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_NAME_QUALIFIED extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/NameRelative.php php-token-stream-4.0.4/src/NameRelative.php
--- php-token-stream-3.1.1/src/NameRelative.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/NameRelative.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_NAME_RELATIVE extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/Namespace.php php-token-stream-4.0.4/src/Namespace.php
--- php-token-stream-3.1.1/src/Namespace.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Namespace.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,31 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_NAMESPACE extends PHP_TokenWithScope
+{
+ /**
+ * @return string
+ */
+ public function getName()
+ {
+ $tokens = $this->tokenStream->tokens();
+ $namespace = (string) $tokens[$this->id + 2];
+
+ for ($i = $this->id + 3;; $i += 2) {
+ if (isset($tokens[$i]) &&
+ $tokens[$i] instanceof PHP_Token_NS_SEPARATOR) {
+ $namespace .= '\\' . $tokens[$i + 1];
+ } else {
+ break;
+ }
+ }
+
+ return $namespace;
+ }
+}
diff -Nru php-token-stream-3.1.1/src/New.php php-token-stream-4.0.4/src/New.php
--- php-token-stream-3.1.1/src/New.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/New.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_NEW extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/NsC.php php-token-stream-4.0.4/src/NsC.php
--- php-token-stream-3.1.1/src/NsC.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/NsC.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_NS_C extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/NsSeparator.php php-token-stream-4.0.4/src/NsSeparator.php
--- php-token-stream-3.1.1/src/NsSeparator.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/NsSeparator.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_NS_SEPARATOR extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/NumString.php php-token-stream-4.0.4/src/NumString.php
--- php-token-stream-3.1.1/src/NumString.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/NumString.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_NUM_STRING extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/ObjectCast.php php-token-stream-4.0.4/src/ObjectCast.php
--- php-token-stream-3.1.1/src/ObjectCast.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/ObjectCast.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_OBJECT_CAST extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/ObjectOperator.php php-token-stream-4.0.4/src/ObjectOperator.php
--- php-token-stream-3.1.1/src/ObjectOperator.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/ObjectOperator.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_OBJECT_OPERATOR extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/OpenBracket.php php-token-stream-4.0.4/src/OpenBracket.php
--- php-token-stream-3.1.1/src/OpenBracket.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/OpenBracket.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_OPEN_BRACKET extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/OpenCurly.php php-token-stream-4.0.4/src/OpenCurly.php
--- php-token-stream-3.1.1/src/OpenCurly.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/OpenCurly.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_OPEN_CURLY extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/OpenSquare.php php-token-stream-4.0.4/src/OpenSquare.php
--- php-token-stream-3.1.1/src/OpenSquare.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/OpenSquare.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_OPEN_SQUARE extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/OpenTag.php php-token-stream-4.0.4/src/OpenTag.php
--- php-token-stream-3.1.1/src/OpenTag.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/OpenTag.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_OPEN_TAG extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/OpenTagWithEcho.php php-token-stream-4.0.4/src/OpenTagWithEcho.php
--- php-token-stream-3.1.1/src/OpenTagWithEcho.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/OpenTagWithEcho.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_OPEN_TAG_WITH_ECHO extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/OrEqual.php php-token-stream-4.0.4/src/OrEqual.php
--- php-token-stream-3.1.1/src/OrEqual.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/OrEqual.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_OR_EQUAL extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/PaamayimNekudotayim.php php-token-stream-4.0.4/src/PaamayimNekudotayim.php
--- php-token-stream-3.1.1/src/PaamayimNekudotayim.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/PaamayimNekudotayim.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_PAAMAYIM_NEKUDOTAYIM extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/Percent.php php-token-stream-4.0.4/src/Percent.php
--- php-token-stream-3.1.1/src/Percent.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Percent.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_PERCENT extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/Pipe.php php-token-stream-4.0.4/src/Pipe.php
--- php-token-stream-3.1.1/src/Pipe.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Pipe.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_PIPE extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/PlusEqual.php php-token-stream-4.0.4/src/PlusEqual.php
--- php-token-stream-3.1.1/src/PlusEqual.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/PlusEqual.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_PLUS_EQUAL extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/Plus.php php-token-stream-4.0.4/src/Plus.php
--- php-token-stream-3.1.1/src/Plus.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Plus.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_PLUS extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/PowEqual.php php-token-stream-4.0.4/src/PowEqual.php
--- php-token-stream-3.1.1/src/PowEqual.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/PowEqual.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_POW_EQUAL extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/Pow.php php-token-stream-4.0.4/src/Pow.php
--- php-token-stream-3.1.1/src/Pow.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Pow.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_POW extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/Print.php php-token-stream-4.0.4/src/Print.php
--- php-token-stream-3.1.1/src/Print.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Print.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_PRINT extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/Private.php php-token-stream-4.0.4/src/Private.php
--- php-token-stream-3.1.1/src/Private.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Private.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_PRIVATE extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/Protected.php php-token-stream-4.0.4/src/Protected.php
--- php-token-stream-3.1.1/src/Protected.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Protected.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_PROTECTED extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/Public.php php-token-stream-4.0.4/src/Public.php
--- php-token-stream-3.1.1/src/Public.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Public.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_PUBLIC extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/QuestionMark.php php-token-stream-4.0.4/src/QuestionMark.php
--- php-token-stream-3.1.1/src/QuestionMark.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/QuestionMark.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_QUESTION_MARK extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/RequireOnce.php php-token-stream-4.0.4/src/RequireOnce.php
--- php-token-stream-3.1.1/src/RequireOnce.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/RequireOnce.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_REQUIRE_ONCE extends PHP_Token_Includes
+{
+}
diff -Nru php-token-stream-3.1.1/src/Require.php php-token-stream-4.0.4/src/Require.php
--- php-token-stream-3.1.1/src/Require.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Require.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_REQUIRE extends PHP_Token_Includes
+{
+}
diff -Nru php-token-stream-3.1.1/src/Return.php php-token-stream-4.0.4/src/Return.php
--- php-token-stream-3.1.1/src/Return.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Return.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_RETURN extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/Semicolon.php php-token-stream-4.0.4/src/Semicolon.php
--- php-token-stream-3.1.1/src/Semicolon.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Semicolon.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_SEMICOLON extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/SlEqual.php php-token-stream-4.0.4/src/SlEqual.php
--- php-token-stream-3.1.1/src/SlEqual.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/SlEqual.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_SL_EQUAL extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/Sl.php php-token-stream-4.0.4/src/Sl.php
--- php-token-stream-3.1.1/src/Sl.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Sl.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_SL extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/Spaceship.php php-token-stream-4.0.4/src/Spaceship.php
--- php-token-stream-3.1.1/src/Spaceship.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Spaceship.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_SPACESHIP extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/SrEqual.php php-token-stream-4.0.4/src/SrEqual.php
--- php-token-stream-3.1.1/src/SrEqual.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/SrEqual.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_SR_EQUAL extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/Sr.php php-token-stream-4.0.4/src/Sr.php
--- php-token-stream-3.1.1/src/Sr.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Sr.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_SR extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/StartHeredoc.php php-token-stream-4.0.4/src/StartHeredoc.php
--- php-token-stream-3.1.1/src/StartHeredoc.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/StartHeredoc.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_START_HEREDOC extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/Static.php php-token-stream-4.0.4/src/Static.php
--- php-token-stream-3.1.1/src/Static.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Static.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_STATIC extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/Stream.php php-token-stream-4.0.4/src/Stream.php
--- php-token-stream-3.1.1/src/Stream.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Stream.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,658 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_Stream implements ArrayAccess, Countable, SeekableIterator
+{
+ /**
+ * @var array>
+ */
+ protected static $customTokens = [
+ '(' => PHP_Token_OPEN_BRACKET::class,
+ ')' => PHP_Token_CLOSE_BRACKET::class,
+ '[' => PHP_Token_OPEN_SQUARE::class,
+ ']' => PHP_Token_CLOSE_SQUARE::class,
+ '{' => PHP_Token_OPEN_CURLY::class,
+ '}' => PHP_Token_CLOSE_CURLY::class,
+ ';' => PHP_Token_SEMICOLON::class,
+ '.' => PHP_Token_DOT::class,
+ ',' => PHP_Token_COMMA::class,
+ '=' => PHP_Token_EQUAL::class,
+ '<' => PHP_Token_LT::class,
+ '>' => PHP_Token_GT::class,
+ '+' => PHP_Token_PLUS::class,
+ '-' => PHP_Token_MINUS::class,
+ '*' => PHP_Token_MULT::class,
+ '/' => PHP_Token_DIV::class,
+ '?' => PHP_Token_QUESTION_MARK::class,
+ '!' => PHP_Token_EXCLAMATION_MARK::class,
+ ':' => PHP_Token_COLON::class,
+ '"' => PHP_Token_DOUBLE_QUOTES::class,
+ '@' => PHP_Token_AT::class,
+ '&' => PHP_Token_AMPERSAND::class,
+ '%' => PHP_Token_PERCENT::class,
+ '|' => PHP_Token_PIPE::class,
+ '$' => PHP_Token_DOLLAR::class,
+ '^' => PHP_Token_CARET::class,
+ '~' => PHP_Token_TILDE::class,
+ '`' => PHP_Token_BACKTICK::class,
+ ];
+
+ /**
+ * @var string
+ */
+ protected $filename;
+
+ /**
+ * @var array
+ */
+ protected $tokens = [];
+
+ /**
+ * @var array
+ */
+ protected $tokensByLine = [];
+
+ /**
+ * @var int
+ */
+ protected $position = 0;
+
+ /**
+ * @var array
+ */
+ protected $linesOfCode = ['loc' => 0, 'cloc' => 0, 'ncloc' => 0];
+
+ /**
+ * @var array
+ */
+ protected $classes;
+
+ /**
+ * @var array
+ */
+ protected $functions;
+
+ /**
+ * @var array
+ */
+ protected $includes;
+
+ /**
+ * @var array
+ */
+ protected $interfaces;
+
+ /**
+ * @var array
+ */
+ protected $traits;
+
+ /**
+ * @var array
+ */
+ protected $lineToFunctionMap = [];
+
+ /**
+ * Constructor.
+ *
+ * @param string $sourceCode
+ */
+ public function __construct($sourceCode)
+ {
+ if (\is_file($sourceCode)) {
+ $this->filename = $sourceCode;
+ $sourceCode = \file_get_contents($sourceCode);
+ }
+
+ $this->scan($sourceCode);
+ }
+
+ /**
+ * Destructor.
+ */
+ public function __destruct()
+ {
+ $this->tokens = [];
+ $this->tokensByLine = [];
+ }
+
+ /**
+ * @return string
+ */
+ public function __toString()
+ {
+ $buffer = '';
+
+ foreach ($this as $token) {
+ $buffer .= $token;
+ }
+
+ return $buffer;
+ }
+
+ /**
+ * @return string
+ */
+ public function getFilename()
+ {
+ return $this->filename;
+ }
+
+ /**
+ * @return int
+ */
+ public function count()
+ {
+ return \count($this->tokens);
+ }
+
+ /**
+ * @return PHP_Token[]
+ */
+ public function tokens()
+ {
+ return $this->tokens;
+ }
+
+ /**
+ * @return array
+ */
+ public function getClasses()
+ {
+ if ($this->classes !== null) {
+ return $this->classes;
+ }
+
+ $this->parse();
+
+ return $this->classes;
+ }
+
+ /**
+ * @return array
+ */
+ public function getFunctions()
+ {
+ if ($this->functions !== null) {
+ return $this->functions;
+ }
+
+ $this->parse();
+
+ return $this->functions;
+ }
+
+ /**
+ * @return array
+ */
+ public function getInterfaces()
+ {
+ if ($this->interfaces !== null) {
+ return $this->interfaces;
+ }
+
+ $this->parse();
+
+ return $this->interfaces;
+ }
+
+ /**
+ * @return array
+ */
+ public function getTraits()
+ {
+ if ($this->traits !== null) {
+ return $this->traits;
+ }
+
+ $this->parse();
+
+ return $this->traits;
+ }
+
+ /**
+ * Gets the names of all files that have been included
+ * using include(), include_once(), require() or require_once().
+ *
+ * Parameter $categorize set to TRUE causing this function to return a
+ * multi-dimensional array with categories in the keys of the first dimension
+ * and constants and their values in the second dimension.
+ *
+ * Parameter $category allow to filter following specific inclusion type
+ *
+ * @param bool $categorize OPTIONAL
+ * @param string $category OPTIONAL Either 'require_once', 'require',
+ * 'include_once', 'include'
+ *
+ * @return array
+ */
+ public function getIncludes($categorize = false, $category = null)
+ {
+ if ($this->includes === null) {
+ $this->includes = [
+ 'require_once' => [],
+ 'require' => [],
+ 'include_once' => [],
+ 'include' => [],
+ ];
+
+ foreach ($this->tokens as $token) {
+ switch (\get_class($token)) {
+ case PHP_Token_REQUIRE_ONCE::class:
+ case PHP_Token_REQUIRE::class:
+ case PHP_Token_INCLUDE_ONCE::class:
+ case PHP_Token_INCLUDE::class:
+ $this->includes[$token->getType()][] = $token->getName();
+
+ break;
+ }
+ }
+ }
+
+ if (isset($this->includes[$category])) {
+ $includes = $this->includes[$category];
+ } elseif ($categorize === false) {
+ $includes = \array_merge(
+ $this->includes['require_once'],
+ $this->includes['require'],
+ $this->includes['include_once'],
+ $this->includes['include']
+ );
+ } else {
+ $includes = $this->includes;
+ }
+
+ return $includes;
+ }
+
+ /**
+ * Returns the name of the function or method a line belongs to.
+ *
+ * @return string or null if the line is not in a function or method
+ */
+ public function getFunctionForLine($line)
+ {
+ $this->parse();
+
+ if (isset($this->lineToFunctionMap[$line])) {
+ return $this->lineToFunctionMap[$line];
+ }
+ }
+
+ /**
+ * @return array
+ */
+ public function getLinesOfCode()
+ {
+ return $this->linesOfCode;
+ }
+
+ public function rewind()/*: void*/
+ {
+ $this->position = 0;
+ }
+
+ /**
+ * @return bool
+ */
+ public function valid()
+ {
+ return isset($this->tokens[$this->position]);
+ }
+
+ /**
+ * @return int
+ */
+ public function key()
+ {
+ return $this->position;
+ }
+
+ /**
+ * @return PHP_Token
+ */
+ public function current()
+ {
+ return $this->tokens[$this->position];
+ }
+
+ public function next()/*: void*/
+ {
+ $this->position++;
+ }
+
+ /**
+ * @param int $offset
+ *
+ * @return bool
+ */
+ public function offsetExists($offset)
+ {
+ return isset($this->tokens[$offset]);
+ }
+
+ /**
+ * @param int $offset
+ *
+ * @throws OutOfBoundsException
+ */
+ public function offsetGet($offset)
+ {
+ if (!$this->offsetExists($offset)) {
+ throw new OutOfBoundsException(
+ \sprintf(
+ 'No token at position "%s"',
+ $offset
+ )
+ );
+ }
+
+ return $this->tokens[$offset];
+ }
+
+ /**
+ * @param int $offset
+ */
+ public function offsetSet($offset, $value)/*: void*/
+ {
+ $this->tokens[$offset] = $value;
+ }
+
+ /**
+ * @param int $offset
+ *
+ * @throws OutOfBoundsException
+ */
+ public function offsetUnset($offset)/*: void*/
+ {
+ if (!$this->offsetExists($offset)) {
+ throw new OutOfBoundsException(
+ \sprintf(
+ 'No token at position "%s"',
+ $offset
+ )
+ );
+ }
+
+ unset($this->tokens[$offset]);
+ }
+
+ /**
+ * Seek to an absolute position.
+ *
+ * @param int $position
+ *
+ * @throws OutOfBoundsException
+ */
+ public function seek($position)/*: void*/
+ {
+ $this->position = $position;
+
+ if (!$this->valid()) {
+ throw new OutOfBoundsException(
+ \sprintf(
+ 'No token at position "%s"',
+ $this->position
+ )
+ );
+ }
+ }
+
+ /**
+ * Scans the source for sequences of characters and converts them into a
+ * stream of tokens.
+ *
+ * @param string $sourceCode
+ */
+ protected function scan($sourceCode)/*: void*/
+ {
+ $id = 0;
+ $line = 1;
+ $tokens = \token_get_all($sourceCode);
+ $numTokens = \count($tokens);
+
+ $lastNonWhitespaceTokenWasDoubleColon = false;
+
+ $name = null;
+
+ for ($i = 0; $i < $numTokens; ++$i) {
+ $token = $tokens[$i];
+ $skip = 0;
+
+ if (\is_array($token)) {
+ $name = \substr(\token_name($token[0]), 2);
+ $text = $token[1];
+
+ if ($lastNonWhitespaceTokenWasDoubleColon && $name == 'CLASS') {
+ $name = 'CLASS_NAME_CONSTANT';
+ } elseif ($name == 'USE' && isset($tokens[$i + 2][0]) && $tokens[$i + 2][0] == \T_FUNCTION) {
+ $name = 'USE_FUNCTION';
+ $text .= $tokens[$i + 1][1] . $tokens[$i + 2][1];
+ $skip = 2;
+ }
+
+ /** @var class-string $tokenClass */
+ $tokenClass = 'PHP_Token_' . $name;
+ } else {
+ $text = $token;
+ $tokenClass = self::$customTokens[$token];
+ }
+
+ /*
+ * @see https://github.com/sebastianbergmann/php-token-stream/issues/95
+ */
+ if (PHP_MAJOR_VERSION >= 8 &&
+ $name === 'WHITESPACE' && // Current token is T_WHITESPACE
+ isset($this->tokens[$id - 1]) && // Current token is not the first token
+ $this->tokens[$id - 1] instanceof PHP_Token_COMMENT && // Previous token is T_COMMENT
+ strpos((string) $this->tokens[$id - 1], '/*') === false && // Previous token is comment that starts with '#' or '//'
+ strpos($text, "\n") === 0 // Text of current token begins with newline
+ ) {
+ $this->tokens[$id - 1] = new PHP_Token_COMMENT(
+ $this->tokens[$id - 1] . "\n",
+ $this->tokens[$id - 1]->getLine(),
+ $this,
+ $id - 1
+ );
+
+ $text = substr($text, 1);
+
+ $line++;
+
+ if (empty($text)) {
+ continue;
+ }
+ }
+
+ if (!isset($this->tokensByLine[$line])) {
+ $this->tokensByLine[$line] = [];
+ }
+
+ $token = new $tokenClass($text, $line, $this, $id++);
+
+ $this->tokens[] = $token;
+ $this->tokensByLine[$line][] = $token;
+
+ $line += \substr_count($text, "\n");
+
+ if ($tokenClass == PHP_Token_HALT_COMPILER::class) {
+ break;
+ }
+
+ if ($name == 'DOUBLE_COLON') {
+ $lastNonWhitespaceTokenWasDoubleColon = true;
+ } elseif ($name != 'WHITESPACE') {
+ $lastNonWhitespaceTokenWasDoubleColon = false;
+ }
+
+ $i += $skip;
+ }
+
+ foreach ($this->tokens as $token) {
+ if (!$token instanceof PHP_Token_COMMENT && !$token instanceof PHP_Token_DOC_COMMENT) {
+ continue;
+ }
+
+ foreach ($this->tokensByLine[$token->getLine()] as $_token) {
+ if (!$_token instanceof PHP_Token_COMMENT && !$_token instanceof PHP_Token_DOC_COMMENT && !$_token instanceof PHP_Token_WHITESPACE) {
+ continue 2;
+ }
+ }
+
+ $this->linesOfCode['cloc'] += max(1, \substr_count((string) $token, "\n"));
+ }
+
+ $this->linesOfCode['loc'] = \substr_count($sourceCode, "\n");
+ $this->linesOfCode['ncloc'] = $this->linesOfCode['loc'] -
+ $this->linesOfCode['cloc'];
+ }
+
+ protected function parse()/*: void*/
+ {
+ $this->interfaces = [];
+ $this->classes = [];
+ $this->traits = [];
+ $this->functions = [];
+ $class = [];
+ $classEndLine = [];
+ $trait = false;
+ $traitEndLine = false;
+ $interface = false;
+ $interfaceEndLine = false;
+
+ foreach ($this->tokens as $token) {
+ switch (\get_class($token)) {
+ case PHP_Token_HALT_COMPILER::class:
+ return;
+
+ case PHP_Token_INTERFACE::class:
+ $interface = $token->getName();
+ $interfaceEndLine = $token->getEndLine();
+
+ $this->interfaces[$interface] = [
+ 'methods' => [],
+ 'parent' => $token->getParent(),
+ 'keywords' => $token->getKeywords(),
+ 'docblock' => $token->getDocblock(),
+ 'startLine' => $token->getLine(),
+ 'endLine' => $interfaceEndLine,
+ 'package' => $token->getPackage(),
+ 'file' => $this->filename,
+ ];
+
+ break;
+
+ case PHP_Token_CLASS::class:
+ case PHP_Token_TRAIT::class:
+ $tmp = [
+ 'methods' => [],
+ 'parent' => $token->getParent(),
+ 'interfaces'=> $token->getInterfaces(),
+ 'keywords' => $token->getKeywords(),
+ 'docblock' => $token->getDocblock(),
+ 'startLine' => $token->getLine(),
+ 'endLine' => $token->getEndLine(),
+ 'package' => $token->getPackage(),
+ 'file' => $this->filename,
+ ];
+
+ if ($token instanceof PHP_Token_CLASS) {
+ $class[] = $token->getName();
+ $classEndLine[] = $token->getEndLine();
+
+ if ($token->getName() !== null) {
+ $this->classes[$class[\count($class) - 1]] = $tmp;
+ }
+ } else {
+ $trait = $token->getName();
+ $traitEndLine = $token->getEndLine();
+ $this->traits[$trait] = $tmp;
+ }
+
+ break;
+
+ case PHP_Token_FUNCTION::class:
+ $name = $token->getName();
+ $tmp = [
+ 'docblock' => $token->getDocblock(),
+ 'keywords' => $token->getKeywords(),
+ 'visibility'=> $token->getVisibility(),
+ 'signature' => $token->getSignature(),
+ 'startLine' => $token->getLine(),
+ 'endLine' => $token->getEndLine(),
+ 'ccn' => $token->getCCN(),
+ 'file' => $this->filename,
+ ];
+
+ if (empty($class) &&
+ $trait === false &&
+ $interface === false) {
+ $this->functions[$name] = $tmp;
+
+ $this->addFunctionToMap(
+ $name,
+ $tmp['startLine'],
+ $tmp['endLine']
+ );
+ } elseif (!empty($class)) {
+ if ($class[\count($class) - 1] !== null) {
+ $this->classes[$class[\count($class) - 1]]['methods'][$name] = $tmp;
+
+ $this->addFunctionToMap(
+ $class[\count($class) - 1] . '::' . $name,
+ $tmp['startLine'],
+ $tmp['endLine']
+ );
+ }
+ } elseif ($trait !== false) {
+ $this->traits[$trait]['methods'][$name] = $tmp;
+
+ $this->addFunctionToMap(
+ $trait . '::' . $name,
+ $tmp['startLine'],
+ $tmp['endLine']
+ );
+ } else {
+ $this->interfaces[$interface]['methods'][$name] = $tmp;
+ }
+
+ break;
+
+ case PHP_Token_CLOSE_CURLY::class:
+ if (!empty($classEndLine) &&
+ $classEndLine[\count($classEndLine) - 1] == $token->getLine()) {
+ \array_pop($classEndLine);
+ \array_pop($class);
+ } elseif ($traitEndLine !== false &&
+ $traitEndLine == $token->getLine()) {
+ $trait = false;
+ $traitEndLine = false;
+ } elseif ($interfaceEndLine !== false &&
+ $interfaceEndLine == $token->getLine()) {
+ $interface = false;
+ $interfaceEndLine = false;
+ }
+
+ break;
+ }
+ }
+ }
+
+ /**
+ * @param string $name
+ * @param int $startLine
+ * @param int $endLine
+ */
+ private function addFunctionToMap($name, $startLine, $endLine): void
+ {
+ for ($line = $startLine; $line <= $endLine; $line++) {
+ $this->lineToFunctionMap[$line] = $name;
+ }
+ }
+}
diff -Nru php-token-stream-3.1.1/src/StringCast.php php-token-stream-4.0.4/src/StringCast.php
--- php-token-stream-3.1.1/src/StringCast.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/StringCast.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_STRING_CAST extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/String.php php-token-stream-4.0.4/src/String.php
--- php-token-stream-3.1.1/src/String.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/String.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_STRING extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/StringVarname.php php-token-stream-4.0.4/src/StringVarname.php
--- php-token-stream-3.1.1/src/StringVarname.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/StringVarname.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_STRING_VARNAME extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/Switch.php php-token-stream-4.0.4/src/Switch.php
--- php-token-stream-3.1.1/src/Switch.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Switch.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_SWITCH extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/Throw.php php-token-stream-4.0.4/src/Throw.php
--- php-token-stream-3.1.1/src/Throw.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Throw.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_THROW extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/Tilde.php php-token-stream-4.0.4/src/Tilde.php
--- php-token-stream-3.1.1/src/Tilde.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Tilde.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_TILDE extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/Token/Stream/CachingFactory.php php-token-stream-4.0.4/src/Token/Stream/CachingFactory.php
--- php-token-stream-3.1.1/src/Token/Stream/CachingFactory.php 2019-09-17 06:23:10.000000000 +0000
+++ php-token-stream-4.0.4/src/Token/Stream/CachingFactory.php 1970-01-01 00:00:00.000000000 +0000
@@ -1,46 +0,0 @@
-
- *
- * 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
-{
- /**
- * @var array
- */
- protected static $cache = [];
-
- /**
- * @param string $filename
- *
- * @return PHP_Token_Stream
- */
- public static function get($filename)
- {
- if (!isset(self::$cache[$filename])) {
- self::$cache[$filename] = new PHP_Token_Stream($filename);
- }
-
- return self::$cache[$filename];
- }
-
- /**
- * @param string $filename
- */
- public static function clear($filename = null)
- {
- if (is_string($filename)) {
- unset(self::$cache[$filename]);
- } else {
- self::$cache = [];
- }
- }
-}
diff -Nru php-token-stream-3.1.1/src/Token/Stream.php php-token-stream-4.0.4/src/Token/Stream.php
--- php-token-stream-3.1.1/src/Token/Stream.php 2019-09-17 06:23:10.000000000 +0000
+++ php-token-stream-4.0.4/src/Token/Stream.php 1970-01-01 00:00:00.000000000 +0000
@@ -1,609 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-/**
- * A stream of PHP tokens.
- */
-class PHP_Token_Stream implements ArrayAccess, Countable, SeekableIterator
-{
- /**
- * @var array
- */
- protected static $customTokens = [
- '(' => 'PHP_Token_OPEN_BRACKET',
- ')' => 'PHP_Token_CLOSE_BRACKET',
- '[' => 'PHP_Token_OPEN_SQUARE',
- ']' => 'PHP_Token_CLOSE_SQUARE',
- '{' => 'PHP_Token_OPEN_CURLY',
- '}' => 'PHP_Token_CLOSE_CURLY',
- ';' => 'PHP_Token_SEMICOLON',
- '.' => 'PHP_Token_DOT',
- ',' => 'PHP_Token_COMMA',
- '=' => 'PHP_Token_EQUAL',
- '<' => 'PHP_Token_LT',
- '>' => 'PHP_Token_GT',
- '+' => 'PHP_Token_PLUS',
- '-' => 'PHP_Token_MINUS',
- '*' => 'PHP_Token_MULT',
- '/' => 'PHP_Token_DIV',
- '?' => 'PHP_Token_QUESTION_MARK',
- '!' => 'PHP_Token_EXCLAMATION_MARK',
- ':' => 'PHP_Token_COLON',
- '"' => 'PHP_Token_DOUBLE_QUOTES',
- '@' => 'PHP_Token_AT',
- '&' => 'PHP_Token_AMPERSAND',
- '%' => 'PHP_Token_PERCENT',
- '|' => 'PHP_Token_PIPE',
- '$' => 'PHP_Token_DOLLAR',
- '^' => 'PHP_Token_CARET',
- '~' => 'PHP_Token_TILDE',
- '`' => 'PHP_Token_BACKTICK'
- ];
-
- /**
- * @var string
- */
- protected $filename;
-
- /**
- * @var array
- */
- protected $tokens = [];
-
- /**
- * @var int
- */
- protected $position = 0;
-
- /**
- * @var array
- */
- protected $linesOfCode = ['loc' => 0, 'cloc' => 0, 'ncloc' => 0];
-
- /**
- * @var array
- */
- protected $classes;
-
- /**
- * @var array
- */
- protected $functions;
-
- /**
- * @var array
- */
- protected $includes;
-
- /**
- * @var array
- */
- protected $interfaces;
-
- /**
- * @var array
- */
- protected $traits;
-
- /**
- * @var array
- */
- protected $lineToFunctionMap = [];
-
- /**
- * Constructor.
- *
- * @param string $sourceCode
- */
- public function __construct($sourceCode)
- {
- if (is_file($sourceCode)) {
- $this->filename = $sourceCode;
- $sourceCode = file_get_contents($sourceCode);
- }
-
- $this->scan($sourceCode);
- }
-
- /**
- * Destructor.
- */
- public function __destruct()
- {
- $this->tokens = [];
- }
-
- /**
- * @return string
- */
- public function __toString()
- {
- $buffer = '';
-
- foreach ($this as $token) {
- $buffer .= $token;
- }
-
- return $buffer;
- }
-
- /**
- * @return string
- */
- public function getFilename()
- {
- return $this->filename;
- }
-
- /**
- * Scans the source for sequences of characters and converts them into a
- * stream of tokens.
- *
- * @param string $sourceCode
- */
- protected function scan($sourceCode)
- {
- $id = 0;
- $line = 1;
- $tokens = token_get_all($sourceCode);
- $numTokens = count($tokens);
-
- $lastNonWhitespaceTokenWasDoubleColon = false;
-
- for ($i = 0; $i < $numTokens; ++$i) {
- $token = $tokens[$i];
- $skip = 0;
-
- if (is_array($token)) {
- $name = substr(token_name($token[0]), 2);
- $text = $token[1];
-
- if ($lastNonWhitespaceTokenWasDoubleColon && $name == 'CLASS') {
- $name = 'CLASS_NAME_CONSTANT';
- } elseif ($name == 'USE' && isset($tokens[$i + 2][0]) && $tokens[$i + 2][0] == T_FUNCTION) {
- $name = 'USE_FUNCTION';
- $text .= $tokens[$i + 1][1] . $tokens[$i + 2][1];
- $skip = 2;
- }
-
- $tokenClass = 'PHP_Token_' . $name;
- } else {
- $text = $token;
- $tokenClass = self::$customTokens[$token];
- }
-
- $this->tokens[] = new $tokenClass($text, $line, $this, $id++);
- $lines = substr_count($text, "\n");
- $line += $lines;
-
- if ($tokenClass == 'PHP_Token_HALT_COMPILER') {
- break;
- } elseif ($tokenClass == 'PHP_Token_COMMENT' ||
- $tokenClass == 'PHP_Token_DOC_COMMENT') {
- $this->linesOfCode['cloc'] += $lines + 1;
- }
-
- if ($name == 'DOUBLE_COLON') {
- $lastNonWhitespaceTokenWasDoubleColon = true;
- } elseif ($name != 'WHITESPACE') {
- $lastNonWhitespaceTokenWasDoubleColon = false;
- }
-
- $i += $skip;
- }
-
- $this->linesOfCode['loc'] = substr_count($sourceCode, "\n");
- $this->linesOfCode['ncloc'] = $this->linesOfCode['loc'] -
- $this->linesOfCode['cloc'];
- }
-
- /**
- * @return int
- */
- public function count()
- {
- return count($this->tokens);
- }
-
- /**
- * @return PHP_Token[]
- */
- public function tokens()
- {
- return $this->tokens;
- }
-
- /**
- * @return array
- */
- public function getClasses()
- {
- if ($this->classes !== null) {
- return $this->classes;
- }
-
- $this->parse();
-
- return $this->classes;
- }
-
- /**
- * @return array
- */
- public function getFunctions()
- {
- if ($this->functions !== null) {
- return $this->functions;
- }
-
- $this->parse();
-
- return $this->functions;
- }
-
- /**
- * @return array
- */
- public function getInterfaces()
- {
- if ($this->interfaces !== null) {
- return $this->interfaces;
- }
-
- $this->parse();
-
- return $this->interfaces;
- }
-
- /**
- * @return array
- */
- public function getTraits()
- {
- if ($this->traits !== null) {
- return $this->traits;
- }
-
- $this->parse();
-
- return $this->traits;
- }
-
- /**
- * Gets the names of all files that have been included
- * using include(), include_once(), require() or require_once().
- *
- * Parameter $categorize set to TRUE causing this function to return a
- * multi-dimensional array with categories in the keys of the first dimension
- * and constants and their values in the second dimension.
- *
- * Parameter $category allow to filter following specific inclusion type
- *
- * @param bool $categorize OPTIONAL
- * @param string $category OPTIONAL Either 'require_once', 'require',
- * 'include_once', 'include'.
- *
- * @return array
- */
- public function getIncludes($categorize = false, $category = null)
- {
- if ($this->includes === null) {
- $this->includes = [
- 'require_once' => [],
- 'require' => [],
- 'include_once' => [],
- 'include' => []
- ];
-
- foreach ($this->tokens as $token) {
- switch (PHP_Token_Util::getClass($token)) {
- case 'PHP_Token_REQUIRE_ONCE':
- case 'PHP_Token_REQUIRE':
- case 'PHP_Token_INCLUDE_ONCE':
- case 'PHP_Token_INCLUDE':
- $this->includes[$token->getType()][] = $token->getName();
- break;
- }
- }
- }
-
- if (isset($this->includes[$category])) {
- $includes = $this->includes[$category];
- } elseif ($categorize === false) {
- $includes = array_merge(
- $this->includes['require_once'],
- $this->includes['require'],
- $this->includes['include_once'],
- $this->includes['include']
- );
- } else {
- $includes = $this->includes;
- }
-
- return $includes;
- }
-
- /**
- * Returns the name of the function or method a line belongs to.
- *
- * @return string or null if the line is not in a function or method
- */
- public function getFunctionForLine($line)
- {
- $this->parse();
-
- if (isset($this->lineToFunctionMap[$line])) {
- return $this->lineToFunctionMap[$line];
- }
- }
-
- protected function parse()
- {
- $this->interfaces = [];
- $this->classes = [];
- $this->traits = [];
- $this->functions = [];
- $class = [];
- $classEndLine = [];
- $trait = false;
- $traitEndLine = false;
- $interface = false;
- $interfaceEndLine = false;
-
- foreach ($this->tokens as $token) {
- switch (PHP_Token_Util::getClass($token)) {
- case 'PHP_Token_HALT_COMPILER':
- return;
-
- case 'PHP_Token_INTERFACE':
- $interface = $token->getName();
- $interfaceEndLine = $token->getEndLine();
-
- $this->interfaces[$interface] = [
- 'methods' => [],
- 'parent' => $token->getParent(),
- 'keywords' => $token->getKeywords(),
- 'docblock' => $token->getDocblock(),
- 'startLine' => $token->getLine(),
- 'endLine' => $interfaceEndLine,
- 'package' => $token->getPackage(),
- 'file' => $this->filename
- ];
- break;
-
- case 'PHP_Token_CLASS':
- case 'PHP_Token_TRAIT':
- $tmp = [
- 'methods' => [],
- 'parent' => $token->getParent(),
- 'interfaces'=> $token->getInterfaces(),
- 'keywords' => $token->getKeywords(),
- 'docblock' => $token->getDocblock(),
- 'startLine' => $token->getLine(),
- 'endLine' => $token->getEndLine(),
- 'package' => $token->getPackage(),
- 'file' => $this->filename
- ];
-
- if ($token->getName() !== null) {
- if ($token instanceof PHP_Token_CLASS) {
- $class[] = $token->getName();
- $classEndLine[] = $token->getEndLine();
-
- $this->classes[$class[count($class) - 1]] = $tmp;
- } else {
- $trait = $token->getName();
- $traitEndLine = $token->getEndLine();
- $this->traits[$trait] = $tmp;
- }
- }
- break;
-
- case 'PHP_Token_FUNCTION':
- $name = $token->getName();
- $tmp = [
- 'docblock' => $token->getDocblock(),
- 'keywords' => $token->getKeywords(),
- 'visibility'=> $token->getVisibility(),
- 'signature' => $token->getSignature(),
- 'startLine' => $token->getLine(),
- 'endLine' => $token->getEndLine(),
- 'ccn' => $token->getCCN(),
- 'file' => $this->filename
- ];
-
- if (empty($class) &&
- $trait === false &&
- $interface === false) {
- $this->functions[$name] = $tmp;
-
- $this->addFunctionToMap(
- $name,
- $tmp['startLine'],
- $tmp['endLine']
- );
- } elseif (!empty($class)) {
- $this->classes[$class[count($class) - 1]]['methods'][$name] = $tmp;
-
- $this->addFunctionToMap(
- $class[count($class) - 1] . '::' . $name,
- $tmp['startLine'],
- $tmp['endLine']
- );
- } elseif ($trait !== false) {
- $this->traits[$trait]['methods'][$name] = $tmp;
-
- $this->addFunctionToMap(
- $trait . '::' . $name,
- $tmp['startLine'],
- $tmp['endLine']
- );
- } else {
- $this->interfaces[$interface]['methods'][$name] = $tmp;
- }
- break;
-
- case 'PHP_Token_CLOSE_CURLY':
- if (!empty($classEndLine) &&
- $classEndLine[count($classEndLine) - 1] == $token->getLine()) {
- array_pop($classEndLine);
- array_pop($class);
- } elseif ($traitEndLine !== false &&
- $traitEndLine == $token->getLine()) {
- $trait = false;
- $traitEndLine = false;
- } elseif ($interfaceEndLine !== false &&
- $interfaceEndLine == $token->getLine()) {
- $interface = false;
- $interfaceEndLine = false;
- }
- break;
- }
- }
- }
-
- /**
- * @return array
- */
- public function getLinesOfCode()
- {
- return $this->linesOfCode;
- }
-
- /**
- */
- public function rewind()
- {
- $this->position = 0;
- }
-
- /**
- * @return bool
- */
- public function valid()
- {
- return isset($this->tokens[$this->position]);
- }
-
- /**
- * @return int
- */
- public function key()
- {
- return $this->position;
- }
-
- /**
- * @return PHP_Token
- */
- public function current()
- {
- return $this->tokens[$this->position];
- }
-
- /**
- */
- public function next()
- {
- $this->position++;
- }
-
- /**
- * @param int $offset
- *
- * @return bool
- */
- public function offsetExists($offset)
- {
- return isset($this->tokens[$offset]);
- }
-
- /**
- * @param int $offset
- *
- * @return mixed
- *
- * @throws OutOfBoundsException
- */
- public function offsetGet($offset)
- {
- if (!$this->offsetExists($offset)) {
- throw new OutOfBoundsException(
- sprintf(
- 'No token at position "%s"',
- $offset
- )
- );
- }
-
- return $this->tokens[$offset];
- }
-
- /**
- * @param int $offset
- * @param mixed $value
- */
- public function offsetSet($offset, $value)
- {
- $this->tokens[$offset] = $value;
- }
-
- /**
- * @param int $offset
- *
- * @throws OutOfBoundsException
- */
- public function offsetUnset($offset)
- {
- if (!$this->offsetExists($offset)) {
- throw new OutOfBoundsException(
- sprintf(
- 'No token at position "%s"',
- $offset
- )
- );
- }
-
- unset($this->tokens[$offset]);
- }
-
- /**
- * Seek to an absolute position.
- *
- * @param int $position
- *
- * @throws OutOfBoundsException
- */
- public function seek($position)
- {
- $this->position = $position;
-
- if (!$this->valid()) {
- throw new OutOfBoundsException(
- sprintf(
- 'No token at position "%s"',
- $this->position
- )
- );
- }
- }
-
- /**
- * @param string $name
- * @param int $startLine
- * @param int $endLine
- */
- private function addFunctionToMap($name, $startLine, $endLine)
- {
- for ($line = $startLine; $line <= $endLine; $line++) {
- $this->lineToFunctionMap[$line] = $name;
- }
- }
-}
diff -Nru php-token-stream-3.1.1/src/Token/Util.php php-token-stream-4.0.4/src/Token/Util.php
--- php-token-stream-3.1.1/src/Token/Util.php 2019-09-17 06:23:10.000000000 +0000
+++ php-token-stream-4.0.4/src/Token/Util.php 1970-01-01 00:00:00.000000000 +0000
@@ -1,19 +0,0 @@
-
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-final class PHP_Token_Util
-{
- public static function getClass($object): string
- {
- $parts = explode('\\', get_class($object));
-
- return array_pop($parts);
- }
-}
\ No newline at end of file
diff -Nru php-token-stream-3.1.1/src/Token.php php-token-stream-4.0.4/src/Token.php
--- php-token-stream-3.1.1/src/Token.php 2019-09-17 06:23:10.000000000 +0000
+++ php-token-stream-4.0.4/src/Token.php 2020-08-17 16:46:03.000000000 +0000
@@ -1,16 +1,12 @@
-
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
-
-/**
- * A PHP token.
- */
abstract class PHP_Token
{
/**
@@ -34,10 +30,9 @@
protected $id;
/**
- * @param string $text
- * @param int $line
- * @param PHP_Token_Stream $tokenStream
- * @param int $id
+ * @param string $text
+ * @param int $line
+ * @param int $id
*/
public function __construct($text, $line, PHP_Token_Stream $tokenStream, $id)
{
@@ -71,1291 +66,3 @@
return $this->id;
}
}
-
-abstract class PHP_TokenWithScope extends PHP_Token
-{
- /**
- * @var int
- */
- protected $endTokenId;
-
- /**
- * Get the docblock for this token
- *
- * This method will fetch the docblock belonging to the current token. The
- * docblock must be placed on the line directly above the token to be
- * recognized.
- *
- * @return string|null Returns the docblock as a string if found
- */
- public function getDocblock()
- {
- $tokens = $this->tokenStream->tokens();
- $currentLineNumber = $tokens[$this->id]->getLine();
- $prevLineNumber = $currentLineNumber - 1;
-
- for ($i = $this->id - 1; $i; $i--) {
- if (!isset($tokens[$i])) {
- return;
- }
-
- if ($tokens[$i] instanceof PHP_Token_FUNCTION ||
- $tokens[$i] instanceof PHP_Token_CLASS ||
- $tokens[$i] instanceof PHP_Token_TRAIT) {
- // Some other trait, class or function, no docblock can be
- // used for the current token
- break;
- }
-
- $line = $tokens[$i]->getLine();
-
- if ($line == $currentLineNumber ||
- ($line == $prevLineNumber &&
- $tokens[$i] instanceof PHP_Token_WHITESPACE)) {
- continue;
- }
-
- if ($line < $currentLineNumber &&
- !$tokens[$i] instanceof PHP_Token_DOC_COMMENT) {
- break;
- }
-
- return (string) $tokens[$i];
- }
- }
-
- /**
- * @return int
- */
- public function getEndTokenId()
- {
- $block = 0;
- $i = $this->id;
- $tokens = $this->tokenStream->tokens();
-
- while ($this->endTokenId === null && isset($tokens[$i])) {
- if ($tokens[$i] instanceof PHP_Token_OPEN_CURLY ||
- $tokens[$i] instanceof PHP_Token_DOLLAR_OPEN_CURLY_BRACES ||
- $tokens[$i] instanceof PHP_Token_CURLY_OPEN) {
- $block++;
- } elseif ($tokens[$i] instanceof PHP_Token_CLOSE_CURLY) {
- $block--;
-
- if ($block === 0) {
- $this->endTokenId = $i;
- }
- } elseif (($this instanceof PHP_Token_FUNCTION ||
- $this instanceof PHP_Token_NAMESPACE) &&
- $tokens[$i] instanceof PHP_Token_SEMICOLON) {
- if ($block === 0) {
- $this->endTokenId = $i;
- }
- }
-
- $i++;
- }
-
- if ($this->endTokenId === null) {
- $this->endTokenId = $this->id;
- }
-
- return $this->endTokenId;
- }
-
- /**
- * @return int
- */
- public function getEndLine()
- {
- return $this->tokenStream[$this->getEndTokenId()]->getLine();
- }
-}
-
-abstract class PHP_TokenWithScopeAndVisibility extends PHP_TokenWithScope
-{
- /**
- * @return string
- */
- public function getVisibility()
- {
- $tokens = $this->tokenStream->tokens();
-
- for ($i = $this->id - 2; $i > $this->id - 7; $i -= 2) {
- if (isset($tokens[$i]) &&
- ($tokens[$i] instanceof PHP_Token_PRIVATE ||
- $tokens[$i] instanceof PHP_Token_PROTECTED ||
- $tokens[$i] instanceof PHP_Token_PUBLIC)) {
- return strtolower(
- str_replace('PHP_Token_', '', PHP_Token_Util::getClass($tokens[$i]))
- );
- }
- if (isset($tokens[$i]) &&
- !($tokens[$i] instanceof PHP_Token_STATIC ||
- $tokens[$i] instanceof PHP_Token_FINAL ||
- $tokens[$i] instanceof PHP_Token_ABSTRACT)) {
- // no keywords; stop visibility search
- break;
- }
- }
- }
-
- /**
- * @return string
- */
- public function getKeywords()
- {
- $keywords = [];
- $tokens = $this->tokenStream->tokens();
-
- for ($i = $this->id - 2; $i > $this->id - 7; $i -= 2) {
- if (isset($tokens[$i]) &&
- ($tokens[$i] instanceof PHP_Token_PRIVATE ||
- $tokens[$i] instanceof PHP_Token_PROTECTED ||
- $tokens[$i] instanceof PHP_Token_PUBLIC)) {
- continue;
- }
-
- if (isset($tokens[$i]) &&
- ($tokens[$i] instanceof PHP_Token_STATIC ||
- $tokens[$i] instanceof PHP_Token_FINAL ||
- $tokens[$i] instanceof PHP_Token_ABSTRACT)) {
- $keywords[] = strtolower(
- str_replace('PHP_Token_', '', PHP_Token_Util::getClass($tokens[$i]))
- );
- }
- }
-
- return implode(',', $keywords);
- }
-}
-
-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()
- {
- $tokens = $this->tokenStream->tokens();
-
- if ($tokens[$this->id + 2] instanceof PHP_Token_CONSTANT_ENCAPSED_STRING) {
- $this->name = trim($tokens[$this->id + 2], "'\"");
- $this->type = strtolower(
- str_replace('PHP_Token_', '', PHP_Token_Util::getClass($tokens[$this->id]))
- );
- }
- }
-}
-
-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 (PHP_Token_Util::getClass($tokens[$i])) {
- case 'PHP_Token_IF':
- case 'PHP_Token_ELSEIF':
- case 'PHP_Token_FOR':
- case 'PHP_Token_FOREACH':
- case 'PHP_Token_WHILE':
- case 'PHP_Token_CASE':
- case 'PHP_Token_CATCH':
- case 'PHP_Token_BOOLEAN_AND':
- case 'PHP_Token_LOGICAL_AND':
- case 'PHP_Token_BOOLEAN_OR':
- case 'PHP_Token_LOGICAL_OR':
- case 'PHP_Token_QUESTION_MARK':
- $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;
- }
-}
-
-class PHP_Token_INTERFACE extends PHP_TokenWithScopeAndVisibility
-{
- /**
- * @var array
- */
- protected $interfaces;
-
- /**
- * @return string
- */
- public function getName()
- {
- return (string) $this->tokenStream[$this->id + 2];
- }
-
- /**
- * @return bool
- */
- public function hasParent()
- {
- return $this->tokenStream[$this->id + 4] instanceof PHP_Token_EXTENDS;
- }
-
- /**
- * @return array
- */
- public function getPackage()
- {
- $className = $this->getName();
- $docComment = $this->getDocblock();
-
- $result = [
- 'namespace' => '',
- 'fullPackage' => '',
- 'category' => '',
- 'package' => '',
- 'subpackage' => ''
- ];
-
- for ($i = $this->id; $i; --$i) {
- if ($this->tokenStream[$i] instanceof PHP_Token_NAMESPACE) {
- $result['namespace'] = $this->tokenStream[$i]->getName();
- break;
- }
- }
-
- if (preg_match('/@category[\s]+([\.\w]+)/', $docComment, $matches)) {
- $result['category'] = $matches[1];
- }
-
- if (preg_match('/@package[\s]+([\.\w]+)/', $docComment, $matches)) {
- $result['package'] = $matches[1];
- $result['fullPackage'] = $matches[1];
- }
-
- if (preg_match('/@subpackage[\s]+([\.\w]+)/', $docComment, $matches)) {
- $result['subpackage'] = $matches[1];
- $result['fullPackage'] .= '.' . $matches[1];
- }
-
- if (empty($result['fullPackage'])) {
- $result['fullPackage'] = $this->arrayToName(
- explode('_', str_replace('\\', '_', $className)),
- '.'
- );
- }
-
- return $result;
- }
-
- /**
- * @param array $parts
- * @param string $join
- *
- * @return string
- */
- protected function arrayToName(array $parts, $join = '\\')
- {
- $result = '';
-
- if (count($parts) > 1) {
- array_pop($parts);
-
- $result = implode($join, $parts);
- }
-
- return $result;
- }
-
- /**
- * @return bool|string
- */
- public function getParent()
- {
- if (!$this->hasParent()) {
- return false;
- }
-
- $i = $this->id + 6;
- $tokens = $this->tokenStream->tokens();
- $className = (string) $tokens[$i];
-
- while (isset($tokens[$i + 1]) &&
- !$tokens[$i + 1] instanceof PHP_Token_WHITESPACE) {
- $className .= (string) $tokens[++$i];
- }
-
- return $className;
- }
-
- /**
- * @return bool
- */
- public function hasInterfaces()
- {
- return (isset($this->tokenStream[$this->id + 4]) &&
- $this->tokenStream[$this->id + 4] instanceof PHP_Token_IMPLEMENTS) ||
- (isset($this->tokenStream[$this->id + 8]) &&
- $this->tokenStream[$this->id + 8] instanceof PHP_Token_IMPLEMENTS);
- }
-
- /**
- * @return array|bool
- */
- public function getInterfaces()
- {
- if ($this->interfaces !== null) {
- return $this->interfaces;
- }
-
- if (!$this->hasInterfaces()) {
- return ($this->interfaces = false);
- }
-
- if ($this->tokenStream[$this->id + 4] instanceof PHP_Token_IMPLEMENTS) {
- $i = $this->id + 3;
- } else {
- $i = $this->id + 7;
- }
-
- $tokens = $this->tokenStream->tokens();
-
- while (!$tokens[$i + 1] instanceof PHP_Token_OPEN_CURLY) {
- $i++;
-
- if ($tokens[$i] instanceof PHP_Token_STRING) {
- $this->interfaces[] = (string) $tokens[$i];
- }
- }
-
- return $this->interfaces;
- }
-}
-
-class PHP_Token_ABSTRACT extends PHP_Token
-{
-}
-
-class PHP_Token_AMPERSAND extends PHP_Token
-{
-}
-
-class PHP_Token_AND_EQUAL extends PHP_Token
-{
-}
-
-class PHP_Token_ARRAY extends PHP_Token
-{
-}
-
-class PHP_Token_ARRAY_CAST extends PHP_Token
-{
-}
-
-class PHP_Token_AS extends PHP_Token
-{
-}
-
-class PHP_Token_AT extends PHP_Token
-{
-}
-
-class PHP_Token_BACKTICK extends PHP_Token
-{
-}
-
-class PHP_Token_BAD_CHARACTER extends PHP_Token
-{
-}
-
-class PHP_Token_BOOLEAN_AND extends PHP_Token
-{
-}
-
-class PHP_Token_BOOLEAN_OR extends PHP_Token
-{
-}
-
-class PHP_Token_BOOL_CAST extends PHP_Token
-{
-}
-
-class PHP_Token_BREAK extends PHP_Token
-{
-}
-
-class PHP_Token_CARET extends PHP_Token
-{
-}
-
-class PHP_Token_CASE extends PHP_Token
-{
-}
-
-class PHP_Token_CATCH extends PHP_Token
-{
-}
-
-class PHP_Token_CHARACTER extends PHP_Token
-{
-}
-
-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;
- }
-}
-
-class PHP_Token_CLASS_C extends PHP_Token
-{
-}
-
-class PHP_Token_CLASS_NAME_CONSTANT extends PHP_Token
-{
-}
-
-class PHP_Token_CLONE extends PHP_Token
-{
-}
-
-class PHP_Token_CLOSE_BRACKET extends PHP_Token
-{
-}
-
-class PHP_Token_CLOSE_CURLY extends PHP_Token
-{
-}
-
-class PHP_Token_CLOSE_SQUARE extends PHP_Token
-{
-}
-
-class PHP_Token_CLOSE_TAG extends PHP_Token
-{
-}
-
-class PHP_Token_COLON extends PHP_Token
-{
-}
-
-class PHP_Token_COMMA extends PHP_Token
-{
-}
-
-class PHP_Token_COMMENT extends PHP_Token
-{
-}
-
-class PHP_Token_CONCAT_EQUAL extends PHP_Token
-{
-}
-
-class PHP_Token_CONST extends PHP_Token
-{
-}
-
-class PHP_Token_CONSTANT_ENCAPSED_STRING extends PHP_Token
-{
-}
-
-class PHP_Token_CONTINUE extends PHP_Token
-{
-}
-
-class PHP_Token_CURLY_OPEN extends PHP_Token
-{
-}
-
-class PHP_Token_DEC extends PHP_Token
-{
-}
-
-class PHP_Token_DECLARE extends PHP_Token
-{
-}
-
-class PHP_Token_DEFAULT extends PHP_Token
-{
-}
-
-class PHP_Token_DIV extends PHP_Token
-{
-}
-
-class PHP_Token_DIV_EQUAL extends PHP_Token
-{
-}
-
-class PHP_Token_DNUMBER extends PHP_Token
-{
-}
-
-class PHP_Token_DO extends PHP_Token
-{
-}
-
-class PHP_Token_DOC_COMMENT extends PHP_Token
-{
-}
-
-class PHP_Token_DOLLAR extends PHP_Token
-{
-}
-
-class PHP_Token_DOLLAR_OPEN_CURLY_BRACES extends PHP_Token
-{
-}
-
-class PHP_Token_DOT extends PHP_Token
-{
-}
-
-class PHP_Token_DOUBLE_ARROW extends PHP_Token
-{
-}
-
-class PHP_Token_DOUBLE_CAST extends PHP_Token
-{
-}
-
-class PHP_Token_DOUBLE_COLON extends PHP_Token
-{
-}
-
-class PHP_Token_DOUBLE_QUOTES extends PHP_Token
-{
-}
-
-class PHP_Token_ECHO extends PHP_Token
-{
-}
-
-class PHP_Token_ELSE extends PHP_Token
-{
-}
-
-class PHP_Token_ELSEIF extends PHP_Token
-{
-}
-
-class PHP_Token_EMPTY extends PHP_Token
-{
-}
-
-class PHP_Token_ENCAPSED_AND_WHITESPACE extends PHP_Token
-{
-}
-
-class PHP_Token_ENDDECLARE extends PHP_Token
-{
-}
-
-class PHP_Token_ENDFOR extends PHP_Token
-{
-}
-
-class PHP_Token_ENDFOREACH extends PHP_Token
-{
-}
-
-class PHP_Token_ENDIF extends PHP_Token
-{
-}
-
-class PHP_Token_ENDSWITCH extends PHP_Token
-{
-}
-
-class PHP_Token_ENDWHILE extends PHP_Token
-{
-}
-
-class PHP_Token_END_HEREDOC extends PHP_Token
-{
-}
-
-class PHP_Token_EQUAL extends PHP_Token
-{
-}
-
-class PHP_Token_EVAL extends PHP_Token
-{
-}
-
-class PHP_Token_EXCLAMATION_MARK extends PHP_Token
-{
-}
-
-class PHP_Token_EXIT extends PHP_Token
-{
-}
-
-class PHP_Token_EXTENDS extends PHP_Token
-{
-}
-
-class PHP_Token_FILE extends PHP_Token
-{
-}
-
-class PHP_Token_FINAL extends PHP_Token
-{
-}
-
-class PHP_Token_FOR extends PHP_Token
-{
-}
-
-class PHP_Token_FOREACH extends PHP_Token
-{
-}
-
-class PHP_Token_FUNC_C extends PHP_Token
-{
-}
-
-class PHP_Token_GLOBAL extends PHP_Token
-{
-}
-
-class PHP_Token_GT extends PHP_Token
-{
-}
-
-class PHP_Token_IF extends PHP_Token
-{
-}
-
-class PHP_Token_IMPLEMENTS extends PHP_Token
-{
-}
-
-class PHP_Token_INC extends PHP_Token
-{
-}
-
-class PHP_Token_INCLUDE extends PHP_Token_Includes
-{
-}
-
-class PHP_Token_INCLUDE_ONCE extends PHP_Token_Includes
-{
-}
-
-class PHP_Token_INLINE_HTML extends PHP_Token
-{
-}
-
-class PHP_Token_INSTANCEOF extends PHP_Token
-{
-}
-
-class PHP_Token_INT_CAST extends PHP_Token
-{
-}
-
-class PHP_Token_ISSET extends PHP_Token
-{
-}
-
-class PHP_Token_IS_EQUAL extends PHP_Token
-{
-}
-
-class PHP_Token_IS_GREATER_OR_EQUAL extends PHP_Token
-{
-}
-
-class PHP_Token_IS_IDENTICAL extends PHP_Token
-{
-}
-
-class PHP_Token_IS_NOT_EQUAL extends PHP_Token
-{
-}
-
-class PHP_Token_IS_NOT_IDENTICAL extends PHP_Token
-{
-}
-
-class PHP_Token_IS_SMALLER_OR_EQUAL extends PHP_Token
-{
-}
-
-class PHP_Token_LINE extends PHP_Token
-{
-}
-
-class PHP_Token_LIST extends PHP_Token
-{
-}
-
-class PHP_Token_LNUMBER extends PHP_Token
-{
-}
-
-class PHP_Token_LOGICAL_AND extends PHP_Token
-{
-}
-
-class PHP_Token_LOGICAL_OR extends PHP_Token
-{
-}
-
-class PHP_Token_LOGICAL_XOR extends PHP_Token
-{
-}
-
-class PHP_Token_LT extends PHP_Token
-{
-}
-
-class PHP_Token_METHOD_C extends PHP_Token
-{
-}
-
-class PHP_Token_MINUS extends PHP_Token
-{
-}
-
-class PHP_Token_MINUS_EQUAL extends PHP_Token
-{
-}
-
-class PHP_Token_MOD_EQUAL extends PHP_Token
-{
-}
-
-class PHP_Token_MULT extends PHP_Token
-{
-}
-
-class PHP_Token_MUL_EQUAL extends PHP_Token
-{
-}
-
-class PHP_Token_NEW extends PHP_Token
-{
-}
-
-class PHP_Token_NUM_STRING extends PHP_Token
-{
-}
-
-class PHP_Token_OBJECT_CAST extends PHP_Token
-{
-}
-
-class PHP_Token_OBJECT_OPERATOR extends PHP_Token
-{
-}
-
-class PHP_Token_OPEN_BRACKET extends PHP_Token
-{
-}
-
-class PHP_Token_OPEN_CURLY extends PHP_Token
-{
-}
-
-class PHP_Token_OPEN_SQUARE extends PHP_Token
-{
-}
-
-class PHP_Token_OPEN_TAG extends PHP_Token
-{
-}
-
-class PHP_Token_OPEN_TAG_WITH_ECHO extends PHP_Token
-{
-}
-
-class PHP_Token_OR_EQUAL extends PHP_Token
-{
-}
-
-class PHP_Token_PAAMAYIM_NEKUDOTAYIM extends PHP_Token
-{
-}
-
-class PHP_Token_PERCENT extends PHP_Token
-{
-}
-
-class PHP_Token_PIPE extends PHP_Token
-{
-}
-
-class PHP_Token_PLUS extends PHP_Token
-{
-}
-
-class PHP_Token_PLUS_EQUAL extends PHP_Token
-{
-}
-
-class PHP_Token_PRINT extends PHP_Token
-{
-}
-
-class PHP_Token_PRIVATE extends PHP_Token
-{
-}
-
-class PHP_Token_PROTECTED extends PHP_Token
-{
-}
-
-class PHP_Token_PUBLIC extends PHP_Token
-{
-}
-
-class PHP_Token_QUESTION_MARK extends PHP_Token
-{
-}
-
-class PHP_Token_REQUIRE extends PHP_Token_Includes
-{
-}
-
-class PHP_Token_REQUIRE_ONCE extends PHP_Token_Includes
-{
-}
-
-class PHP_Token_RETURN extends PHP_Token
-{
-}
-
-class PHP_Token_SEMICOLON extends PHP_Token
-{
-}
-
-class PHP_Token_SL extends PHP_Token
-{
-}
-
-class PHP_Token_SL_EQUAL extends PHP_Token
-{
-}
-
-class PHP_Token_SR extends PHP_Token
-{
-}
-
-class PHP_Token_SR_EQUAL extends PHP_Token
-{
-}
-
-class PHP_Token_START_HEREDOC extends PHP_Token
-{
-}
-
-class PHP_Token_STATIC extends PHP_Token
-{
-}
-
-class PHP_Token_STRING extends PHP_Token
-{
-}
-
-class PHP_Token_STRING_CAST extends PHP_Token
-{
-}
-
-class PHP_Token_STRING_VARNAME extends PHP_Token
-{
-}
-
-class PHP_Token_SWITCH extends PHP_Token
-{
-}
-
-class PHP_Token_THROW extends PHP_Token
-{
-}
-
-class PHP_Token_TILDE extends PHP_Token
-{
-}
-
-class PHP_Token_TRY extends PHP_Token
-{
-}
-
-class PHP_Token_UNSET extends PHP_Token
-{
-}
-
-class PHP_Token_UNSET_CAST extends PHP_Token
-{
-}
-
-class PHP_Token_USE extends PHP_Token
-{
-}
-
-class PHP_Token_USE_FUNCTION extends PHP_Token
-{
-}
-
-class PHP_Token_VAR extends PHP_Token
-{
-}
-
-class PHP_Token_VARIABLE extends PHP_Token
-{
-}
-
-class PHP_Token_WHILE extends PHP_Token
-{
-}
-
-class PHP_Token_WHITESPACE extends PHP_Token
-{
-}
-
-class PHP_Token_XOR_EQUAL extends PHP_Token
-{
-}
-
-// Tokens introduced in PHP 5.1
-class PHP_Token_HALT_COMPILER extends PHP_Token
-{
-}
-
-// Tokens introduced in PHP 5.3
-class PHP_Token_DIR extends PHP_Token
-{
-}
-
-class PHP_Token_GOTO extends PHP_Token
-{
-}
-
-class PHP_Token_NAMESPACE extends PHP_TokenWithScope
-{
- /**
- * @return string
- */
- public function getName()
- {
- $tokens = $this->tokenStream->tokens();
- $namespace = (string) $tokens[$this->id + 2];
-
- for ($i = $this->id + 3;; $i += 2) {
- if (isset($tokens[$i]) &&
- $tokens[$i] instanceof PHP_Token_NS_SEPARATOR) {
- $namespace .= '\\' . $tokens[$i + 1];
- } else {
- break;
- }
- }
-
- return $namespace;
- }
-}
-
-class PHP_Token_NS_C extends PHP_Token
-{
-}
-
-class PHP_Token_NS_SEPARATOR extends PHP_Token
-{
-}
-
-// Tokens introduced in PHP 5.4
-class PHP_Token_CALLABLE extends PHP_Token
-{
-}
-
-class PHP_Token_INSTEADOF extends PHP_Token
-{
-}
-
-class PHP_Token_TRAIT extends PHP_Token_INTERFACE
-{
-}
-
-class PHP_Token_TRAIT_C extends PHP_Token
-{
-}
-
-// Tokens introduced in PHP 5.5
-class PHP_Token_FINALLY extends PHP_Token
-{
-}
-
-class PHP_Token_YIELD extends PHP_Token
-{
-}
-
-// Tokens introduced in PHP 5.6
-class PHP_Token_ELLIPSIS extends PHP_Token
-{
-}
-
-class PHP_Token_POW extends PHP_Token
-{
-}
-
-class PHP_Token_POW_EQUAL extends PHP_Token
-{
-}
-
-// Tokens introduced in PHP 7.0
-class PHP_Token_COALESCE extends PHP_Token
-{
-}
-
-class PHP_Token_SPACESHIP extends PHP_Token
-{
-}
-
-class PHP_Token_YIELD_FROM extends PHP_Token
-{
-}
-
-// Tokens introduced in PHP 7.4
-class PHP_Token_COALESCE_EQUAL extends PHP_Token
-{
-}
-
-class PHP_Token_FN extends PHP_Token
-{
-}
diff -Nru php-token-stream-3.1.1/src/TokenWithScopeAndVisibility.php php-token-stream-4.0.4/src/TokenWithScopeAndVisibility.php
--- php-token-stream-3.1.1/src/TokenWithScopeAndVisibility.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/TokenWithScopeAndVisibility.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,67 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+abstract class PHP_TokenWithScopeAndVisibility extends PHP_TokenWithScope
+{
+ /**
+ * @return string
+ */
+ public function getVisibility()
+ {
+ $tokens = $this->tokenStream->tokens();
+
+ for ($i = $this->id - 2; $i > $this->id - 7; $i -= 2) {
+ if (isset($tokens[$i]) &&
+ ($tokens[$i] instanceof PHP_Token_PRIVATE ||
+ $tokens[$i] instanceof PHP_Token_PROTECTED ||
+ $tokens[$i] instanceof PHP_Token_PUBLIC)) {
+ return \strtolower(
+ \str_replace('PHP_Token_', '', PHP_Token_Util::getClass($tokens[$i]))
+ );
+ }
+
+ if (isset($tokens[$i]) &&
+ !($tokens[$i] instanceof PHP_Token_STATIC ||
+ $tokens[$i] instanceof PHP_Token_FINAL ||
+ $tokens[$i] instanceof PHP_Token_ABSTRACT)) {
+ // no keywords; stop visibility search
+ break;
+ }
+ }
+ }
+
+ /**
+ * @return string
+ */
+ public function getKeywords()
+ {
+ $keywords = [];
+ $tokens = $this->tokenStream->tokens();
+
+ for ($i = $this->id - 2; $i > $this->id - 7; $i -= 2) {
+ if (isset($tokens[$i]) &&
+ ($tokens[$i] instanceof PHP_Token_PRIVATE ||
+ $tokens[$i] instanceof PHP_Token_PROTECTED ||
+ $tokens[$i] instanceof PHP_Token_PUBLIC)) {
+ continue;
+ }
+
+ if (isset($tokens[$i]) &&
+ ($tokens[$i] instanceof PHP_Token_STATIC ||
+ $tokens[$i] instanceof PHP_Token_FINAL ||
+ $tokens[$i] instanceof PHP_Token_ABSTRACT)) {
+ $keywords[] = \strtolower(
+ \str_replace('PHP_Token_', '', PHP_Token_Util::getClass($tokens[$i]))
+ );
+ }
+ }
+
+ return \implode(',', $keywords);
+ }
+}
diff -Nru php-token-stream-3.1.1/src/TokenWithScope.php php-token-stream-4.0.4/src/TokenWithScope.php
--- php-token-stream-3.1.1/src/TokenWithScope.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/TokenWithScope.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,107 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+abstract class PHP_TokenWithScope extends PHP_Token
+{
+ /**
+ * @var int
+ */
+ protected $endTokenId;
+
+ /**
+ * Get the docblock for this token.
+ *
+ * This method will fetch the docblock belonging to the current token. The
+ * docblock must be placed on the line directly above the token to be
+ * recognized.
+ *
+ * @return null|string Returns the docblock as a string if found
+ */
+ public function getDocblock()
+ {
+ $tokens = $this->tokenStream->tokens();
+ $currentLineNumber = $tokens[$this->id]->getLine();
+ $prevLineNumber = $currentLineNumber - 1;
+
+ for ($i = $this->id - 1; $i; $i--) {
+ if (!isset($tokens[$i])) {
+ return;
+ }
+
+ if ($tokens[$i] instanceof PHP_Token_FUNCTION ||
+ $tokens[$i] instanceof PHP_Token_CLASS ||
+ $tokens[$i] instanceof PHP_Token_TRAIT) {
+ // Some other trait, class or function, no docblock can be
+ // used for the current token
+ break;
+ }
+
+ $line = $tokens[$i]->getLine();
+
+ if ($line == $currentLineNumber ||
+ ($line == $prevLineNumber &&
+ $tokens[$i] instanceof PHP_Token_WHITESPACE)) {
+ continue;
+ }
+
+ if ($line < $currentLineNumber &&
+ !$tokens[$i] instanceof PHP_Token_DOC_COMMENT) {
+ break;
+ }
+
+ return (string) $tokens[$i];
+ }
+ }
+
+ /**
+ * @return int
+ */
+ public function getEndTokenId()
+ {
+ $block = 0;
+ $i = $this->id;
+ $tokens = $this->tokenStream->tokens();
+
+ while ($this->endTokenId === null && isset($tokens[$i])) {
+ if ($tokens[$i] instanceof PHP_Token_OPEN_CURLY ||
+ $tokens[$i] instanceof PHP_Token_DOLLAR_OPEN_CURLY_BRACES ||
+ $tokens[$i] instanceof PHP_Token_CURLY_OPEN) {
+ $block++;
+ } elseif ($tokens[$i] instanceof PHP_Token_CLOSE_CURLY) {
+ $block--;
+
+ if ($block === 0) {
+ $this->endTokenId = $i;
+ }
+ } elseif (($this instanceof PHP_Token_FUNCTION ||
+ $this instanceof PHP_Token_NAMESPACE) &&
+ $tokens[$i] instanceof PHP_Token_SEMICOLON) {
+ if ($block === 0) {
+ $this->endTokenId = $i;
+ }
+ }
+
+ $i++;
+ }
+
+ if ($this->endTokenId === null) {
+ $this->endTokenId = $this->id;
+ }
+
+ return $this->endTokenId;
+ }
+
+ /**
+ * @return int
+ */
+ public function getEndLine()
+ {
+ return $this->tokenStream[$this->getEndTokenId()]->getLine();
+ }
+}
diff -Nru php-token-stream-3.1.1/src/TraitC.php php-token-stream-4.0.4/src/TraitC.php
--- php-token-stream-3.1.1/src/TraitC.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/TraitC.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_TRAIT_C extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/Trait.php php-token-stream-4.0.4/src/Trait.php
--- php-token-stream-3.1.1/src/Trait.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Trait.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_TRAIT extends PHP_Token_INTERFACE
+{
+}
diff -Nru php-token-stream-3.1.1/src/Try.php php-token-stream-4.0.4/src/Try.php
--- php-token-stream-3.1.1/src/Try.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Try.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_TRY extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/UnsetCast.php php-token-stream-4.0.4/src/UnsetCast.php
--- php-token-stream-3.1.1/src/UnsetCast.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/UnsetCast.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_UNSET_CAST extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/Unset.php php-token-stream-4.0.4/src/Unset.php
--- php-token-stream-3.1.1/src/Unset.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Unset.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_UNSET extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/UseFunction.php php-token-stream-4.0.4/src/UseFunction.php
--- php-token-stream-3.1.1/src/UseFunction.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/UseFunction.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_USE_FUNCTION extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/Use.php php-token-stream-4.0.4/src/Use.php
--- php-token-stream-3.1.1/src/Use.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Use.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_USE extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/Util.php php-token-stream-4.0.4/src/Util.php
--- php-token-stream-3.1.1/src/Util.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Util.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,18 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+final class PHP_Token_Util
+{
+ public static function getClass($object): string
+ {
+ $parts = \explode('\\', \get_class($object));
+
+ return \array_pop($parts);
+ }
+}
diff -Nru php-token-stream-3.1.1/src/Variable.php php-token-stream-4.0.4/src/Variable.php
--- php-token-stream-3.1.1/src/Variable.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Variable.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_VARIABLE extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/Var.php php-token-stream-4.0.4/src/Var.php
--- php-token-stream-3.1.1/src/Var.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Var.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_VAR extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/While.php php-token-stream-4.0.4/src/While.php
--- php-token-stream-3.1.1/src/While.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/While.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_WHILE extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/Whitespace.php php-token-stream-4.0.4/src/Whitespace.php
--- php-token-stream-3.1.1/src/Whitespace.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Whitespace.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_WHITESPACE extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/XorEqual.php php-token-stream-4.0.4/src/XorEqual.php
--- php-token-stream-3.1.1/src/XorEqual.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/XorEqual.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_XOR_EQUAL extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/YieldFrom.php php-token-stream-4.0.4/src/YieldFrom.php
--- php-token-stream-3.1.1/src/YieldFrom.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/YieldFrom.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_YIELD_FROM extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/src/Yield.php php-token-stream-4.0.4/src/Yield.php
--- php-token-stream-3.1.1/src/Yield.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/src/Yield.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,12 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+class PHP_Token_YIELD extends PHP_Token
+{
+}
diff -Nru php-token-stream-3.1.1/tests/bootstrap.php php-token-stream-4.0.4/tests/bootstrap.php
--- php-token-stream-3.1.1/tests/bootstrap.php 2019-09-17 06:23:10.000000000 +0000
+++ php-token-stream-4.0.4/tests/bootstrap.php 2020-08-17 16:46:03.000000000 +0000
@@ -1,6 +1,6 @@
-
*
@@ -9,7 +9,7 @@
*/
require __DIR__ . '/../vendor/autoload.php';
-define(
+\define(
'TEST_FILES_PATH',
- __DIR__ . DIRECTORY_SEPARATOR . '_fixture' . DIRECTORY_SEPARATOR
+ __DIR__ . \DIRECTORY_SEPARATOR . '_fixture' . \DIRECTORY_SEPARATOR
);
diff -Nru php-token-stream-3.1.1/tests/_fixture/issue93.php php-token-stream-4.0.4/tests/_fixture/issue93.php
--- php-token-stream-3.1.1/tests/_fixture/issue93.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/tests/_fixture/issue93.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,34 @@
+field = $field;
+ }
+
+ public function funcOne(): int
+ {
+ return $this->field;
+ }
+
+ public function funcTwo(): int
+ {
+ $cls = new class(42) {
+ private $num;
+
+ public function __construct(int $num)
+ {
+ $this->num = $num;
+ }
+
+ public function getNum(): int
+ {
+ return $this->num;
+ }
+ };
+
+ return $cls->getNum();
+ }
+}
diff -Nru php-token-stream-3.1.1/tests/_fixture/issue_95.php php-token-stream-4.0.4/tests/_fixture/issue_95.php
--- php-token-stream-3.1.1/tests/_fixture/issue_95.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/tests/_fixture/issue_95.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,9 @@
+
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
-
use PHPUnit\Framework\TestCase;
class PHP_Token_ClassTest extends TestCase
@@ -22,7 +21,7 @@
*/
private $function;
- protected function setUp()
+ protected function setUp(): void
{
foreach (new PHP_Token_Stream(TEST_FILES_PATH . 'source2.php') as $token) {
if ($token instanceof PHP_Token_CLASS) {
@@ -31,27 +30,28 @@
if ($token instanceof PHP_Token_FUNCTION) {
$this->function = $token;
+
break;
}
}
}
- public function testGetClassKeywords()
+ public function testGetClassKeywords(): void
{
$this->assertEquals('abstract', $this->class->getKeywords());
}
- public function testGetFunctionKeywords()
+ public function testGetFunctionKeywords(): void
{
$this->assertEquals('abstract,static', $this->function->getKeywords());
}
- public function testGetFunctionVisibility()
+ public function testGetFunctionVisibility(): void
{
$this->assertEquals('public', $this->function->getVisibility());
}
- public function testIssue19()
+ public function testIssue19(): void
{
foreach (new PHP_Token_Stream(TEST_FILES_PATH . 'issue19.php') as $token) {
if ($token instanceof PHP_Token_CLASS) {
@@ -60,13 +60,13 @@
}
}
- public function testIssue30()
+ public function testIssue30(): void
{
$ts = new PHP_Token_Stream(TEST_FILES_PATH . 'issue30.php');
$this->assertCount(1, $ts->getClasses());
}
- public function testAnonymousClassesAreHandledCorrectly()
+ public function testAnonymousClassesAreHandledCorrectly(): void
{
$ts = new PHP_Token_Stream(TEST_FILES_PATH . 'class_with_method_that_declares_anonymous_class.php');
@@ -79,28 +79,28 @@
'AnonymousClass:10#55',
'AnonymousClass:11#75',
'AnonymousClass:12#91',
- 'AnonymousClass:13#107'
+ 'AnonymousClass:13#107',
],
- array_keys($classes)
+ \array_keys($classes)
);
}
/**
* @ticket https://github.com/sebastianbergmann/php-token-stream/issues/52
*/
- public function testAnonymousClassesAreHandledCorrectly2()
+ public function testAnonymousClassesAreHandledCorrectly2(): void
{
$ts = new PHP_Token_Stream(TEST_FILES_PATH . 'class_with_method_that_declares_anonymous_class2.php');
$classes = $ts->getClasses();
- $this->assertEquals(['Test', 'AnonymousClass:4#23'], array_keys($classes));
- $this->assertEquals(['methodOne', 'methodTwo'], array_keys($classes['Test']['methods']));
+ $this->assertEquals(['Test', 'AnonymousClass:4#23'], \array_keys($classes));
+ $this->assertEquals(['methodOne', 'methodTwo'], \array_keys($classes['Test']['methods']));
$this->assertEmpty($ts->getFunctions());
}
- public function testImportedFunctionsAreHandledCorrectly()
+ public function testImportedFunctionsAreHandledCorrectly(): void
{
$ts = new PHP_Token_Stream(TEST_FILES_PATH . 'classUsesNamespacedFunction.php');
@@ -111,7 +111,7 @@
/**
* @ticket https://github.com/sebastianbergmann/php-code-coverage/issues/543
*/
- public function testClassWithMultipleAnonymousClassesAndFunctionsIsHandledCorrectly()
+ public function testClassWithMultipleAnonymousClassesAndFunctionsIsHandledCorrectly(): void
{
$ts = new PHP_Token_Stream(TEST_FILES_PATH . 'class_with_multiple_anonymous_classes_and_functions.php');
@@ -128,7 +128,7 @@
/**
* @ticket https://github.com/sebastianbergmann/php-token-stream/issues/68
*/
- public function testClassWithMethodNamedEmptyIsHandledCorrectly()
+ public function testClassWithMethodNamedEmptyIsHandledCorrectly(): void
{
$classes = (new PHP_Token_Stream(TEST_FILES_PATH . 'class_with_method_named_empty.php'))->getClasses();
@@ -139,7 +139,7 @@
/**
* @ticket https://github.com/sebastianbergmann/php-code-coverage/issues/424
*/
- public function testAnonymousFunctionDoesNotAffectStartAndEndLineOfMethod()
+ public function testAnonymousFunctionDoesNotAffectStartAndEndLineOfMethod(): void
{
$classes = (new PHP_Token_Stream(TEST_FILES_PATH . 'php-code-coverage-issue-424.php'))->getClasses();
@@ -149,4 +149,36 @@
$this->assertSame(7, $classes['Example']['methods']['anonymousFunction:7#28']['startLine']);
$this->assertSame(9, $classes['Example']['methods']['anonymousFunction:7#28']['endLine']);
}
+
+ /**
+ * @ticket https://github.com/sebastianbergmann/php-token-stream/issues/93
+ */
+ public function testClassWithAnonymousClassIsHandledCorrectly(): void
+ {
+ $tokens = new PHP_Token_Stream(TEST_FILES_PATH . 'issue93.php');
+
+ $this->assertCount(0, $tokens->getInterfaces());
+ $this->assertCount(0, $tokens->getTraits());
+ $this->assertCount(0, $tokens->getFunctions());
+
+ $classes = $tokens->getClasses();
+
+ $this->assertCount(1, $classes);
+ $this->assertArrayHasKey('PhpAnonym', $classes);
+ $this->assertSame(2, $classes['PhpAnonym']['startLine']);
+ $this->assertSame(34, $classes['PhpAnonym']['endLine']);
+ $this->assertCount(3, $classes['PhpAnonym']['methods']);
+
+ $this->assertArrayHasKey('__construct', $classes['PhpAnonym']['methods']);
+ $this->assertSame(6, $classes['PhpAnonym']['methods']['__construct']['startLine']);
+ $this->assertSame(9, $classes['PhpAnonym']['methods']['__construct']['endLine']);
+
+ $this->assertArrayHasKey('funcOne', $classes['PhpAnonym']['methods']);
+ $this->assertSame(11, $classes['PhpAnonym']['methods']['funcOne']['startLine']);
+ $this->assertSame(14, $classes['PhpAnonym']['methods']['funcOne']['endLine']);
+
+ $this->assertArrayHasKey('funcTwo', $classes['PhpAnonym']['methods']);
+ $this->assertSame(16, $classes['PhpAnonym']['methods']['funcTwo']['startLine']);
+ $this->assertSame(33, $classes['PhpAnonym']['methods']['funcTwo']['endLine']);
+ }
}
diff -Nru php-token-stream-3.1.1/tests/Token/ClosureTest.php php-token-stream-4.0.4/tests/Token/ClosureTest.php
--- php-token-stream-3.1.1/tests/Token/ClosureTest.php 2019-09-17 06:23:10.000000000 +0000
+++ php-token-stream-4.0.4/tests/Token/ClosureTest.php 2020-08-17 16:46:03.000000000 +0000
@@ -1,13 +1,12 @@
-
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
-
use PHPUnit\Framework\TestCase;
class PHP_Token_ClosureTest extends TestCase
@@ -17,7 +16,7 @@
*/
private $functions;
- protected function setUp()
+ protected function setUp(): void
{
foreach (new PHP_Token_Stream(TEST_FILES_PATH . 'closure.php') as $token) {
if ($token instanceof PHP_Token_FUNCTION) {
@@ -26,7 +25,7 @@
}
}
- public function testGetArguments()
+ public function testGetArguments(): void
{
$this->assertEquals(['$foo' => null, '$bar' => null], $this->functions[0]->getArguments());
$this->assertEquals(['$foo' => 'Foo', '$bar' => null], $this->functions[1]->getArguments());
@@ -36,7 +35,7 @@
$this->assertEquals([], $this->functions[5]->getArguments());
}
- public function testGetName()
+ public function testGetName(): void
{
$this->assertEquals('anonymousFunction:2#5', $this->functions[0]->getName());
$this->assertEquals('anonymousFunction:3#27', $this->functions[1]->getName());
@@ -46,7 +45,7 @@
$this->assertEquals('anonymousFunction:7#106', $this->functions[5]->getName());
}
- public function testGetLine()
+ public function testGetLine(): void
{
$this->assertEquals(2, $this->functions[0]->getLine());
$this->assertEquals(3, $this->functions[1]->getLine());
@@ -54,7 +53,7 @@
$this->assertEquals(5, $this->functions[3]->getLine());
}
- public function testGetEndLine()
+ public function testGetEndLine(): void
{
$this->assertEquals(2, $this->functions[0]->getLine());
$this->assertEquals(3, $this->functions[1]->getLine());
diff -Nru php-token-stream-3.1.1/tests/Token/CommentTest.php php-token-stream-4.0.4/tests/Token/CommentTest.php
--- php-token-stream-3.1.1/tests/Token/CommentTest.php 1970-01-01 00:00:00.000000000 +0000
+++ php-token-stream-4.0.4/tests/Token/CommentTest.php 2020-08-17 16:46:03.000000000 +0000
@@ -0,0 +1,86 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+use PHPUnit\Framework\TestCase;
+
+final class PHP_Token_CommentTest extends TestCase
+{
+ /**
+ * @see https://github.com/sebastianbergmann/php-token-stream/issues/95
+ */
+ public function testIssue95(): void
+ {
+ $tokens = new PHP_Token_Stream(TEST_FILES_PATH . 'issue_95.php');
+
+ $this->assertCount(33, $tokens);
+ $this->assertSame(9, $tokens->getLinesOfCode()['loc']);
+ $this->assertSame(4, $tokens->getLinesOfCode()['cloc']);
+ $this->assertSame(5, $tokens->getLinesOfCode()['ncloc']);
+
+ foreach ($tokens as $token) {
+ switch ($token->getId()) {
+ case 17:
+ $this->assertSame(3, $token->getLine());
+ $this->assertInstanceOf(PHP_Token_COMMENT::class, $token);
+ $this->assertSame("// @codeCoverageIgnoreStart\n", (string) $token);
+
+ break;
+
+ case 18:
+ $this->assertSame(4, $token->getLine());
+ $this->assertInstanceOf(PHP_Token_WHITESPACE::class, $token);
+ $this->assertSame(' ', (string) $token);
+
+ break;
+
+ case 19:
+ $this->assertSame(4, $token->getLine());
+ $this->assertInstanceOf(PHP_Token_COMMENT::class, $token);
+ $this->assertSame("# ...\n", (string) $token);
+
+ break;
+
+ case 20:
+ $this->assertSame(5, $token->getLine());
+ $this->assertInstanceOf(PHP_Token_WHITESPACE::class, $token);
+ $this->assertSame(' ', (string) $token);
+
+ break;
+
+ case 21:
+ $this->assertSame(5, $token->getLine());
+ $this->assertInstanceOf(PHP_Token_COMMENT::class, $token);
+ $this->assertSame("// @codeCoverageIgnoreEnd\n", (string) $token);
+
+ break;
+
+ case 22:
+ $this->assertSame(6, $token->getLine());
+ $this->assertInstanceOf(PHP_Token_CLOSE_CURLY::class, $token);
+ $this->assertSame('}', (string) $token);
+
+ break;
+
+ case 24:
+ $this->assertSame(8, $token->getLine());
+ $this->assertInstanceOf(PHP_Token_COMMENT::class, $token);
+ $this->assertSame('/* a one-line comment */', (string) $token);
+
+ break;
+
+ case 31:
+ $this->assertSame(9, $token->getLine());
+ $this->assertInstanceOf(PHP_Token_COMMENT::class, $token);
+ $this->assertSame('/* a one-line comment */', (string) $token);
+
+ break;
+ }
+ }
+ }
+}
diff -Nru php-token-stream-3.1.1/tests/Token/FunctionTest.php php-token-stream-4.0.4/tests/Token/FunctionTest.php
--- php-token-stream-3.1.1/tests/Token/FunctionTest.php 2019-09-17 06:23:10.000000000 +0000
+++ php-token-stream-4.0.4/tests/Token/FunctionTest.php 2020-08-17 16:46:03.000000000 +0000
@@ -1,13 +1,12 @@
-
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
-
use PHPUnit\Framework\TestCase;
class PHP_Token_FunctionTest extends TestCase
@@ -17,7 +16,7 @@
*/
private $functions;
- protected function setUp()
+ protected function setUp(): void
{
foreach (new PHP_Token_Stream(TEST_FILES_PATH . 'source.php') as $token) {
if ($token instanceof PHP_Token_FUNCTION) {
@@ -26,20 +25,23 @@
}
}
- public function testGetArguments()
+ public function testGetArguments(): void
{
$this->assertEquals([], $this->functions[0]->getArguments());
$this->assertEquals(
- ['$baz' => 'Baz'], $this->functions[1]->getArguments()
+ ['$baz' => 'Baz'],
+ $this->functions[1]->getArguments()
);
$this->assertEquals(
- ['$foobar' => 'Foobar'], $this->functions[2]->getArguments()
+ ['$foobar' => 'Foobar'],
+ $this->functions[2]->getArguments()
);
$this->assertEquals(
- ['$barfoo' => 'Barfoo'], $this->functions[3]->getArguments()
+ ['$barfoo' => 'Barfoo'],
+ $this->functions[3]->getArguments()
);
$this->assertEquals([], $this->functions[4]->getArguments());
@@ -47,7 +49,7 @@
$this->assertEquals(['$x' => null, '$y' => null], $this->functions[5]->getArguments());
}
- public function testGetName()
+ public function testGetName(): void
{
$this->assertEquals('foo', $this->functions[0]->getName());
$this->assertEquals('bar', $this->functions[1]->getName());
@@ -56,7 +58,7 @@
$this->assertEquals('baz', $this->functions[4]->getName());
}
- public function testGetLine()
+ public function testGetLine(): void
{
$this->assertEquals(5, $this->functions[0]->getLine());
$this->assertEquals(10, $this->functions[1]->getLine());
@@ -66,7 +68,7 @@
$this->assertEquals(37, $this->functions[6]->getLine());
}
- public function testGetEndLine()
+ public function testGetEndLine(): void
{
$this->assertEquals(5, $this->functions[0]->getEndLine());
$this->assertEquals(12, $this->functions[1]->getEndLine());
@@ -76,7 +78,7 @@
$this->assertEquals(41, $this->functions[6]->getEndLine());
}
- public function testGetDocblock()
+ public function testGetDocblock(): void
{
$this->assertNull($this->functions[0]->getDocblock());
@@ -94,7 +96,7 @@
$this->assertNull($this->functions[4]->getDocblock());
}
- public function testSignature()
+ public function testSignature(): void
{
$tokens = new PHP_Token_Stream(TEST_FILES_PATH . 'source5.php');
$functions = $tokens->getFunctions();
diff -Nru php-token-stream-3.1.1/tests/Token/IncludeTest.php php-token-stream-4.0.4/tests/Token/IncludeTest.php
--- php-token-stream-3.1.1/tests/Token/IncludeTest.php 2019-09-17 06:23:10.000000000 +0000
+++ php-token-stream-4.0.4/tests/Token/IncludeTest.php 2020-08-17 16:46:03.000000000 +0000
@@ -1,13 +1,12 @@
-
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
-
use PHPUnit\Framework\TestCase;
class PHP_Token_IncludeTest extends TestCase
@@ -17,12 +16,12 @@
*/
private $ts;
- protected function setUp()
+ protected function setUp(): void
{
$this->ts = new PHP_Token_Stream(TEST_FILES_PATH . 'source3.php');
}
- public function testGetIncludes()
+ public function testGetIncludes(): void
{
$this->assertSame(
['test4.php', 'test3.php', 'test2.php', 'test1.php'],
@@ -30,20 +29,20 @@
);
}
- public function testGetIncludesCategorized()
+ public function testGetIncludesCategorized(): void
{
$this->assertSame(
[
'require_once' => ['test4.php'],
'require' => ['test3.php'],
'include_once' => ['test2.php'],
- 'include' => ['test1.php']
+ 'include' => ['test1.php'],
],
$this->ts->getIncludes(true)
);
}
- public function testGetIncludesCategory()
+ public function testGetIncludesCategory(): void
{
$this->assertSame(
['test4.php'],
diff -Nru php-token-stream-3.1.1/tests/Token/InterfaceTest.php php-token-stream-4.0.4/tests/Token/InterfaceTest.php
--- php-token-stream-3.1.1/tests/Token/InterfaceTest.php 2019-09-17 06:23:10.000000000 +0000
+++ php-token-stream-4.0.4/tests/Token/InterfaceTest.php 2020-08-17 16:46:03.000000000 +0000
@@ -1,13 +1,12 @@
-
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
-
use PHPUnit\Framework\TestCase;
class PHP_Token_InterfaceTest extends TestCase
@@ -22,7 +21,7 @@
*/
private $interfaces;
- protected function setUp()
+ protected function setUp(): void
{
$ts = new PHP_Token_Stream(TEST_FILES_PATH . 'source4.php');
$i = 0;
@@ -37,42 +36,44 @@
}
}
- public function testGetName()
+ public function testGetName(): void
{
$this->assertEquals(
- 'iTemplate', $this->interfaces[0]->getName()
+ 'iTemplate',
+ $this->interfaces[0]->getName()
);
}
- public function testGetParentNotExists()
+ public function testGetParentNotExists(): void
{
$this->assertFalse(
$this->interfaces[0]->getParent()
);
}
- public function testHasParentNotExists()
+ public function testHasParentNotExists(): void
{
$this->assertFalse(
$this->interfaces[0]->hasParent()
);
}
- public function testGetParentExists()
+ public function testGetParentExists(): void
{
$this->assertEquals(
- 'a', $this->interfaces[2]->getParent()
+ 'a',
+ $this->interfaces[2]->getParent()
);
}
- public function testHasParentExists()
+ public function testHasParentExists(): void
{
$this->assertTrue(
$this->interfaces[2]->hasParent()
);
}
- public function testGetInterfacesExists()
+ public function testGetInterfacesExists(): void
{
$this->assertEquals(
['b'],
@@ -80,14 +81,14 @@
);
}
- public function testHasInterfacesExists()
+ public function testHasInterfacesExists(): void
{
$this->assertTrue(
$this->class->hasInterfaces()
);
}
- public function testGetPackageNamespace()
+ public function testGetPackageNamespace(): void
{
foreach (new PHP_Token_Stream(TEST_FILES_PATH . 'classInNamespace.php') as $token) {
if ($token instanceof PHP_Token_INTERFACE) {
@@ -108,7 +109,7 @@
/**
* @dataProvider provideFilesWithClassesWithinMultipleNamespaces
*/
- public function testGetPackageNamespaceForFileWithMultipleNamespaces($filepath)
+ public function testGetPackageNamespaceForFileWithMultipleNamespaces($filepath): void
{
$tokenStream = new PHP_Token_Stream($filepath);
$firstClassFound = false;
@@ -119,6 +120,7 @@
$this->assertSame('TestClassInBar', $token->getName());
$this->assertSame('Foo\\Bar', $package['namespace']);
$firstClassFound = true;
+
continue;
}
// Secound class
@@ -133,7 +135,7 @@
$this->fail('Searching for 2 classes failed');
}
- public function testGetPackageNamespaceIsEmptyForInterfacesThatAreNotWithinNamespaces()
+ public function testGetPackageNamespaceIsEmptyForInterfacesThatAreNotWithinNamespaces(): void
{
foreach ($this->interfaces as $token) {
$package = $token->getPackage();
@@ -141,7 +143,7 @@
}
}
- public function testGetPackageNamespaceWhenExtentingFromNamespaceClass()
+ public function testGetPackageNamespaceWhenExtentingFromNamespaceClass(): void
{
$tokenStream = new PHP_Token_Stream(TEST_FILES_PATH . 'classExtendsNamespacedClass.php');
$firstClassFound = false;
@@ -152,6 +154,7 @@
$this->assertSame('Baz', $token->getName());
$this->assertSame('Foo\\Bar', $package['namespace']);
$firstClassFound = true;
+
continue;
}
diff -Nru php-token-stream-3.1.1/tests/Token/NamespaceTest.php php-token-stream-4.0.4/tests/Token/NamespaceTest.php
--- php-token-stream-3.1.1/tests/Token/NamespaceTest.php 2019-09-17 06:23:10.000000000 +0000
+++ php-token-stream-4.0.4/tests/Token/NamespaceTest.php 2020-08-17 16:46:03.000000000 +0000
@@ -1,21 +1,20 @@
-
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
-
use PHPUnit\Framework\TestCase;
class PHP_Token_NamespaceTest extends TestCase
{
- public function testGetName()
+ public function testGetName(): void
{
$tokenStream = new PHP_Token_Stream(
- TEST_FILES_PATH . 'classInNamespace.php'
+ TEST_FILES_PATH . 'classInNamespace.php'
);
foreach ($tokenStream as $token) {
@@ -25,7 +24,7 @@
}
}
- public function testGetStartLineWithUnscopedNamespace()
+ public function testGetStartLineWithUnscopedNamespace(): void
{
foreach (new PHP_Token_Stream(TEST_FILES_PATH . 'classInNamespace.php') as $token) {
if ($token instanceof PHP_Token_NAMESPACE) {
@@ -34,7 +33,7 @@
}
}
- public function testGetEndLineWithUnscopedNamespace()
+ public function testGetEndLineWithUnscopedNamespace(): void
{
foreach (new PHP_Token_Stream(TEST_FILES_PATH . 'classInNamespace.php') as $token) {
if ($token instanceof PHP_Token_NAMESPACE) {
@@ -42,7 +41,8 @@
}
}
}
- public function testGetStartLineWithScopedNamespace()
+
+ public function testGetStartLineWithScopedNamespace(): void
{
foreach (new PHP_Token_Stream(TEST_FILES_PATH . 'classInScopedNamespace.php') as $token) {
if ($token instanceof PHP_Token_NAMESPACE) {
@@ -51,7 +51,7 @@
}
}
- public function testGetEndLineWithScopedNamespace()
+ public function testGetEndLineWithScopedNamespace(): void
{
foreach (new PHP_Token_Stream(TEST_FILES_PATH . 'classInScopedNamespace.php') as $token) {
if ($token instanceof PHP_Token_NAMESPACE) {
diff -Nru php-token-stream-3.1.1/.travis.yml php-token-stream-4.0.4/.travis.yml
--- php-token-stream-3.1.1/.travis.yml 2019-09-17 06:23:10.000000000 +0000
+++ php-token-stream-4.0.4/.travis.yml 1970-01-01 00:00:00.000000000 +0000
@@ -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
-