boesing/psalm-plugin-stringf 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

boesing/psalm-plugin-stringf

Composer 安装命令:

composer require boesing/psalm-plugin-stringf

包简介

Psalm plugin to work with `sprintf`, `printf`, `sscanf` and `fscanf`.

README 文档

README

Build Status

This plugin provides additional checks to the built-in sprintf, printf, sscanf and fscanf function usage.

Installation

Require composer dev-dependency

composer require --dev boesing/psalm-plugin-stringf

Run Psalm-Plugin Binary

vendor/bin/psalm-plugin enable boesing/psalm-plugin-stringf

Features

  • Parses sprintf and printf arguments to verify if the number of passed arguments matches the amount of specifiers
  • Verifies if the return value of sprintf might be a non-empty-string
  • Verifies possibly invalid argument of sprintf and printf (experimental)
  • Verifies unnecessary function calls of sprintf and printf (experimental)

Experimental

This plugin also provides experimental features.

Experimental features can be enabled by extending the plugin configuration as follows:

<?xml version="1.0"?>
<psalm>
    <plugins>
        <pluginClass class="Boesing\PsalmPluginStringf\Plugin">
            <experimental>
                <NameOfExperimentalFeature/>
            </experimental>
        </pluginClass>
    </plugins>
</psalm>

Report Possibly Invalid Argument for Specifier

<pluginClass class="Boesing\PsalmPluginStringf\Plugin">
    <experimental>
        <ReportPossiblyInvalidArgumentForSpecifier allowIntegerForString="yes" />
    </experimental>
</pluginClass>

The ReportPossiblyInvalidArgumentForSpecifier experimental feature will report PossiblyInvalidArgument errors for arguments used with sprintf or printf. Here are some examples:

printf('%s', 1);
PossiblyInvalidArgument: Argument 1 inferred as "int" does not match (any of) the suggested type(s) "string"
printf('%d', 'foo');
PossiblyInvalidArgument: Argument 1 inferred as "string" does not match (any of) the suggested type(s) "float\|int\|numeric-string"

Report Unnecessary Function Calls

<pluginClass class="Boesing\PsalmPluginStringf\Plugin">
    <experimental>
        <ReportUnnecessaryFunctionCalls/>
    </experimental>
</pluginClass>

The ReportUnnecessaryFunctionCalls experimental feature will report UnnecessaryFunctionCall errors for function calls to sprintf or printf which can be omitted. Here are some examples:

printf('Some text without any placeholder');
sprintf('Some text without any placeholder');
UnnecessaryFunctionCall: Function call is unnecessary as there is no placeholder within the template.

Release Versioning Disclaimer

This plugin won't follow semantic versioning even tho the version numbers state to be semantic versioning compliant. The source code of this plugin is not meant to used like library code and therefore MUST be treated as internal code.

  • This package will raise dependency requirements whenever necessary.
  • If there is a new major version of psalm, this plugin MAY migrate to that version but won't be early adopter.
  • If there is a new PHP minor/major version which is not supported by this library, this library MAY migrate to that version but won't be early adopter.

So to summarize: If your project depends on the latest shiny versions of either Psalm or PHP, this plugin is not for you. If you can live with that, feel free to install. Demands in any way will be either ignored or handled whenever I feel I want to spend time on it.

boesing/psalm-plugin-stringf 适用场景与选型建议

boesing/psalm-plugin-stringf 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 199.73k 次下载、GitHub Stars 达 12, 最近一次更新时间为 2021 年 08 月 03 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 boesing/psalm-plugin-stringf 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 boesing/psalm-plugin-stringf 我们能提供哪些服务?
定制开发 / 二次开发

基于 boesing/psalm-plugin-stringf 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 199.73k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 12
  • 点击次数: 14
  • 依赖项目数: 22
  • 推荐数: 0

GitHub 信息

  • Stars: 12
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2021-08-03