GithubHelp home page GithubHelp logo

Docblock comments on DataList shadow SS_List's more useful PHPDoc types in PHPStorm (::first, ::byID, ::find, ::filter, etc.) about silverstripe-framework HOT 7 CLOSED

MasonD avatar MasonD commented on September 28, 2024
Docblock comments on DataList shadow SS_List's more useful PHPDoc types in PHPStorm (::first, ::byID, ::find, ::filter, etc.)

from silverstripe-framework.

Comments (7)

emteknetnz avatar emteknetnz commented on September 28, 2024 1

Targetting 5.2 is fine for this particular enhancement, it's not changing the functional behaviour of any classes.

Means you'll get your patch release immediately instead of having to wait several months.

from silverstripe-framework.

emteknetnz avatar emteknetnz commented on September 28, 2024

Closing because this is an issue with PHPStorm, not with Silverstripe

The type hinting works correctly in VSCode, at least with the PHP Intelephense plugin - with the example above I was correctly type hinted for a Member. Type hinting was greatly improved in 5.2 with generic type hints

from silverstripe-framework.

MasonD avatar MasonD commented on September 28, 2024

@emteknetnz I don't understand this stance? I agree that 5.2 is a huge improvement, and was running my own stubs with generic type hints before 5.2. But the reason for adding the generic type hints is to improve dev experience, and the current types don't work with PHPStorm's analysis but would work with just the inclusion of @inheritDoc.

Is there something I'm missing about @inheritDoc that would make its inclusion in the docblocks of DataList methods in order to support PHPStorm unfeasible? If it degrades the experience in other editors I'd concede that that's not a trade to make, but if all it does is improve PHPStorm support, I think that's worth it. I'd be willing to create the PR.

from silverstripe-framework.

kinglozzer avatar kinglozzer commented on September 28, 2024

Seems like a pretty trivial fix, and given the prevalence of PHPStorm I think it’s worthwhile. Some of the comments in DataList do contain a bit more (DataObject-specific) info than the methods they’re overriding, so rather than using @inheritDoc it might be better to copy the return types down in some places. Do you want to have a crack at a PR @MasonD?

from silverstripe-framework.

MasonD avatar MasonD commented on September 28, 2024

Sure. Which branch would you like me to target it on?

from silverstripe-framework.

kinglozzer avatar kinglozzer commented on September 28, 2024

I think 5 rather than 5.2, because I suppose this is more an enhancement for PHPStorm users than an bug fix

from silverstripe-framework.

emteknetnz avatar emteknetnz commented on September 28, 2024

Linked PR has been merged, it will be automatically tagged shortly

from silverstripe-framework.

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.