Skip to content

Update Box to 4.5.1@1e10a1e 2023-11-04 17:57:48 UTC #2955

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jun 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 46 additions & 48 deletions .github/workflows/phar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "8.1"
php-version: "8.2"
extensions: mbstring, intl

- name: "Install dependencies"
Expand All @@ -59,9 +59,13 @@ jobs:
- name: "Dump autoloader one more time for attributes"
run: "composer dump"

- name: "Install Box dependencies"
working-directory: "compiler/box"
run: "composer install"

- name: "Compile PHAR"
working-directory: "compiler/build"
run: "php box.phar compile --no-parallel"
run: "php ../box/vendor/bin/box compile --no-parallel"

- uses: actions/upload-artifact@v4
with:
Expand All @@ -85,7 +89,7 @@ jobs:

- name: "Compile PHAR for checksum"
working-directory: "compiler/build"
run: "php box.phar compile --no-parallel"
run: "php ../box/vendor/bin/box compile --no-parallel"
env:
PHAR_CHECKSUM: "1"
COMPOSER_ROOT_VERSION: "2.1.x-dev"
Expand Down Expand Up @@ -141,10 +145,10 @@ jobs:
ref: 2.1.x
phar-checksum: ${{needs.compiler-tests.outputs.checksum}}

checksum-phar:
name: "Checksum PHAR"
if: github.event_name == 'pull_request' && needs.compiler-tests.outputs.compiler_changed == 'true'
download-base-sha-phar:
name: "Download base SHA PHAR"
needs: compiler-tests
if: github.event_name == 'pull_request' && needs.compiler-tests.outputs.compiler_changed == 'true'
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -178,16 +182,36 @@ jobs:
const script = require('./.github/scripts/dist/find-artifact.js');
await script({github, context, core})

# saved to phar-file-checksum/phpstan.phar
- name: Download old artifact by ID
uses: actions/download-artifact@v4
with:
artifact-ids: ${{ steps.find-artifact.outputs.artifact_id }}
run-id: ${{ steps.find-artifact.outputs.run_id }}
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: "Upload old artifact"
uses: actions/upload-artifact@v4
with:
name: phar-file-checksum-base
path: phar-file-checksum/phpstan.phar

checksum-phar:
name: "Checksum PHAR"
needs:
- compiler-tests
- download-base-sha-phar
runs-on: "ubuntu-latest"
steps:
# saved to phpstan.phar
- name: "Download base phpstan.phar"
uses: actions/download-artifact@v4
with:
name: phar-file-checksum-base

- name: "Save old checksum"
id: "old_checksum"
run: echo "md5=$(md5sum phar-file-checksum/phpstan.phar | cut -d' ' -f1)" >> $GITHUB_OUTPUT
run: echo "md5=$(md5sum phpstan.phar | cut -d' ' -f1)" >> $GITHUB_OUTPUT

- name: "Assert checksum"
run: |
Expand All @@ -197,69 +221,43 @@ jobs:

phar-prefix-diff:
name: "PHAR Prefix Diff"
if: github.event_name == 'pull_request' && needs.compiler-tests.outputs.compiler_changed == 'true'
needs: compiler-tests
needs: download-base-sha-phar
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v4

- name: Get base commit SHA
id: base
run: echo "base_sha=${{ github.event.pull_request.base.sha }}" >> "$GITHUB_OUTPUT"

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- name: Install dependencies
working-directory: .github/scripts
run: npm ci

- name: "Compile TS scripts"
working-directory: .github/scripts
run: npx tsc

- name: Find phar-file-checksum from base commit
id: find-artifact
uses: actions/github-script@v7
env:
BASE_SHA: ${{ steps.base.outputs.base_sha }}
ARTIFACT_NAME: phar-file-checksum
WORKFLOW_NAME: Compile PHAR
with:
script: |
const script = require('./.github/scripts/dist/find-artifact.js');
await script({github, context, core})

# saved to phar-file-checksum/phpstan.phar
- name: Download old artifact by ID
- name: "Download phpstan.phar"
uses: actions/download-artifact@v4
with:
artifact-ids: ${{ steps.find-artifact.outputs.artifact_id }}
run-id: ${{ steps.find-artifact.outputs.run_id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
name: phar-file-checksum
path: phar-file-checksum

# saved to phpstan.phar
- name: "Download phpstan.phar"
# saved to phar-file-checksum-base/phpstan.phar
- name: "Download base phpstan.phar"
uses: actions/download-artifact@v4
with:
name: phar-file-checksum
name: phar-file-checksum-base
path: phar-file-checksum-base

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "8.1"
php-version: "8.2"

- name: "Install dependencies"
run: "composer install --no-interaction --no-progress"

- name: "Install Box dependencies"
working-directory: "compiler/box"
run: "composer install"

- name: "Extract old phpstan.phar"
run: "php compiler/build/box.phar extract phar-file-checksum/phpstan.phar phar-old"
run: "php compiler/box/vendor/bin/box extract phar-file-checksum-base/phpstan.phar phar-old"

- name: "Extract new phpstan.phar"
run: "php compiler/build/box.phar extract phpstan.phar phar-new"
run: "php compiler/box/vendor/bin/box extract phar-file-checksum/phpstan.phar phar-new"

- name: "List prefix locations in old PHAR"
run: "php .github/scripts/listPrefix.php ${{ github.workspace }}/phar-old > phar-old.txt"
Expand Down
36 changes: 0 additions & 36 deletions bin/phpstan
Original file line number Diff line number Diff line change
Expand Up @@ -29,42 +29,6 @@ use Symfony\Component\Console\Helper\ProgressBar;
}
$devOrPharLoader->unregister();

$composerAutoloadFiles = $GLOBALS['__composer_autoload_files'];
if (
!array_key_exists('e88992873b7765f9b5710cab95ba5dd7', $composerAutoloadFiles)
|| !array_key_exists('3e76f7f02b41af8cea96018933f6b7e3', $composerAutoloadFiles)
|| !array_key_exists('a4a119a56e50fbb293281d9a48007e0e', $composerAutoloadFiles)
|| !array_key_exists('0e6d7bf4a5811bfa5cf40c5ccd6fae6a', $composerAutoloadFiles)
|| !array_key_exists('e69f7f6ee287b969198c3c9d6777bd38', $composerAutoloadFiles)
|| !array_key_exists('8825ede83f2f289127722d4e842cf7e8', $composerAutoloadFiles)
|| !array_key_exists('23c18046f52bef3eea034657bafda50f', $composerAutoloadFiles)
) {
echo "Composer autoloader changed\n";
exit(1);
}

// empty the global variable so that unprefixed functions from user-space can be loaded
$GLOBALS['__composer_autoload_files'] = [
// fix unprefixed Hoa namespace - files already loaded
'e88992873b7765f9b5710cab95ba5dd7' => true,
'3e76f7f02b41af8cea96018933f6b7e3' => true,

// vendor/symfony/polyfill-php80/bootstrap.php
'a4a119a56e50fbb293281d9a48007e0e' => true,

// vendor/symfony/polyfill-mbstring/bootstrap.php
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => true,

// vendor/symfony/polyfill-intl-normalizer/bootstrap.php
'e69f7f6ee287b969198c3c9d6777bd38' => true,

// vendor/symfony/polyfill-intl-grapheme/bootstrap.php
'8825ede83f2f289127722d4e842cf7e8' => true,

// vendor/symfony/polyfill-php81/bootstrap.php
'23c18046f52bef3eea034657bafda50f' => true,
];

$autoloaderInWorkingDirectory = $vendorDirectory . '/autoload.php';
$composerAutoloaderProjectPaths = [];

Expand Down
1 change: 1 addition & 0 deletions compiler/box/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/vendor
23 changes: 23 additions & 0 deletions compiler/box/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"require": {
"humbug/box": "^4.6",
"cweagans/composer-patches": "^1.7"
},
"config": {
"platform": {
"php": "8.2.99"
},
"allow-plugins": {
"vaimo/composer-patches": true,
"cweagans/composer-patches": true
}
},
"extra": {
"composer-exit-on-patch-failure": true,
"patches": {
"humbug/php-scoper": [
"patches/ScoperAutoloaderGenerator.patch"
]
}
}
}
Loading
Loading