Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Syntax error with CONST-s

Open Beginner friendly
#1 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
php
Domain
tooling

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.