Mocking public properties gives undefined property error
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
Research direction
No file or test is named. Reproduce the shown Mockery User::class property assignment under PHPStan, then trace how phpstan-mockery handles MockInterface properties. Done means the assignment no longer reports the undefined-property diagnostic, with a regression test covering the example.
Written by the indexing model from the issue text.
Description
When creating a mock and setting a property on the mock, which is the recommended way for mocking public properties, it gives an undefined property error.
$user = Mockery::mock(User::class);
$user->name = "Oliver";
Access to an undefined property Mockery\MockInterface::$name.
current workaround is to just add the following ignore error
- '#Access to an undefined property Mockery\\MockInterface::\$.*\.#'
- Dominant language
- PHP
- Stars
- 109
- Forks
- 25
- Avg merge
- 1h 41m
- Merged PRs (30d)
- 1
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from phpstan/phpstan-mockery
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
phpstan/phpstan-mockery#78 ·
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
phpstan/phpstan-mockery#55 · 1 comment · 1 reaction ·
-
Dependency DashboardOpen
Difficulty 4/5 3-5 days Newbie friendliness 10/100
phpstan/phpstan-mockery#46 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
phpstan/phpstan-mockery#34 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 28/100
phpstan/phpstan-mockery#18 · 1 comment · 6 reactions ·
All issues in phpstan/phpstan-mockery
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
components-web-app/api-components-bundle#403 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
mollie/PrestaShop#1566 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
components-web-app/docs#193 ·
-
docs: add Python and PHP examples to docs/api.mdPossibly taken @gaurika-analyst claimed this today. Opendocumentation good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
djazairdev/wilayas#12 · 1 comment ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
endoflife-date/endoflife.date#11314 ·
Maintainers usually reply within 1 day