Skip to content

Move php-magical-constants to php-keywords.el#819

Merged
zonuexe merged 1 commit into
masterfrom
refactor/magical-constants
Jul 16, 2026
Merged

Move php-magical-constants to php-keywords.el#819
zonuexe merged 1 commit into
masterfrom
refactor/magical-constants

Conversation

@zonuexe

@zonuexe zonuexe commented Jul 16, 2026

Copy link
Copy Markdown
Member

Continues the php.el decomposition. Small and self-contained.

Why

php-keywords.el calls itself "a single source of truth for PHP keywords", but php.el kept a vocabulary list of its own under a ;;; PHP Keywords heading — so a reader asking where PHP's keywords live got two answers. This moves the list to the module that owns the vocabulary, which makes that claim true.

The name does not change

php-magical-constants stays php-magical-constants. It is a long-standing public symbol and both major modes build their php-magical-constant font-lock rule straight from it. Keeping the name is also exactly what #815 did — php-core.el holds php-executable, php-in-string-p and php-base-mode under their own names — so:

  • no obsolete alias is needed,
  • no caller has to change,
  • (require 'php) behaves exactly as before, because php.el requires php-keywords.el and therefore still exposes it.

(An earlier sketch had this renamed to php-keywords-magic-constants with an alias. Dropped — it bought nothing and would have made the file's naming more mixed, since everything else there is php-keywords--*.)

Verification

  • The defconst is moved byte-for-byte; diff against master confirms it is identical.
  • After (require 'php), php-magical-constants still holds the same 8 constants.
  • php-keywords.el still requires nothing, so the dependency arrow keeps pointing the natural way (vocabulary ← everything else), with no cycle.
  • Byte-compiles with no new warnings; full suite green.

Not moved

php-re-token-symbols stays in php.el. Its only consumer is php.el's own token scanner, and it is a bare regexp with no list form, so it does not fit this file's NAME / NAME-re convention.

php-keywords.el calls itself "a single source of truth for PHP
keywords", but php.el kept a vocabulary list of its own under a ";;;
PHP Keywords" heading, so a reader asking where PHP's keywords live got
two answers.  Move the list to the module that owns the vocabulary.

The name does not change.  php-magical-constants is a long-standing
public symbol and both major modes build their php-magical-constant
font-lock rule straight from it; keeping it is also what php-core.el
does for php-executable and php-base-mode, so no alias is needed and no
caller has to move.  php.el requires php-keywords.el and therefore still
exposes it -- (require 'php) behaves exactly as before.

php-keywords.el still requires nothing, so the dependency arrow keeps
pointing the natural way.  php-re-token-symbols stays in php.el: its
only consumer is php.el's own token scanner, and it has no list form to
fit this file's NAME / NAME-re convention.
@zonuexe
zonuexe merged commit 95834aa into master Jul 16, 2026
14 checks passed
@zonuexe
zonuexe deleted the refactor/magical-constants branch July 16, 2026 17:42
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.

1 participant