Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Opening PHP tag in uppercase #91

Open
kenguest opened this issue Jul 23, 2024 · 7 comments · May be fixed by #100
Open

Opening PHP tag in uppercase #91

kenguest opened this issue Jul 23, 2024 · 7 comments · May be fixed by #100
Labels
enhancement New feature or request

Comments

@kenguest
Copy link
Contributor

None of the PSRs for Coding Standards, nor PER-CS, explicitly indicate whether the opening tag for PHP should be in lowercase, though this is very much implied in PSR-1 - see https://www.php-fig.org/psr/psr-1/#1-overview

It probably should be explicitly stated in the next version of PER-CS.

Also, it should be noted that php-cs-fixer does force the opening tag to be in lowercase, whilst phpcs does not.

@jrfnl
Copy link
Contributor

jrfnl commented Jul 23, 2024

Also, it should be noted that php-cs-fixer does force the opening tag to be in lowercase, whilst phpcs does not.

I know Greg was always very very strict about enforcing the PSRs to the letter (and nothing else). I also know he often asked for clarification in the FIG Google group/mailing list. ;-)

@samdark samdark added the enhancement New feature or request label Jul 24, 2024
@samdark
Copy link
Member

samdark commented Jul 24, 2024

Good idea.

@KorvinSzanto
Copy link
Contributor

In my opinion it doesn't really benefit readability to specify a casing for PHP tags so we should leave it unspecified.

@Crell
Copy link
Collaborator

Crell commented Jul 26, 2024

The intent of a style guide isn't just readability, but consistency. I don't recall the last time I saw a capitalized PHP open tag. So making it required that everyone do what everyone is already doing seems reasonable.

@vjik
Copy link
Contributor

vjik commented Jul 27, 2024

PER CS, 2.1 Basic Coding Standard:

Code MUST follow all rules outlined in PSR-1.

PSR-1, 1. Overview

Files MUST use only <?php and <?= tags.

I think, PSR-1 explicitly defines <?php only usage, and any changes in PER CS not need.

@jrfnl
Copy link
Contributor

jrfnl commented Jul 27, 2024

@vjik As far as I know, that rule is about the type of open tags and basically forbids the use of <?, <%[=] (ASP-style, PHP < 7.0) and <script language="php"... (PHP < 7.0) tags. It does not explicit say anything about the case of the <php open tag.

Keep in mind that PSR1 was published in the PHP 5 era.

@vjik
Copy link
Contributor

vjik commented Jul 27, 2024

It does not explicit say anything about the case of the <php open tag.

<?PHP is not equals <?php. In my interpretations Files MUST use only <?php and <?= tags. allows to use strictly only <?php or <?=.

But if it is not obvious and can be misleading, then better explicitly state it.

@Crell Crell mentioned this issue Sep 3, 2024
9 tasks
@Crell Crell linked a pull request Oct 15, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants