Skip to content

Support resource as constant value, make STDIN, STDOUT and STDERR stubs actual resources - #905

Merged
Ocramius merged 4 commits into
Roave:5.0.xfrom
kukulich:resource
Dec 6, 2021
Merged

Ocramius merged 4 commits into
Roave:5.0.xfrom
kukulich:resource

Conversation

@kukulich

@kukulich kukulich commented Dec 6, 2021

Copy link
Copy Markdown
Collaborator

I used a little hack. I converted the define calls to this:

define('STDIN', constant('STDIN'))

And this format can be supported in stubs and then in both source stubbers.

Comment thread test/unit/NodeCompiler/CompileNodeToValueTest.php
Comment thread src/SourceLocator/SourceStubber/PhpStormStubs/CachingVisitor.php Outdated
Comment thread src/NodeCompiler/CompileNodeToValue.php

@Ocramius Ocramius left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @kukulich!

@Ocramius Ocramius left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A random CS issue appears!



FILE: ...src/SourceLocator/SourceStubber/PhpStormStubs/CachingVisitor.php
----------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
----------------------------------------------------------------------
 17 | ERROR | [x] Type define is not used in this file.
    |       |     (SlevomatCodingStandard.Namespaces.UnusedUses.UnusedUse)
 19 | ERROR | [x] Type fopen is not used in this file.
    |       |     (SlevomatCodingStandard.Namespaces.UnusedUses.UnusedUse)
----------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

@kukulich

kukulich commented Dec 6, 2021

Copy link
Copy Markdown
Collaborator Author

@Ocramius Already fixed and force pushed :)

@Ocramius Ocramius left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent, thanks! 🚢

@Ocramius Ocramius self-assigned this Dec 6, 2021
@Ocramius Ocramius changed the title Support resource as constant value Support resource as constant value, make STDIN, STDOUT and STDERR stubs actual resources Dec 6, 2021
@Ocramius
Ocramius merged commit 4844ea3 into Roave:5.0.x Dec 6, 2021
@kukulich
kukulich deleted the resource branch December 6, 2021 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants