Skip to content

lowercase/uppercase string lost after != '' #12312

Closed

Description

@staabm

Bug report

found by @VincentLanglet in phpstan/phpstan-src#3750 (comment)

Code snippet that reproduces the problem

https://phpstan.org/r/0d005523-02c0-4a9b-b4a4-e06ad18b378b

Expected output

uppercase/lowercase-string should be preserved

Did PHPStan help you today? Did it make you happy in any way?

No response

Activity

  1. VincentLanglet commented on Dec 22, 2024

    @VincentLanglet
    Contributor

    I think it's because of the following code
    https://github.com/phpstan/phpstan-src/blob/aa4a1232d2fbd6460632cb55d337e18539757281/src/Type/TypeCombinator.php#L448-L486

    and the fact lowercase/uppercase string are described at the precise level.

    I opened a PR phpstan/phpstan-src#3751

  2. staabm commented on Dec 22, 2024

    @staabm
    ContributorAuthor

    there is more wrong with uppercase/lowercase string:
    https://phpstan.org/r/9d4efc4c-96da-4656-95f0-492c8caf4892

    edit: did not see your above comment until now. maybe your fix also fixes these cases

  3. VincentLanglet commented on Dec 22, 2024

    @VincentLanglet
    Contributor

    there is more wrong with uppercase/lowercase string: phpstan.org/r/9d4efc4c-96da-4656-95f0-492c8caf4892

    What is wrong about your example ?
    When I try '0' == '' on php, I get false

    Also, you get the same result without upper/lower case
    https://phpstan.org/r/e563596d-b1f8-4e73-b592-f64baeca0c19

  4. staabm commented on Dec 22, 2024

    @staabm
    ContributorAuthor

    I think you are right. Mixed it up with non typed param

  5. ondrejmirtes commented on Jan 16, 2025

    @ondrejmirtes
    Member
  6. github-actions commented on Feb 17, 2025

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

  7. locked as resolved and limited conversation to collaborators on Feb 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions