PHP runtime & extensions header files for PhpStorm

Related tags

Files phpstorm-stubs
Overview

phpstorm-stubs

official JetBrains project GitHub Action Status License Total Downloads

STUBS are normal, syntactically correct PHP files that contain function & class signatures, constant definitions, etc. for all built-in PHP stuff and most standard extensions. Stubs need to include complete PHPDOC, especially proper @return annotations.

An IDE needs them for completion, code inspection, type inference, doc popups, etc. Quality of most of these services depend on the quality of the stubs (basically their PHPDOC @annotations).

Note that the stubs for “non-standard” extensions are provided as is. (Non-Standard extensions are the ones that are not part of PHP Core or are not Bundled/External - see the complete list here.)

The support for such “non-standard” stubs is community-driven, and we only validate their PHPDoc. We do not check whether a stub matches the actual extension or whether the provided descriptions are correct.

Relevant open issues

Contribution process

Contribution process

Updating the IDE

Have a full copy of the .git repo within an IDE and provide its path in Settings | Languages & Frameworks | PHP | PHP Runtime | Advanced settings | Default stubs path. It should then be easily updatable both ways via normal git methods.

Extensions enabled by default

The set of extensions enabled by default in PhpStorm can change anytime without prior notice. To learn how to view the enabled extensions, look here.

How to run tests

  1. Execute docker-compose -f docker-compose.yml run php composer install -d /opt/project/phpstorm-stubs --ignore-platform-reqs
  2. Execute docker-compose -f docker-compose.yml run php /opt/project/phpstorm-stubs/vendor/bin/phpunit /opt/project/phpstorm-stubs/tests/

How to update stub map

Execute docker-compose -f docker-compose.yml run php /usr/local/bin/php /opt/project/phpstorm-stubs/generate-stub-map and commit the resulting PhpStormStubsMap.php

License

Apache 2

contains material by the PHP Documentation Group, licensed with CC-BY 3.0

Comments
  • PHP 8.0 support

    PHP 8.0 support

    New Features

    RFC https://wiki.php.net/rfc/stringable

    • [x] Stringable interface

    RFC https://wiki.php.net/rfc/attributes_v2

    • [x] ReflectionClassConstant::getAttributes()

    • [x] ReflectionFunctionAbstract::getAttributes()

    • [x] ReflectionParameter::getAttributes()

    • [x] ReflectionClass::getAttributes()

    RFC https://wiki.php.net/rfc/attribute_amendments

    • [x] Attribute class
    • [x] Attribute::TARGET_xxx constants
    • [x] Attribute::IS_REPEATABLE constant

    RFC https://wiki.php.net/rfc/constructor_promotion

    • [x] ReflectionParameter::isPromoted()
    • [x] ReflectionProperty::isPromoted()

    RFC https://wiki.php.net/rfc/str_contains

    • [x] Add str_contains function

    RFC https://wiki.php.net/rfc/add_str_starts_with_and_ends_with_functions

    • [x] Add str_starts_with function
    • [x] Add str_ends_with function

    RFC https://wiki.php.net/rfc/get_debug_type

    • [x] Add get_debug_type function

    PR https://github.com/php/php-src/pull/5427

    • [x] Add get_resource_id function

    RFC https://wiki.php.net/rfc/weak_maps

    • [x] Add WeakMap class

    RFC https://wiki.php.net/rfc/dom_living_standard_api

    • [x] Implement new signatures (TBD)

    RFC https://wiki.php.net/rfc/token_as_object

    • [x] Add PhpToken class

    ReflectionClassConstant visibility constants

    I did not find links to these additions

    • [x] ReflectionClassConstant::IS_PUBLIC
    • [x] ReflectionClassConstant::IS_PROTECTED
    • [x] ReflectionClassConstant::IS_PRIVATE

    Reflection API Changes

    • Added .phpstorm.meta.php for Reflection autocomplete improvements
    • Fixed errors
      • Removed nonexistent ReflectionType::__clone
      • Removed final keyword of ReflectionReference
      • and something else
    • Other
      • All classes are divided by files (should I revert this changes?)
      • All methods and fields are marked with types (including new mixed and union types)
      • Added lost documentation descriptions and links
      • All type references replaced by {@see xxx} (adds navigation between types in PhpStorm)
    opened by SerafimArts 18
  • Fix OCI-Lob and OCI-Collection class names

    Fix OCI-Lob and OCI-Collection class names

    Attempt to fix incorrect names of OCI classes. Correct names are OCI-Lob and OCI-Collection, not with underscores: http://php.net/manual/en/class.OCI-Lob.php http://php.net/manual/en/class.OCI-Collection.php Since these names are not valid class names, I haven't found any better way than trick with class_alias().

    Is it somehow possible to prevent __Internal* from appearing in autocomplete?

    References: https://github.com/doctrine/dbal/pull/3025#discussion_r198236056 https://github.com/phpstan/phpstan/issues/1123 https://github.com/phpstan/phpstan/commit/6149780143f59e82b048ec995f88a88eede7bd53

    opened by Majkl578 13
  • Add composer.json

    Add composer.json

    I found out that you can only install directly from GitHub with composer in root packages. It would be nice if you could accept this PR, submit the repository to packagist and setup the GitHub webhook. Should only take a minute at max, after that it will automatically update the registry on every commit 🙂

    opened by felixfbecker 13
  • phpdoc blocks fixes

    phpdoc blocks fixes

    I used the tool I maintain (Doctum) to find the errors. Here is the online version of the generated API docs: https://doctum.long-term.support/api-docs/phpstorm-stubs/

    Full error list (38) before fixes (most errors are not fixed)

    ERROR: The "reschedule_cb" parameter of the method "set" is missing a @param tag on "EvPeriodic::set" in Ev/Ev.php:857
    ERROR: The "loop" parameter of the method "__construct" is missing a @param tag on "EvFork::__construct" in Ev/Ev.php:1212
    ERROR: The "loop" parameter of the method "createStopped" is missing a @param tag on "EvFork::createStopped" in Ev/Ev.php:1223
    ERROR: The "reschedule_cb" parameter of the method "periodic" is missing a @param tag on "EvLoop::periodic" in Ev/Ev.php:1416
    ERROR: The "signed_text" parameter of the method "verify" is missing a @param tag on "gnupg::verify" in gnupg/gnupg.php:60
    ERROR: The "callback" parameter of the method "enumCharNames" is missing a @param tag on "IntlChar::enumCharNames" in intl/IntlChar.php:879
    ERROR: The hint on "libvirt_connect_get_sysinfo" at @return is invalid: "string|false: XML description of system information from the connection or FALSE for error" on "\libvirt_connect_get_sysinfo" in libvirt-php/libvirt-php.php:421
    ERROR: The hint on "libvirt_domain_new_get_vnc" at @return is invalid: "string|null: a VNC server for a newly created domain resource (if any)" on "\libvirt_domain_new_get_vnc" in libvirt-php/libvirt-php.php:953
    ERROR: The "wtimeout" parameter of the method "setWriteConcern" is missing a @param tag on "MongoDB::setWriteConcern" in mongo/mongo.php:819
    ERROR: The "character_set" parameter of the method "ocilogon" is missing a @param tag on "\ocilogon" in oci8/oci8.php:1962
    ERROR: The "connection_string" parameter of the method "ocilogon" is missing a @param tag on "\ocilogon" in oci8/oci8.php:1962
    ERROR: The "session_mode" parameter of the method "ocilogon" is missing a @param tag on "\ocilogon" in oci8/oci8.php:1962
    ERROR: The method "get_majorversion" has "1" @param tags but only "0" where expected. on "PDFlib::get_majorversion" in pdflib/PDFlib.php:847
    ERROR: The method "get_minorversion" has "1" @param tags but only "0" where expected. on "PDFlib::get_minorversion" in pdflib/PDFlib.php:855
    ERROR: The "pdf" parameter of the method "PDF_activate_item" is missing a @param tag on "\PDF_activate_item" in pdflib/PDFlib.php:1648
    ERROR: The "p" parameter of the method "PDF_end_page" is missing a @param tag on "\PDF_end_page" in pdflib/PDFlib.php:2394
    ERROR: The "p" parameter of the method "PDF_end_pattern" is missing a @param tag on "\PDF_end_pattern" in pdflib/PDFlib.php:2403
    ERROR: The "p" parameter of the method "PDF_end_template" is missing a @param tag on "\PDF_end_template" in pdflib/PDFlib.php:2412
    ERROR: The "p" parameter of the method "PDF_endpath" is missing a @param tag on "\PDF_endpath" in pdflib/PDFlib.php:2421
    ERROR: The method "PDF_get_majorversion" has "1" @param tags but only "0" where expected. on "\PDF_get_majorversion" in pdflib/PDFlib.php:2593
    ERROR: The method "PDF_get_minorversion" has "1" @param tags but only "0" where expected. on "\PDF_get_minorversion" in pdflib/PDFlib.php:2601
    ERROR: The "p" parameter of the method "PDF_restore" is missing a @param tag on "\PDF_restore" in pdflib/PDFlib.php:2989
    ERROR: The "p" parameter of the method "PDF_save" is missing a @param tag on "\PDF_save" in pdflib/PDFlib.php:3018
    ERROR: The "p" parameter of the method "PDF_stroke" is missing a @param tag on "\PDF_stroke" in pdflib/PDFlib.php:3416
    ERROR: The "msg_opaque" parameter of the method "produce" is missing a @param tag on "RdKafka\ProducerTopic::produce" in rdkafka/RdKafka/ProducerTopic.php:17
    ERROR: The "msg_opaque" parameter of the method "producev" is missing a @param tag on "RdKafka\ProducerTopic::producev" in rdkafka/RdKafka/ProducerTopic.php:29
    ERROR: The "ttl" parameter of the method "psetex" is missing a @param tag on "Redis::psetex" in redis/Redis.php:469
    ERROR: The method "psubscribe" has "3" @param tags but only "2" where expected. on "Redis::psubscribe" in redis/Redis.php:696
    ERROR: The "value" parameter of the method "wincache_ucache_set" is missing a @param tag on "\wincache_ucache_set" in wincache/wincache.php:429
    ERROR: The "path" parameter of the method "registerLocalNamespace" is missing a @param tag on "Yaf_Loader::registerLocalNamespace" in yaf/yaf.php:630
    ERROR: The method "execute" has "1" @param tags but only "0" where expected. on "Yaf_Action_Abstract::execute" in yaf/yaf.php:1256
    ERROR: The "format_name" parameter of the method "setModuleName" is missing a @param tag on "Yaf_Request_Abstract::setModuleName" in yaf/yaf.php:1549
    ERROR: The "format_name" parameter of the method "setControllerName" is missing a @param tag on "Yaf_Request_Abstract::setControllerName" in yaf/yaf.php:1558
    ERROR: The "format_name" parameter of the method "setActionName" is missing a @param tag on "Yaf_Request_Abstract::setActionName" in yaf/yaf.php:1567
    ERROR: The "module" parameter of the method "__construct" is missing a @param tag on "Yaf_Request_Simple::__construct" in yaf/yaf.php:2255
    ERROR: The method "execute" has "1" @param tags but only "0" where expected. on "Yaf\Action_Abstract::execute" in yaf/yaf_namespace.php:1215
    ERROR: The "protocol" parameter of the method "__construct" is missing a @param tag on "Yar_Server::__construct" in yar/yar.php:50
    ERROR: The "async" parameter of the method "__construct" is missing a @param tag on "Yar_Client::__construct" in yar/yar.php:88
    

    opened by williamdes 11
  • PHP Data Structures

    PHP Data Structures

    This PR proposes doc stubs for the PHP Data Structures extension. The signatures are compatible to PHP 7.1, like defined in your projects' composer.json and it features the splat operator in signatures for any indefinite number of parameters, as well as return types on functions. I included notes and warnings as separate paragraphs, as well as callback signatures as code blocks within the docs.

    The stubs in this PR shall promote the usage of the new PHP 7 Data Structure extension. Their usage also familiarize the developer to the essential usage principle of generic types and functions, as described in the draft PHP RFC "Generic Types and Functions".

    I look forward to your feedback.

    opened by dguhl 10
  • Add new mongodb extension

    Add new mongodb extension

    opened by tuyakhov 10
  • WI-54952: fix rdkafka stubs, generator

    WI-54952: fix rdkafka stubs, generator

    Moved functions where needed, to reflect the the state of the extension: https://github.com/arnaud-lb/php-rdkafka/blob/master/rdkafka.c#L726-L743

    As per the below discussion, also adjusted the stub generator to recurse into sub-folders, since this caused some issues without it

    opened by nick-zh 9
  • Amended data structures

    Amended data structures

    According to PHPSTAN, some methods were missing in the Map class and others. I amended my contribution.

    PS: I closed my original PR #832 in that matter because it continued the old branch on my side with a cluttered commit history. I opened a new branch to keep the contribution clean.

    opened by dguhl 9
  • Fix false for return.

    Fix false for return.

    Refs https://youtrack.jetbrains.com/issue/WI-50517

    I don't like this <p> stuff in the docblock lines - maybe the can be removed in follow up PRs. But since they close with </p> already, they should also correctly open (so I added those, too).

    opened by dereuromark 8
  • Add swoole extension support

    Add swoole extension support

    This is direct subsplit of this repository https://github.com/swoole/ide-helper

    It is much more convenient when autocomplete on this extension is already available immediately in php storm.

    opened by SerafimArts 8
  • Fix `PDO::PARAM_*` constant values

    Fix `PDO::PARAM_*` constant values

    fixed incorrect constant values and re-ordered the constant ascending by their value

    see https://3v4l.org/O0hDh

    refs https://github.com/phpstan/phpstan/issues/5985

    opened by staabm 7
Releases(v2022.3)
Owner
JetBrains
JetBrains open source projects
JetBrains
This small PHP package assists in the loading and parsing of VTT files.

VTT Transcriptions This small PHP package assists in the loading and parsing of VTT files. Usage use Laracasts\Transcriptions\Transcription; $transcr

Laracasts 52 Nov 28, 2022
ANTLR (ANother Tool for Language Recognition) is a powerful parser generator for reading, processing, executing, or translating structured text or binary files.

ANTLR (ANother Tool for Language Recognition) is a powerful parser generator for reading, processing, executing, or translating structured text or binary files. It's widely used to build languages, tools, and frameworks. From a grammar, ANTLR generates a parser that can build parse trees and also generates a listener interface (or visitor) that makes it easy to respond to the recognition of phrases of interest.

Antlr Project 13.6k Jan 6, 2023
Tailwind plugin to generate purge-safe.txt files

Tailwind plugin to generate safelist.txt files With tailwind-safelist-generator, you can generate a safelist.txt file for your theme based on a set of

Spatie 89 Dec 23, 2022
Associate files with Eloquent models

Associate files with Eloquent models This package can associate all sorts of files with Eloquent models. It provides a simple API to work with. To lea

Spatie 5.2k Jan 4, 2023
This package used to upload files using laravel-media-library before saving model.

Laravel Media Uploader This package used to upload files using laravel-media-library before saving model. In this package all uploaded media will be p

Ahmed Fathy 312 Dec 12, 2022
A python program to cut longer MP3 files (i.e. recordings of several songs) into the individual tracks.

I'm writing a python script to cut longer MP3 files (i.e. recordings of several songs) into the individual tracks called ReCut. So far there are two

Dönerspiess 1 Oct 27, 2021
A Flysystem proxy adapter that enables compression and encryption of files and streams on the fly

Slam / flysystem-compress-and-encrypt-proxy Compress and Encrypt files and streams before saving them to the final Flysystem destination. Installation

Filippo Tessarotto 27 Jun 4, 2022
FileGator - a free, open-source, self-hosted web application for managing files and folders.

FileGator - Powerful Multi-User File Manager FileGator is a free, open-source, self-hosted web application for managing files and folders. You can man

FileGator 1.3k Jan 3, 2023
FileNamingResolver - A lightweight library which helps to resolve a file/directory naming of uploaded files using various naming strategies

FileNamingResolver - A lightweight library which helps to resolve a file/directory naming of uploaded files using various naming strategies

Victor Bocharsky 111 May 19, 2022
An object oriented PHP driver for FFMpeg binary

php-ffmpeg An Object-Oriented library to convert video/audio files with FFmpeg / AVConv. Check another amazing repo: PHP FFMpeg extras, you will find

null 4.4k Jan 2, 2023
CSV data manipulation made easy in PHP

CSV Csv is a simple library to ease CSV parsing, writing and filtering in PHP. The goal of the library is to be powerful while remaining lightweight,

The League of Extraordinary Packages 3k Jan 4, 2023
PHP-based anti-virus anti-trojan anti-malware solution.

What is phpMussel? An ideal solution for shared hosting environments, where it's often not possible to utilise or install conventional anti-virus prot

null 384 Dec 13, 2022
An object oriented PHP driver for FFMpeg binary

php-ffmpeg An Object-Oriented library to convert video/audio files with FFmpeg / AVConv. Check another amazing repo: PHP FFMpeg extras, you will find

null 4.4k Jan 2, 2023
PHP Phar Stream Wrapper

Based on Sam Thomas' findings concerning insecure deserialization in combination with obfuscation strategies allowing to hide Phar files inside valid image resources, the TYPO3 project decided back then to introduce a PharStreamWrapper to intercept invocations of the phar:// stream in PHP and only allow usage for defined locations in the file system.

TYPO3 GitHub Department 55 Dec 7, 2022
A PHP library to deal with all those media services around, parsing their URLs and displaying their audios/videos.

MediaEmbed A utility library that generates HTML embed tags for audio or video located on a given URL. It also parses and validates given media URLs.

Mark Sch. 165 Nov 10, 2022
Watch changes in the file system using PHP

Watch changes in the file system using PHP This package allows you to react to all kinds of changes in the file system. Here's how you can run code wh

Spatie 170 Dec 25, 2022
PHP stream wrapper for Flysystem v2

Flystream enables you to use core PHP filesystem functions to interact with Flysystem filesystems by registering them as custom protocols.

Matthew Turland 12 Dec 14, 2022
File manager module for the Lumen PHP framework.

Lumen File Manager File manager module for the Lumen PHP framework. Please note that this module is still under active development. NOTE: Branch 5.1 i

Digia 40 Aug 20, 2022