php-parse 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. #!/usr/bin/env php
  2. <?php
  3. /**
  4. * Proxy PHP file generated by Composer
  5. *
  6. * This file includes the referenced bin path (../nikic/php-parser/bin/php-parse)
  7. * using a stream wrapper to prevent the shebang from being output on PHP<8
  8. *
  9. * @generated
  10. */
  11. namespace Composer;
  12. $GLOBALS['_composer_bin_dir'] = __DIR__;
  13. $GLOBALS['_composer_autoload_path'] = __DIR__ . '/..'.'/autoload.php';
  14. if (PHP_VERSION_ID < 80000) {
  15. if (!class_exists('Composer\BinProxyWrapper')) {
  16. /**
  17. * @internal
  18. */
  19. final class BinProxyWrapper
  20. {
  21. private $handle;
  22. private $position;
  23. private $realpath;
  24. public function stream_open($path, $mode, $options, &$opened_path)
  25. {
  26. // get rid of phpvfscomposer:// prefix for __FILE__ & __DIR__ resolution
  27. $opened_path = substr($path, 17);
  28. $this->realpath = realpath($opened_path) ?: $opened_path;
  29. $opened_path = $this->realpath;
  30. $this->handle = fopen($this->realpath, $mode);
  31. $this->position = 0;
  32. return (bool) $this->handle;
  33. }
  34. public function stream_read($count)
  35. {
  36. $data = fread($this->handle, $count);
  37. if ($this->position === 0) {
  38. $data = preg_replace('{^#!.*\r?\n}', '', $data);
  39. }
  40. $this->position += strlen($data);
  41. return $data;
  42. }
  43. public function stream_cast($castAs)
  44. {
  45. return $this->handle;
  46. }
  47. public function stream_close()
  48. {
  49. fclose($this->handle);
  50. }
  51. public function stream_lock($operation)
  52. {
  53. return $operation ? flock($this->handle, $operation) : true;
  54. }
  55. public function stream_seek($offset, $whence)
  56. {
  57. if (0 === fseek($this->handle, $offset, $whence)) {
  58. $this->position = ftell($this->handle);
  59. return true;
  60. }
  61. return false;
  62. }
  63. public function stream_tell()
  64. {
  65. return $this->position;
  66. }
  67. public function stream_eof()
  68. {
  69. return feof($this->handle);
  70. }
  71. public function stream_stat()
  72. {
  73. return array();
  74. }
  75. public function stream_set_option($option, $arg1, $arg2)
  76. {
  77. return true;
  78. }
  79. public function url_stat($path, $flags)
  80. {
  81. $path = substr($path, 17);
  82. if (file_exists($path)) {
  83. return stat($path);
  84. }
  85. return false;
  86. }
  87. }
  88. }
  89. if (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper')) {
  90. include("phpvfscomposer://" . __DIR__ . '/..'.'/nikic/php-parser/bin/php-parse');
  91. exit(0);
  92. }
  93. }
  94. include __DIR__ . '/..'.'/nikic/php-parser/bin/php-parse';