assertInternalType()

Open
#34 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
php
Domain
devtools, testing

Research direction

Start with the Codeception wrapper in src/Codeception/Util/Shared/Asserts.php#L448-L451 and PHPUnit's assertInternalType in src/Framework/Assert.php#L1677, then reproduce the fopen example from the issue. Done means the assertion is understood well enough that the later fwrite call no longer reports resource|false.

Written by the indexing model from the issue text.

Description

I'm using Codeception's wrapper of PHPUnit's assertInternalType, and thought phpstan would understand the type.

Example code:

$feedHandle = fopen('php://temp', 'rw+');
$this->assertInternalType('resource', $feedHandle);
fwrite($feedHandle, $feed);

Actual result:

Parameter #1 $fp of function fwrite expects resource, resource|false given.

Expected result:
-- Nothing --

Dominant language
PHP
Stars
544
Forks
58
Avg merge
2d 1h
Merged PRs (30d)
5

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from phpstan/phpstan-phpunit

All issues in phpstan/phpstan-phpunit

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.