home.social

#phpcs — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #phpcs, aggregated by home.social.

  1. Special thanks to @jrf_nl for maintaining upstream #PHPCS - Coder would not be possible without her!

  2. Are there any @phpcs sniffs available (maybe in third-party packages) that check for PER-CS 3.0 style?

    I’m trying to avoid errors due to the abbreviated constructor (`{}`). So, if there’s a sniff just for that, I’d be happy. I’d prefer not to ignore all Squiz.WhiteSpace.ScopeClosingBrace.ContentBefore errors.

    #PHP #phpcs

  3. I converted the procedural #Drupal hooks in a contrib module to OO in about 15 minutes (and a lot of that was making notes for the blog post). #Rector and #PHPCS make it quick and easy! noreiko.com/blog/converting-ho

  4. #phpcs rocks! Has anyone ever tried to write a custom sniff that forbids the usage of a specific function inside other functions (other functions by name pattern)?@phpcs eventually?

    Or is that just a crazy idea? I couldn't find any documentation (too uncommon, I guess). And no similar existing sniff (as far as I can see).

    So any hint is welcome. And boosts might also help. 🙏 #PHP

  5. Hey, and friends!

    @jrf_nl, maintainer of is live-streaming the upgrade to the 4.0 branch of this week!

    Such a fun idea! Come along and watch in action!

    github.com/PHPCSStandards/PHP_

  6. Hey, #OpenSource and #PHP friends!

    @jrf_nl, maintainer of #PHP_CodeSniffer is live-streaming the upgrade to the 4.0 branch of #PHPCS this week!

    Such a fun idea! Come along and watch #FOSS in action!

    github.com/PHPCSStandards/PHP_

  7. Hey, #OpenSource and #PHP friends!

    @jrf_nl, maintainer of #PHP_CodeSniffer is live-streaming the upgrade to the 4.0 branch of #PHPCS this week!

    Such a fun idea! Come along and watch #FOSS in action!

    github.com/PHPCSStandards/PHP_

  8. Hey, #OpenSource and #PHP friends!

    @jrf_nl, maintainer of #PHP_CodeSniffer is live-streaming the upgrade to the 4.0 branch of #PHPCS this week!

    Such a fun idea! Come along and watch #FOSS in action!

    github.com/PHPCSStandards/PHP_

  9. Hey, #OpenSource and #PHP friends!

    @jrf_nl, maintainer of #PHP_CodeSniffer is live-streaming the upgrade to the 4.0 branch of #PHPCS this week!

    Such a fun idea! Come along and watch #FOSS in action!

    github.com/PHPCSStandards/PHP_

  10. How come there is no sniff for #phpcs that enforces $snake_case variables. By whatever reason it is, I need this and I can't find how to do it...

  11. TIP: If you want to know how to integrate an existing PHPCS configuration into Tomas Votruba's excellent easy-coding-standard linting tool -> here you go : github.com/lgersman/docker-ecs

    The repo features a xdebug+vscode ready configuration for ecs including a custom WordPress Coding Standard derivate consumed by ecs.

    -coding-standard

  12. Maybe it's because I started writing vanilla HTML first before adding #PHP, and I was meticulous with code formatting before I was introduced to #PHPCS, but my brain still thinks about indentation in PHP as separate from HTML indentation.

    I have yet to find a coding standard or sniff for this.

  13. 📦 #CPX: A tool for running #PHP #Composer packages effortlessly

    • 🔧 Execute commands from any Composer package without installation
    • 🔄 Automatically manages package updates and avoids dependency conflicts
    • 🧰 Supports popular tools like #PHPUnit, #Psalm, and #PHPCS
    • 🔍 Detects project-specific tools for testing, analysis, and formatting
    • 💻 Includes REPL functionality with automatic project autoloaders
    • 🔌 Features dynamic package inclusion and class aliasing

    #OpenSource #DeveloperTools #ProductivityTools

    CPX streamlines PHP development workflows by providing easy access to the entire PHP ecosystem. It allows developers to run commands from any Composer package without worrying about installation or conflicts. The tool also offers normalized workflows across different projects and enhanced PHP execution capabilities.

    cpx.dev/

  14. Testing WordPress plugins using Forgejo Actions

    Preface: Almost all public WordPress plugin development takes place on GitHub. We also collaborate on GitHub. However, we want to use and promote free alternatives for our own project. We currently host our own forgejo instance, but have been thinking about moving our repositories to @Codeberg, where we are more likely to find contributors and bug reports until the forgejo federation is more mature.

    Automated Testing Workflows: It took us a long time to set up working workflows that run integrations tests with WordPress and the WordPress ActivityPub-plugin within Forgejo Actions using the Forgejo-Runner. Copy pasting the GitHub Actions workflow from for instance the ActivityPub plugin was just the beginning of an almost ten hour long debugging session. But now the tests are working.

    #ForgejoActions #ForgejoRunner #Forgejo #PHPCS #PHPUnit #WordPress

  15. The life of a maintainer (and generally any back-end engineer) - if your existence is acknowledged, something's probably gone wrong! I feel you, @jrf_nl

    Thank you to all of the package maintainers out there 💕

    #ipc24 #webinale24 #intPHPcon #webinale #ipc #php #phpcs

  16. @shochdoerfer @markusstaab I am curious, though, why it’s a #PHPStan extension and not a #phpcs sniff (or something of the code style sort).

  17. This Thursday I'll be at #010PHP for an Ask-Me-Anything session about PHP_CodeSniffer.

    Ask your question and I'll answer with a live demo.

    Should be fun, come join us if you can :elephpant_blue:

    meetup.com/010php/events/29865

    #phpcs

  18. I'm hoping to get most of the syntax support for PHP 8.3 ready over the next few days, which means that if all goes well, it will be included in #PHP_CodeSniffer 3.9.0 release.

    The PR to add Tokenizer support for PHP 8.3 readonly anonymous classes to PHPCS is already open.

    github.com/PHPCSStandards/PHP_

    #phpcs

  19. I'm hoping to get most of the syntax support for PHP 8.3 ready over the next few days, which means that if all goes well, it will be included in #PHP_CodeSniffer 3.9.0 release.

    The PR to add Tokenizer support for PHP 8.3 readonly anonymous classes to PHPCS is already open.

    github.com/PHPCSStandards/PHP_

    #phpcs

  20. I'm hoping to get most of the syntax support for PHP 8.3 ready over the next few days, which means that if all goes well, it will be included in #PHP_CodeSniffer 3.9.0 release.

    The PR to add Tokenizer support for PHP 8.3 readonly anonymous classes to PHPCS is already open.

    github.com/PHPCSStandards/PHP_

    #phpcs

  21. I'm hoping to get most of the syntax support for PHP 8.3 ready over the next few days, which means that if all goes well, it will be included in #PHP_CodeSniffer 3.9.0 release.

    The PR to add Tokenizer support for PHP 8.3 readonly anonymous classes to PHPCS is already open.

    github.com/PHPCSStandards/PHP_

    #phpcs

  22. I'm hoping to get most of the syntax support for PHP 8.3 ready over the next few days, which means that if all goes well, it will be included in #PHP_CodeSniffer 3.9.0 release.

    The PR to add Tokenizer support for PHP 8.3 readonly anonymous classes to PHPCS is already open.

    github.com/PHPCSStandards/PHP_

    #phpcs

  23. In case you missed it:

    Last Friday, one week after the announcement that I'd be taking over maintenance of PHP_CodeSniffer, I have released version 3.8.0.

    Enjoy!

    #phpcs #php

    github.com/PHPCSStandards/PHP_

  24. One of the first things I did when I was laid off was to cancel all my FOSS donations, which made me sad, but I’m still not sure how long this period of unemployment will last, so it was the prudent thing to so.

    But once I get hired, I know I’m going to sign up to regularly donate to @phpcs! opencollective.com/php_codesni

    #PHP #PHPCS

  25. Cleaning up merged branches... the PHP_CodeSniffer 3.8.0 release is going to be great!

    #phpcs

  26. First 10 functional PRs merged in the new PHP_CodeSniffer repo 🎉

    Time for lunch. More to follow.

    #phpcs

    For context: phpc.social/@jrf_nl/1115054583

  27. PHP_CodeSniffer users: please read this important announcement: github.com/squizlabs/PHP_CodeS

    squizlabs/PHP_CodeSniffer is dead, long live PHPCSStandards/PHP_CodeSniffer!

    Also, please consider sponsoring the project to safeguard its continuation, as without funding, we'll have the same problem again sooner rather than later.

    #phpcs #php

    P.S.: @phpcs now also has its own account, follow it to stay informed.

  28. @DoubleA in addition to the good tips mentioned by others, you could have a look at the PHP Compatibility Check for PHP_CodeSniffer:
    github.com/PHPCompatibility/PH

    #phpcs

  29. Coding standards lovers: if I'd be writing some sniffs to check phpDoc tags.... which tags should be taken into account and what would you want checked ?

    PSR-19 would be first on my list, but I've got plenty more ideas and have created tag lists for PHPUnit, PHPStan, Psalm and a few more.

    Are there more popular tools with custom annotations I should look at ?

    Anything specific you'd really like to be able to enforce via #PHPCS ?

  30. This one is interesting to me.

    Composer (and Terminal) cannot run #PHPUnit, #PHPStan, or #PHPCS:

    "env: php: No such file or directory"

    Trying to figure out what details matter.

    #macOS removed #PHP from the base install. Instead of using Homebrew, "installed" by pointing to the #MAMP version.

    which php - returns correctly (RC)
    php -v - RC
    which composer - RC
    composer -v - RC

    This is a new one for me, and the only environment difference I can think of is how PHP is "installed."

    Thoughts?