-
-
Notifications
You must be signed in to change notification settings - Fork 30
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
Upgrade Service Manager to v4 in require
, Cache to v4 and Validator to v3 in require-dev
#103
base: 3.0.x
Are you sure you want to change the base?
Conversation
…ed deprecated usage functions Signed-off-by: Jurj-Bogdan <[email protected]>
Signed-off-by: Jurj-Bogdan <[email protected]>
Signed-off-by: Jurj-Bogdan <[email protected]>
Signed-off-by: Jurj-Bogdan <[email protected]>
@Jurj-Bogdan See #102 |
@laminas/technical-steering-committee So, should I create the branch 3.0.x and merge this one there ? |
Yes, create 3.0.x from the tip of the next minor release - You should probably get 2.24.x patches resolved first such as #106 so that merge-ups from 2.x have fewer conflicts |
@Jurj-Bogdan Please fix the conflicts |
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…ed deprecated usage functions Signed-off-by: Jurj-Bogdan <[email protected]>
Signed-off-by: Jurj-Bogdan <[email protected]>
Signed-off-by: Jurj-Bogdan <[email protected]>
@@ -41,28 +40,20 @@ class ContainerAbstractServiceFactory implements AbstractFactoryInterface | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class should be made final and all properties private. You should also mark this class soft final with @final
in a 2.x release
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done - also a related question here. I just noticed there are already some classes marked as deprecated, maybe this should be a good time to remove them as well?
Talking about AbstractValidatorChain
and AbstractValidatorChainEM3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes - anything that's deprecated should be dealt with in the next major. I don't know this lib well enough to know what the implications or plans might have been though.
Don't forget to document any BC breaks here with companion patches against 2.x including deprecations, and, make a start on a migration guide that lists all the BC breaking changes
* session?: Container, | ||
* timeout?: ?int, | ||
* } | ||
*/ | ||
final class Csrf extends AbstractValidator |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This whole class will probably need further refactoring such as deprecating and dropping all the public setters and getters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not suggesting that work should happen in this patch tho!
@@ -114,7 +114,8 @@ public function testFactoryWillAddValidatorViaConfiguration(): void | |||
|
|||
$manager->start(); | |||
|
|||
$chain = $manager->getValidatorChain(); | |||
$chain = $manager->getValidatorChain(); | |||
/** @psalm-suppress ArgumentTypeCoercion **/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this suppression and replace it with assertions.
Assert the manager is ManagerInterface
Assert the chain is a EventManagerInterface
or whatever it's supposed to be
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some phpunit assertions as they're useful, but Psalm is still adamant in throwing "ArgumentTypeCoercion" errors which is why the suppressions are still there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to assert $chain
is an instance of EventManager
(The concrete class) because that's what getListenersForEvent
expects.
Please also add findUnusedPsalmSuppress="true"
to psalm.xml
so that unused inline suppressions are flagged.
@@ -198,7 +199,8 @@ public function testFactoryDoesNotAttachValidatorTwoTimes(): void | |||
// Ignore exception, because we are not interested whether session validation passes in this test | |||
} | |||
|
|||
$chain = $manager->getValidatorChain(); | |||
$chain = $manager->getValidatorChain(); | |||
/** @psalm-suppress ArgumentTypeCoercion **/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here… More assertions!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This suppression still needs fixing too!
Signed-off-by: Jurj-Bogdan <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Jurj-Bogdan - A few more tweaks please :)
Apart from inline comments, all of the changed factories need to be made final
and they should all have a good cleanup - i.e protected
props to private
, drop any methods that are pointless etc. Happy to wait for another patch for those things, but we really don't want users extending factories and need to prevent that in the next major
*/ | ||
protected function getConfig(ContainerInterface $container) | ||
protected function getConfig(ContainerInterface $container): array |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be private
*/ | ||
protected function getSessionManager(ContainerInterface $container) | ||
protected function getSessionManager(ContainerInterface $container): ?ManagerInterface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be private
*/ | ||
protected function normalizeContainerName($name) | ||
protected function normalizeContainerName(string $name): string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be private
or maybe inlined if it's only used once
@@ -114,7 +114,8 @@ public function testFactoryWillAddValidatorViaConfiguration(): void | |||
|
|||
$manager->start(); | |||
|
|||
$chain = $manager->getValidatorChain(); | |||
$chain = $manager->getValidatorChain(); | |||
/** @psalm-suppress ArgumentTypeCoercion **/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to assert $chain
is an instance of EventManager
(The concrete class) because that's what getListenersForEvent
expects.
Please also add findUnusedPsalmSuppress="true"
to psalm.xml
so that unused inline suppressions are flagged.
@@ -198,7 +199,8 @@ public function testFactoryDoesNotAttachValidatorTwoTimes(): void | |||
// Ignore exception, because we are not interested whether session validation passes in this test | |||
} | |||
|
|||
$chain = $manager->getValidatorChain(); | |||
$chain = $manager->getValidatorChain(); | |||
/** @psalm-suppress ArgumentTypeCoercion **/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This suppression still needs fixing too!
require
, Cache to v4 and Validator to v3 in require-dev
Upgraded
laminas/laminas-servicemanager
to version 4, as well as the other dependencies required for it, and added various Psalm tweaks.I seems I was working on this PR alongside #102 , with the main difference seemingly being the removal of
v2
functions from the codebase in preparation for a new major release.I was about to make a different PR to the current branch marking the functions removed here as
deprecated
, but I'll wait for feedback regarding the desired way forward.