Skip to content

Commit

Permalink
Add PHP 7 parser class for improved PHP code parsing and syntax handling
Browse files Browse the repository at this point in the history
The commit adds the PHP 7 parser class (`Php7.php`) which provides core functionality for parsing PHP code according to PHP 7 syntax rules. This class includes:

- Token definitions and mapping
- Parser state management
- Grammar rules and actions
- AST node generation capabilities

This is part of the PHP-Parser library integration and helps ensure proper parsing of PHP 7 code constructs.
  • Loading branch information
N6REJ committed Dec 19, 2024
1 parent 7204b3f commit 3d6a5c1
Show file tree
Hide file tree
Showing 2,950 changed files with 265,214 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,4 @@
!/core/tmp/.gitignore
.codiumai
/core/resources/quickpick-releases.json
.qodo
20 changes: 20 additions & 0 deletions core/classes/rector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

declare(strict_types=1);

use Rector\Config\RectorConfig;

return RectorConfig::configure()
->withPaths([
__DIR__ . '/actions',
__DIR__ . '/apps',
__DIR__ . '/bins',
__DIR__ . '/tools',
__DIR__ . '/tpls',
])
->withoutParallel()
// uncomment to reach your current PHP version
->withPhpSets(php70: true)
->withTypeCoverageLevel(0)
->withDeadCodeLevel(0)
->withCodeQualityLevel(0);
25 changes: 25 additions & 0 deletions core/classes/vendor/autoload.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

// autoload.php @generated by Composer

if (PHP_VERSION_ID < 50600) {
if (!headers_sent()) {
header('HTTP/1.1 500 Internal Server Error');
}
$err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
if (!ini_get('display_errors')) {
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
fwrite(STDERR, $err);
} elseif (!headers_sent()) {
echo $err;
}
}
trigger_error(
$err,
E_USER_ERROR
);
}

require_once __DIR__ . '/composer/autoload_real.php';

return ComposerAutoloaderInit74e55f7e18b4a4585e2b8b8489feadfc::getLoader();
119 changes: 119 additions & 0 deletions core/classes/vendor/bin/phpstan
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
#!/usr/bin/env php
<?php

/**
* Proxy PHP file generated by Composer
*
* This file includes the referenced bin path (../phpstan/phpstan/phpstan)
* using a stream wrapper to prevent the shebang from being output on PHP<8
*
* @generated
*/

namespace Composer;

$GLOBALS['_composer_bin_dir'] = __DIR__;
$GLOBALS['_composer_autoload_path'] = __DIR__ . '/..'.'/autoload.php';

if (PHP_VERSION_ID < 80000) {
if (!class_exists('Composer\BinProxyWrapper')) {
/**
* @internal
*/
final class BinProxyWrapper
{
private $handle;
private $position;
private $realpath;

public function stream_open($path, $mode, $options, &$opened_path)
{
// get rid of phpvfscomposer:// prefix for __FILE__ & __DIR__ resolution
$opened_path = substr($path, 17);
$this->realpath = realpath($opened_path) ?: $opened_path;
$opened_path = $this->realpath;
$this->handle = fopen($this->realpath, $mode);
$this->position = 0;

return (bool) $this->handle;
}

public function stream_read($count)
{
$data = fread($this->handle, $count);

if ($this->position === 0) {
$data = preg_replace('{^#!.*\r?\n}', '', $data);
}

$this->position += strlen($data);

return $data;
}

public function stream_cast($castAs)
{
return $this->handle;
}

public function stream_close()
{
fclose($this->handle);
}

public function stream_lock($operation)
{
return $operation ? flock($this->handle, $operation) : true;
}

public function stream_seek($offset, $whence)
{
if (0 === fseek($this->handle, $offset, $whence)) {
$this->position = ftell($this->handle);
return true;
}

return false;
}

public function stream_tell()
{
return $this->position;
}

public function stream_eof()
{
return feof($this->handle);
}

public function stream_stat()
{
return array();
}

public function stream_set_option($option, $arg1, $arg2)
{
return true;
}

public function url_stat($path, $flags)
{
$path = substr($path, 17);
if (file_exists($path)) {
return stat($path);
}

return false;
}
}
}

if (
(function_exists('stream_get_wrappers') && in_array('phpvfscomposer', stream_get_wrappers(), true))
|| (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper'))
) {
return include("phpvfscomposer://" . __DIR__ . '/..'.'/phpstan/phpstan/phpstan');
}
}

return include __DIR__ . '/..'.'/phpstan/phpstan/phpstan';
5 changes: 5 additions & 0 deletions core/classes/vendor/bin/phpstan.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@ECHO OFF
setlocal DISABLEDELAYEDEXPANSION
SET BIN_TARGET=%~dp0/phpstan
SET COMPOSER_RUNTIME_BIN_DIR=%~dp0
php "%BIN_TARGET%" %*
119 changes: 119 additions & 0 deletions core/classes/vendor/bin/phpstan.phar
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
#!/usr/bin/env php
<?php

/**
* Proxy PHP file generated by Composer
*
* This file includes the referenced bin path (../phpstan/phpstan/phpstan.phar)
* using a stream wrapper to prevent the shebang from being output on PHP<8
*
* @generated
*/

namespace Composer;

$GLOBALS['_composer_bin_dir'] = __DIR__;
$GLOBALS['_composer_autoload_path'] = __DIR__ . '/..'.'/autoload.php';

if (PHP_VERSION_ID < 80000) {
if (!class_exists('Composer\BinProxyWrapper')) {
/**
* @internal
*/
final class BinProxyWrapper
{
private $handle;
private $position;
private $realpath;

public function stream_open($path, $mode, $options, &$opened_path)
{
// get rid of phpvfscomposer:// prefix for __FILE__ & __DIR__ resolution
$opened_path = substr($path, 17);
$this->realpath = realpath($opened_path) ?: $opened_path;
$opened_path = $this->realpath;
$this->handle = fopen($this->realpath, $mode);
$this->position = 0;

return (bool) $this->handle;
}

public function stream_read($count)
{
$data = fread($this->handle, $count);

if ($this->position === 0) {
$data = preg_replace('{^#!.*\r?\n}', '', $data);
}

$this->position += strlen($data);

return $data;
}

public function stream_cast($castAs)
{
return $this->handle;
}

public function stream_close()
{
fclose($this->handle);
}

public function stream_lock($operation)
{
return $operation ? flock($this->handle, $operation) : true;
}

public function stream_seek($offset, $whence)
{
if (0 === fseek($this->handle, $offset, $whence)) {
$this->position = ftell($this->handle);
return true;
}

return false;
}

public function stream_tell()
{
return $this->position;
}

public function stream_eof()
{
return feof($this->handle);
}

public function stream_stat()
{
return array();
}

public function stream_set_option($option, $arg1, $arg2)
{
return true;
}

public function url_stat($path, $flags)
{
$path = substr($path, 17);
if (file_exists($path)) {
return stat($path);
}

return false;
}
}
}

if (
(function_exists('stream_get_wrappers') && in_array('phpvfscomposer', stream_get_wrappers(), true))
|| (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper'))
) {
return include("phpvfscomposer://" . __DIR__ . '/..'.'/phpstan/phpstan/phpstan.phar');
}
}

return include __DIR__ . '/..'.'/phpstan/phpstan/phpstan.phar';
5 changes: 5 additions & 0 deletions core/classes/vendor/bin/phpstan.phar.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@ECHO OFF
setlocal DISABLEDELAYEDEXPANSION
SET BIN_TARGET=%~dp0/phpstan.phar
SET COMPOSER_RUNTIME_BIN_DIR=%~dp0
php "%BIN_TARGET%" %*
Loading

0 comments on commit 3d6a5c1

Please sign in to comment.