Code Monkey home page Code Monkey logo

psalm-psr-container-plugin's Introduction

psalm-psr-container-plugin

Integrate Release Renew

Type Coverage

Latest Stable Version Total Downloads

Installation

Run

composer require --dev lctrs/psalm-psr-container-plugin

Usage

Run

vendor/bin/psalm-plugin enable lctrs/psalm-psr-container-plugin

to enable the plugin.

Changelog

Please have a look at CHANGELOG.md.

Contributing

Please have a look at CONTRIBUTING.md.

License

This package is licensed using the MIT License.

Please have a look at LICENSE.md.

psalm-psr-container-plugin's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar lctrs avatar lctrs-bot avatar localheinz avatar m0003r avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

psalm-psr-container-plugin's Issues

Question: incompatibility with `.phpstorm.meta.php`?

Steps required to reproduce the problem

  1. Create a .phpstorm.meta.php directory
  2. Create a test.meta.php and add an override for ContainerInterface::get(0) like below
  3. Execute psalm with psr-container-plugin enabled

.phpstorm.meta.php/test.meta.php

<?php
/**
 * @see https://confluence.jetbrains.com/display/PhpStorm/PhpStorm+Advanced+Metadata
 */

namespace PHPSTORM_META {
    use Psr\Container\ContainerInterface;
    use Qoo;

    override(ContainerInterface::get(0), map([
        'qoo' => Qoo::class,
    ]));
}

Example file

<?php

class Qoo
{
}

class Baz
{
    public const QOO = 'qoo';
}

/** @var \Psr\Container\ContainerInterface */
$container = null;

$foo = $container->get(Baz::qoo);
/** @psalm-trace $foo */

Expected Result

  • $foo is detected as instance of Qoo

Actual Result

  • $foo is detected as instance of Baz (::class constant was not used, maybe another bug here?)

Psalm has .phpstorm.meta.php compatibility: https://github.com/vimeo/psalm/blob/466137a4c42b55b24a9ca588bf395f9f29d4b004/src/Psalm/Config.php#L1969

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Repository problems

These problems occurred while renovating this repository. View logs.

  • WARN: Use matchDepNames instead of matchPackageNames

Other Branches

These updates are pending. To force PRs open, click the checkbox below.

  • chore(deps): lock file maintenance

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

composer
composer.json
  • php ~8.1.0 || ~8.2.0 || ~8.3.0
  • nikic/php-parser ^4.19.1
  • psr/container ^1.1.2 || ^2.0.2
  • vimeo/psalm ^5.24.0
  • codeception/codeception 5.1.2
  • codeception/module-asserts 3.0.0
  • codeception/module-cli 2.0.1
  • codeception/module-filesystem 3.0.1
  • doctrine/coding-standard 12.0.0
  • ergebnis/composer-normalize 2.42.0
  • ergebnis/license 2.4.0
  • maglnet/composer-require-checker 4.7.1
  • phpstan/extension-installer 1.3.1
  • phpstan/phpstan 1.11.1
  • phpstan/phpstan-deprecation-rules 1.2.0
  • phpstan/phpstan-phpunit 1.4.0
  • phpstan/phpstan-strict-rules 1.6.0
  • phpunit/phpunit 10.5.20
  • psalm/plugin-phpunit 0.19.0
  • weirdan/codeception-psalm-module 0.14.0
github-actions
.github/workflows/integrate.yaml
  • actions/checkout v4.1.5@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b
  • ibiqlik/action-yamllint v3.1
  • shivammathur/setup-php 2.30.4
  • ramsey/composer-install 3.0.0
  • actions/cache v4
  • actions/checkout v4.1.5@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b
  • shivammathur/setup-php 2.30.4
  • ramsey/composer-install 3.0.0
  • actions/checkout v4.1.5@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b
  • shivammathur/setup-php 2.30.4
  • ramsey/composer-install 3.0.0
  • actions/cache v4
  • actions/cache v4
  • actions/checkout v4.1.5@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b
  • shivammathur/setup-php 2.30.4
  • ramsey/composer-install 3.0.0
.github/workflows/merge-renovate-upgrades.yaml
  • ridedott/merge-me-action v2.10.80
.github/workflows/release.yaml
  • actions/github-script v7
.github/workflows/renew.yaml
  • actions/checkout v4.1.5@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b
  • shivammathur/setup-php 2.30.4
  • ramsey/composer-install 3.0.0
  • stefanzweifel/git-auto-commit-action v5.0.1
.github/workflows/triage.yaml
  • actions/github-script v7

  • Check this box to trigger a request for Renovate to run again on this repository

Psalm 5.0

I noticed that psalm 5.0.0 is already upgraded. Could you possibly release a minor when you get a chance?

Thanks :)

Psr/container v3 support

Hello!

Thank you for your efforts. I have a question: is it possible to support version 3 of psr/container in your plugin? Or it is blocked by symfony/service-contracts dependency that supports just v2?

Is this package equivalent to a Psalm stub?

See https://github.com/laminas/laminas-inputfilter/blob/11080cf5a67fd2368d31b50e28403fb21cbf2f14/.stub.php

Copying it here for reference:

<?php

declare(strict_types=1);

namespace Psr\Container {

    interface ContainerInterface
    {
        /** @param string|class-string $name */
        public function has(string $name): bool;

        /**
         * @template T of object
         * @psalm-param string|class-string<T> $name
         * @psalm-return ($name is class-string ? T : mixed)
         */
        public function get(string $name): object;
    }
}

Usage:

<?php

class Thing {
	public function doStuff(): void
    {
    }
}

/** @psalm-var ContainerInterface $container */

$value = $container->get(Thing::class);
$value->doStuff();

See https://psalm.dev/r/027e9ad09e

Is this package comparable to that? What differences does it bring to that approach, and is a stub sufficient?

Ref: laminas/laminas-inputfilter#53 (comment)

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.