Skip to content

PHPStan: cleanup setup#4222

Merged
antonmedv merged 1 commit into
deployphp:masterfrom
staabm:stan
May 21, 2026
Merged

PHPStan: cleanup setup#4222
antonmedv merged 1 commit into
deployphp:masterfrom
staabm:stan

Conversation

@staabm
Copy link
Copy Markdown
Contributor

@staabm staabm commented May 21, 2026

cleaning up tooling setup to ignore less errors. preparing the way to raise to level 6 in a followup

Comment thread phpstan.neon
Comment on lines +15 to +19
dynamicConstantNames:
DEPLOYER_VERSION: string
DEPLOYER_BIN: string
MASTER_ENDPOINT: string
MASTER_TOKEN: string
Copy link
Copy Markdown
Contributor Author

@staabm staabm May 21, 2026

Choose a reason for hiding this comment

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

make PHPStan aware which types we expect the constants to have. those will be validated against when code uses define() or const.

see

Comment thread phpstan.neon
- "#^Constant DEPLOYER_VERSION not found\\.$#"
- "#^Constant DEPLOYER_BIN not found\\.$#"
- "#^Constant MASTER_ENDPOINT not found\\.$#"
- "#^Constant MASTER_TOKEN not found\\.$#"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

DEPLOYER_VERSION, DEPLOYER_BIN will be detected by phpstan bootstrap.

MASTER_ENDPOINT, MASTER_TOKEN are only conditionally defined, therefore still needs the ignore

Comment thread src/Configuration.php
use function Deployer\Support\normalize_line_endings;

/**
* @implements \ArrayAccess<string, mixed>
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

reflects the signature of
function set(string $name, mixed $value)

Comment thread tests/constants.php
@@ -0,0 +1,8 @@
<?php

define('DEPLOYER_BIN', __DIR__ . '/../bin/dep');
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

extracting constant definitions in a separate file, so PHPStan can discover them

@antonmedv antonmedv merged commit 67ac857 into deployphp:master May 21, 2026
9 checks passed
@staabm staabm deleted the stan branch May 21, 2026 06:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants