Skip to content

Remove constant tag from literal values - #3251

Merged
ndossche merged 2 commits into
php:masterfrom
haszi:Remove-constant-tag-from-literal-values
Mar 10, 2024
Merged

ndossche merged 2 commits into
php:masterfrom
haszi:Remove-constant-tag-from-literal-values

Conversation

@haszi

@haszi haszi commented Mar 8, 2024

Copy link
Copy Markdown
Contributor

Replace <constant> tags with <literal> tags for literals which are mostly one of the following:

  • strings
  • format placeholders
  • array keys
  • numbers (integers, floats, hexadecimals and numers using scientific (e) notation)

@haszi
haszi requested a review from ndossche as a code owner March 8, 2024 16:31
@haszi

haszi commented Mar 8, 2024

Copy link
Copy Markdown
Contributor Author

These changes were made with the following script:

#!/bin/bash
sed -i -E 's/<constant>(%.)<\/constant>/<literal>\1<\/literal>/g' install/fpm/configuration.xml
sed -i -E "s/<constant>'<\/constant>/<literal>'<\/literal>/g" reference/cubrid/cubridmysql/cubrid-real-escape-string.xml
sed -i -E 's/<constant>\.\.<\/constant>/<literal>\.\.<\/literal>/g' reference/ev/evstat.xml
sed -i -E "s/<constant>'(.+)'<\/constant>/<literal>'\1'<\/literal>/g" reference/ev/evstat.xml
sed -i -E "s/<constant>'(.+)'<\/constant>/<literal>'\1'<\/literal>/g" reference/ev/evstat/attr.xml
sed -i -E "s/<constant>'ndots'<\/constant>/<parameter>'ndots'<\/parameter>/g" reference/event/eventdnsbase/setsearchndots.xml
sed -i -E 's/<constant>"ctr"<\/constant>/<literal>"ctr"<\/literal>/g' reference/mcrypt/constants.xml
sed -i -E 's/<constant>"ncfb"<\/constant>/<literal>"ncfb"<\/literal>/g' reference/mcrypt/constants.xml
sed -i -E 's/<constant>(\\.{1})<\/constant>/<literal>\1<\/literal>/g' reference/sockets/functions/socket-read.xml
sed -i -E 's/<constant>\&amp;<\/constant>/<literal>\&amp;<\/literal>/g' reference/dom/domattr.xml
\grep -lrE --include="*.xml" '<constant>[0-9]+<\/constant>' | xargs -d '\n' sed -i -E 's/<constant>([0-9]+)<\/constant>/<literal>\1<\/literal>/g'
\grep -lrE --include="*.xml" '<constant>[0-9]+\.[0-9]+<\/constant>' | xargs -d '\n' sed -i -E 's/<constant>([0-9]+\.[0-9]+)<\/constant>/<literal>\1<\/literal>/g'
\grep -lrE --include="*.xml" '<constant>[0-9]+.+<\/constant>' | xargs -d '\n' sed -i -E 's/<constant>([0-9]+.+)<\/constant>/<literal>\1<\/literal>/g'

@ndossche ndossche left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I believe this is right. Leaving open to see if other feedback comes in, and otherwise I'll merge.

@ndossche
ndossche merged commit f80105b into php:master Mar 10, 2024
@haszi
haszi deleted the Remove-constant-tag-from-literal-values branch March 11, 2024 19:18
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