Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add stubs for Acl #148

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
ondrejmirtes merged 1 commit into phpstan:master from VincentLanglet:aclStub
Apr 19, 2021
Merged

Add stubs for Acl #148

ondrejmirtes merged 1 commit into phpstan:master from VincentLanglet:aclStub
Apr 19, 2021

Conversation

Copy link
Contributor

@VincentLanglet VincentLanglet commented Apr 19, 2021

No description provided.

Copy link
Contributor Author

Hi @ondrejmirtes, any idea about this error ?

PHPStan Symfony Framework extensions and rules > phpstan:
In StubPhpDocProvider.php line 150:
 
 Internal error. 
 
analyse [--paths-file PATHS-FILE] [-c|--configuration CONFIGURATION] [-l|--level LEVEL] [--no-progress] [--debug] [-a|--autoload-file AUTOLOAD-FILE] [--error-format ERROR-FORMAT] [--generate-baseline [GENERATE-BASELINE]] [--memory-limit MEMORY-LIMIT] [--xdebug] [--fix] [--watch] [--pro] [--] [<paths>...]

Copy link
Member

AclProviderInterface.stub contains a parse error: https://phpstan.org/r/5b9d1718-66c8-40e6-8c0b-d9363de991f7

@@ -0,0 +1,16 @@
<?php
Copy link
Contributor

@mhujer mhujer Apr 19, 2021
edited
Loading

Choose a reason for hiding this comment

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

There is a space in the beginning of the line which causes the error 😄

Suggested change
<?php
<?php

Copy link
Member

@ondrejmirtes ondrejmirtes Apr 19, 2021

Choose a reason for hiding this comment

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

With PHPStan's dev-master, the experience is a bit nicer:

------ --------------------------------------------------------------------------------------------
 Line stubs/Symfony/Component/Security/Acl/Model/AclProviderInterface.stub
 ------ --------------------------------------------------------------------------------------------
 3 Namespace declaration statement has to be the very first statement in the script on line 3
 3 Namespace declaration statement has to be the very first statement in the script on line 3
 3 Namespace declaration statement has to be the very first statement in the script on line 3
 3 Namespace declaration statement has to be the very first statement in the script on line 3
 ------ --------------------------------------------------------------------------------------------

Copy link
Contributor Author

@VincentLanglet VincentLanglet Apr 19, 2021

Choose a reason for hiding this comment

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

Whoah, nice catch

@VincentLanglet VincentLanglet force-pushed the aclStub branch 2 times, most recently from 132981f to 8984b49 Compare April 19, 2021 20:22
Copy link
Contributor Author

This seems to be ready now :)

@ondrejmirtes ondrejmirtes merged commit 69d0cbf into phpstan:master Apr 19, 2021
Copy link
Member

Thank you!

Copy link
Contributor Author

I'm not sure the stub is working as expected. @ondrejmirtes

The following PR is failing:
sonata-project/SonataAdminBundle#7095

 /**
 * @var MutableAclProviderInterface
 */
 protected $aclProvider;
 public function getObjectAcl(ObjectIdentityInterface $objectIdentity)
 {
 try {
 return $this->aclProvider->findAcl($objectIdentity);
 } catch (AclNotFoundException $e) {
 return null;
 }
 }

is throwing an error

Method 
 Sonata\AdminBundle\Security\Handler\AclSecurityHandler::getObjectAcl( 
 ) should return 
 Symfony\Component\Security\Acl\Model\MutableAclInterface|null but 
 returns Symfony\Component\Security\Acl\Model\AclInterface.

even if the stub is

 /**
 * @phpstan-param array<SecurityIdentityInterface> $sids
 * @phpstan-return MutableAclInterface
 */
 public function findAcl(ObjectIdentityInterface $oid, array $sids = []);

Copy link
Member

@VincentLanglet Please open an issue.

Copy link
Contributor Author

Done #149

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@ondrejmirtes ondrejmirtes ondrejmirtes left review comments

+1 more reviewer

@mhujer mhujer mhujer left review comments

Reviewers whose approvals may not affect merge requirements
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /