Syntax error with CONST-s
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 68/100
Research direction
Reproduce with the applespace snippet in a small PHP project and inspect the merger's namespace/inlining transform that emits $GLOBALS['__pfm_inline']. Find the branch that wraps declarations in a static closure; it needs to hoist const statements to namespace level while leaving functions inside. Done when the merged file keeps const APPLE = 1; directly under namespace applespace { and existing tests still pass.
Written by the indexing model from the issue text.
Description
Hi
First of all thanks for the tool, I really like it.
I've run into an issue with constants inside namespaces.
For example let's take this simple namespace
namespace applespace;
const APPLE = 1;
function printapple() {
echo("Inside: ".APPLE);
}
it ends up being something like this:
namespace applespace {
$GLOBALS['__pfm_inline']['pfm0'] = static function () {
const APPLE= 1;
function printapple()
{
echo "Inside: " . APPLE;
}
};
}
Consts can not be inside functions. So I think the const ALMA = 1; should be outside of the static function but still inside the namespace.
So something like this:
namespace applespace {
const APPLE= 1;
$GLOBALS['__pfm_inline']['pfm0'] = static function () {
function printapple()
{
echo "Inside: " . APPLE;
}
};
}
- Dominant language
- PHP
- Stars
- 10
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 76/100
majorsilence/Reporting#493 ·
Maintainers usually reply within 1 day
-
Bug
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
Automattic/safe-publish#764 ·
Maintainers usually reply within 1 day
-
sync-en
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
sync-en
Difficulty 1/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
Перевод устарел
Difficulty 2/5 1-3 hours Newbie friendliness 68/100