Code Monkey home page Code Monkey logo

Comments (6)

Wirone avatar Wirone commented on June 27, 2024 2

It won't be easy, but it's not impossible. We need to scan current namespace (whole file or within {}) for symbols and use these names just like we use list of existing imports.

from php-cs-fixer.

Wirone avatar Wirone commented on June 27, 2024

3.44 is fine because importing symbols was enabled in @PhpCsFixer ruleset in 3.45, so previously it did not try to import symbols... As a workaround you can disable this by configuring fully_qualified_strict_types=true, or with explicit import_symbols=false option.

Naming conflict with symbols living in a processed file was not taken into consideration, unfortunately 😞.

from php-cs-fixer.

keradus avatar keradus commented on June 27, 2024

Naming conflict with symbols living in a processed file was not taken into consideration, unfortunately 😞.

you think it can, @Wirone ?

from php-cs-fixer.

mvorisek avatar mvorisek commented on June 27, 2024

Also this usecase is broken currently:

--RULESET--
{
    "@PhpCsFixer": true,
    "@PhpCsFixer:risky": true
}

--INPUT--
<?php

new MyCl();
new \MyExample\MyCl();

--WRONG-FIX--
<?php

use MyExample\MyCl;

new MyCl();
new MyCl();

from php-cs-fixer.

Wirone avatar Wirone commented on June 27, 2024

@mvorisek looks more like #7632 🤔. No, it's different.

from php-cs-fixer.

mvorisek avatar mvorisek commented on June 27, 2024

Here is how the fixer must be fixed:

  1. there are declarations like class X
  2. there are references like class X extends Y or new X

in both cases, even in the 2nd case, the used short symbols must imply "same namespace imports if not already imported", thus contribute to $uses before any fix is run.

from php-cs-fixer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.