Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
php-versions: ['8.2', '8.3', '8.4']
php-versions: ['8.2', '8.3', '8.4', '8.5']

runs-on: ${{ matrix.os }}
timeout-minutes: 3
Expand Down
5 changes: 5 additions & 0 deletions bin/add-phpstan-self-replace.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@

require __DIR__ . '/../vendor/autoload.php';

if (! class_exists(Versions::class)) {
echo 'You need to run `composer require ocramius/package-versions` first' . PHP_EOL;
exit(1);
}

$composerJsonFileContents = FileSystem::read(__DIR__ . '/../composer.json');

$composerJson = Json::decode($composerJsonFileContents, forceArrays: true);
Expand Down
18 changes: 16 additions & 2 deletions build/build-rector-scoped.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,27 @@ note "Starts"
note "Downloading php-scoper.phar"
wget https://github.com/humbug/php-scoper/releases/download/0.18.17/php-scoper.phar -N --no-verbose

# avoid phpstan/phpstan dependency duplicate
note "Remove PHPStan to avoid duplicating it"
# make PackageVersions exists
# here while wait for PHP 8.5 compatible code
# see https://github.com/Ocramius/PackageVersions/pull/270
# to allow us on rector to create downgrade PHP 8.5 rules with define
#
# #[RequiresPhp('>= 8.5')]
#
# On Downgrade PHP 8.5 rule, see https://github.com/rectorphp/rector-downgrade-php/pull/337
#
composer require ocramius/package-versions --working-dir "$BUILD_DIRECTORY"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add reasoning "why" we need to do this? + A note to remove this, once PHP 8.5 is allowed there: Ocramius/PackageVersions#270

I was bit confused to see package moved here :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw, do we really need this package? There is vendor/installed.json we might use

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the package is reliable to verify/get package version with version + hash, using custom code may need another research how this tackle various usage of versions definition

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added note why it is needed c451f2e


php "$BUILD_DIRECTORY/bin/add-phpstan-self-replace.php"

# avoid phpstan/phpstan and ocramius/package-versions dependency duplicate
note "Remove PHPStan and PackageVersions to avoid duplicating it"

composer remove phpstan/phpstan -W --update-no-dev --working-dir "$BUILD_DIRECTORY"
composer remove ocramius/package-versions -W --update-no-dev --working-dir "$BUILD_DIRECTORY"

note "PHPStan and PackageVersions now removed, safe to start php-scoper from here"

# Work around possible PHP memory limits
note "Running php-scoper on /bin, /config, /src, /rules and /vendor"
php -d memory_limit=-1 php-scoper.phar add-prefix bin config src rules vendor composer.json UPGRADING.md --output-dir "../$RESULT_DIRECTORY" --config scoper.php --force --ansi --working-dir "$BUILD_DIRECTORY";
Expand Down
1 change: 1 addition & 0 deletions composer-dependency-analyser.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
__DIR__ . '/stubs',
__DIR__ . '/tests',
__DIR__ . '/rules-tests',
__DIR__ . '/bin/add-phpstan-self-replace.php',
], [ErrorType::UNKNOWN_CLASS])

->disableExtensionsAnalysis();
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"illuminate/container": "^11.46",
"nette/utils": "^4.0",
"nikic/php-parser": "^5.6.1",
"ocramius/package-versions": "^2.10",
"ondram/ci-detector": "^4.2",
"phpstan/phpdoc-parser": "^2.3",
"phpstan/phpstan": "^2.1.26",
Expand Down
4 changes: 4 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ parameters:
message: '#Function "var_dump\(\)" cannot be used/left in the code#'
path: src/functions/node_helper.php

-
message: '#Function "class_exists\(\)" cannot be used/left in the code#'
path: bin/add-phpstan-self-replace.php

# lack of generic array in nikic/php-parser
- '#Method (.*?) should return array<PhpParser\\Node\\(.*?)\> but returns array<PhpParser\\Node\>#'

Expand Down