From 3948dc4f752019ced90dbdd0c7cc9863693abca5 Mon Sep 17 00:00:00 2001 From: Muqsit Rayyan Date: Wed, 31 May 2023 18:03:14 +0500 Subject: [PATCH 1/2] Remove calls to ReflectionProperty::setAccessible() (#5783) This is a no-op in PHP 8.1 and up. --- src/MemoryManager.php | 6 ------ src/crash/CrashDump.php | 1 - 2 files changed, 7 deletions(-) diff --git a/src/MemoryManager.php b/src/MemoryManager.php index e04c5e857..1db31615d 100644 --- a/src/MemoryManager.php +++ b/src/MemoryManager.php @@ -316,9 +316,6 @@ class MemoryManager{ continue; } - if(!$property->isPublic()){ - $property->setAccessible(true); - } if(!$property->isInitialized()){ continue; } @@ -442,9 +439,6 @@ class MemoryManager{ continue; } } - if(!$property->isPublic()){ - $property->setAccessible(true); - } if(!$property->isInitialized($object)){ continue; } diff --git a/src/crash/CrashDump.php b/src/crash/CrashDump.php index 388550ac3..d7223eb2f 100644 --- a/src/crash/CrashDump.php +++ b/src/crash/CrashDump.php @@ -248,7 +248,6 @@ class CrashDump{ if(file_exists($filePath)){ $reflection = new \ReflectionClass(PluginBase::class); $file = $reflection->getProperty("file"); - $file->setAccessible(true); foreach($this->server->getPluginManager()->getPlugins() as $plugin){ $filePath = Filesystem::cleanPath($file->getValue($plugin)); if(str_starts_with($frameCleanPath, $filePath)){ From 1101f35c171b3fc82fc51af7932f72a0542fd229 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Wed, 31 May 2023 22:09:33 +0100 Subject: [PATCH 2/2] Update setup-php-action to 2.0.0 this version vastly improves build time by using optimized prebuilts instead of building the binaries on the runner. --- .github/workflows/main.yml | 57 +++++------------------ .github/workflows/update-php-versions.php | 50 -------------------- 2 files changed, 12 insertions(+), 95 deletions(-) delete mode 100644 .github/workflows/update-php-versions.php diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c66ad03b4..5469882f7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,47 +6,26 @@ on: workflow_dispatch: jobs: - build-php: - name: Prepare PHP - runs-on: ${{ matrix.image }} - - strategy: - matrix: - image: [ubuntu-20.04] - php: [8.1.19, 8.2.6] - - steps: - - name: Build and prepare PHP cache - uses: pmmp/setup-php-action@c7fb29d83535320922068087c7285bdedbbfa3c2 - with: - php-version: ${{ matrix.php }} - install-path: "./bin" - pm-version-major: "4" - phpstan: name: PHPStan analysis - needs: build-php runs-on: ${{ matrix.image }} strategy: fail-fast: false matrix: image: [ubuntu-20.04] - php: [8.1.19, 8.2.6] + php: ["8.1", "8.2"] steps: - uses: actions/checkout@v3 - name: Setup PHP - uses: pmmp/setup-php-action@c7fb29d83535320922068087c7285bdedbbfa3c2 + uses: pmmp/setup-php-action@2.0.0 with: php-version: ${{ matrix.php }} install-path: "./bin" pm-version-major: "4" - - name: Install Composer - run: curl -sS https://getcomposer.org/installer | php - - name: Restore Composer package cache uses: actions/cache@v3 with: @@ -58,34 +37,30 @@ jobs: composer-v2-cache- - name: Install Composer dependencies - run: php composer.phar install --prefer-dist --no-interaction + run: composer install --prefer-dist --no-interaction - name: Run PHPStan run: ./vendor/bin/phpstan analyze --no-progress --memory-limit=2G phpunit: name: PHPUnit tests - needs: build-php runs-on: ${{ matrix.image }} strategy: fail-fast: false matrix: image: [ubuntu-20.04] - php: [8.1.19, 8.2.6] + php: ["8.1", "8.2"] steps: - uses: actions/checkout@v3 - name: Setup PHP - uses: pmmp/setup-php-action@c7fb29d83535320922068087c7285bdedbbfa3c2 + uses: pmmp/setup-php-action@2.0.0 with: php-version: ${{ matrix.php }} install-path: "./bin" pm-version-major: "4" - - name: Install Composer - run: curl -sS https://getcomposer.org/installer | php - - name: Restore Composer package cache uses: actions/cache@v3 with: @@ -97,20 +72,19 @@ jobs: composer-v2-cache- - name: Install Composer dependencies - run: php composer.phar install --prefer-dist --no-interaction + run: composer install --prefer-dist --no-interaction - name: Run PHPUnit tests run: ./vendor/bin/phpunit --bootstrap vendor/autoload.php --fail-on-warning tests/phpunit integration: name: Integration tests - needs: build-php runs-on: ${{ matrix.image }} strategy: fail-fast: false matrix: image: [ubuntu-20.04] - php: [8.1.19, 8.2.6] + php: ["8.1", "8.2"] steps: - uses: actions/checkout@v3 @@ -118,15 +92,12 @@ jobs: submodules: true - name: Setup PHP - uses: pmmp/setup-php-action@c7fb29d83535320922068087c7285bdedbbfa3c2 + uses: pmmp/setup-php-action@2.0.0 with: php-version: ${{ matrix.php }} install-path: "./bin" pm-version-major: "4" - - name: Install Composer - run: curl -sS https://getcomposer.org/installer | php - - name: Restore Composer package cache uses: actions/cache@v3 with: @@ -138,34 +109,30 @@ jobs: composer-v2-cache- - name: Install Composer dependencies - run: php composer.phar install --no-dev --prefer-dist --no-interaction + run: composer install --no-dev --prefer-dist --no-interaction - name: Run integration tests run: ./tests/travis.sh -t4 codegen: name: Generated Code consistency checks - needs: build-php runs-on: ${{ matrix.image }} strategy: fail-fast: false matrix: image: [ubuntu-20.04] - php: [8.1.19, 8.2.6] + php: ["8.1", "8.2"] steps: - uses: actions/checkout@v3 - name: Setup PHP - uses: pmmp/setup-php-action@c7fb29d83535320922068087c7285bdedbbfa3c2 + uses: pmmp/setup-php-action@2.0.0 with: php-version: ${{ matrix.php }} install-path: "./bin" pm-version-major: "4" - - name: Install Composer - run: curl -sS https://getcomposer.org/installer | php - - name: Restore Composer package cache uses: actions/cache@v3 with: @@ -177,7 +144,7 @@ jobs: composer-v2-cache- - name: Install Composer dependencies - run: php composer.phar install --no-dev --prefer-dist --no-interaction + run: composer install --no-dev --prefer-dist --no-interaction - name: Regenerate registry annotations run: php build/generate-registry-annotations.php src diff --git a/.github/workflows/update-php-versions.php b/.github/workflows/update-php-versions.php deleted file mode 100644 index 2455ba101..000000000 --- a/.github/workflows/update-php-versions.php +++ /dev/null @@ -1,50 +0,0 @@ -