Skip to content

[BUGFIX] Make class aliases available for consumers#1534

Merged
JakeQZ merged 3 commits into
mainfrom
bugfix/class-aliases-in-phpstan
Feb 18, 2026
Merged

[BUGFIX] Make class aliases available for consumers#1534
JakeQZ merged 3 commits into
mainfrom
bugfix/class-aliases-in-phpstan

Conversation

@oliverklee

Copy link
Copy Markdown
Collaborator

Fixes #1532

@oliverklee oliverklee requested a review from JakeQZ February 17, 2026 22:24
@oliverklee oliverklee self-assigned this Feb 17, 2026
@oliverklee oliverklee added the bug label Feb 17, 2026
@oliverklee oliverklee marked this pull request as draft February 17, 2026 22:24
@oliverklee

This comment was marked as outdated.

@coveralls

coveralls commented Feb 17, 2026

Copy link
Copy Markdown

Coverage Status

coverage: 72.181% (+0.07%) from 72.114%
when pulling 7640d31 on bugfix/class-aliases-in-phpstan
into 447fcb8 on main.

@oliverklee oliverklee force-pushed the bugfix/class-aliases-in-phpstan branch 3 times, most recently from 2eab94e to 76c23f7 Compare February 18, 2026 09:53
@oliverklee oliverklee removed the request for review from JakeQZ February 18, 2026 09:53
@oliverklee oliverklee marked this pull request as ready for review February 18, 2026 09:53
@oliverklee oliverklee requested a review from JakeQZ February 18, 2026 09:53
@oliverklee oliverklee force-pushed the bugfix/class-aliases-in-phpstan branch from 76c23f7 to 6c7af52 Compare February 18, 2026 13:15
@oliverklee oliverklee force-pushed the bugfix/class-aliases-in-phpstan branch from 6c7af52 to f701e4b Compare February 18, 2026 13:19

@JakeQZ JakeQZ left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Could we not keep the class alias files in their original locations, and just have the two files explicitly loaded via Composer?

That way

  • we don't need to introduce a new root-level directory along with config file changes that we'll have to undo when we drop the aliases for the next major release;
  • the separate alias files remain in a source directory representing the namespace of the alias (i.e. the old name of the class), and the deprecation notices make more sense.

Comment thread class-aliases/aliases.php Outdated
Comment on lines +5 to +8
use Sabberworm\CSS\Rule\Rule;
use Sabberworm\CSS\RuleSet\RuleContainer;
use Sabberworm\CSS\Property\Declaration;
use Sabberworm\CSS\RuleSet\DeclarationList;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

These should be in alphabetical order.

@oliverklee

Copy link
Copy Markdown
Collaborator Author

Could we not keep the class alias files in their original locations, and just have the two files explicitly loaded via Composer?

I'll give it a try …

@oliverklee

Copy link
Copy Markdown
Collaborator Author

Okay, done and repushed.

@oliverklee oliverklee requested a review from JakeQZ February 18, 2026 16:22

@JakeQZ JakeQZ left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Much cleaner :)

I assume it still works.

@JakeQZ JakeQZ merged commit 34ba5d4 into main Feb 18, 2026
24 checks passed
@JakeQZ JakeQZ deleted the bugfix/class-aliases-in-phpstan branch February 18, 2026 16:31
@oliverklee

Copy link
Copy Markdown
Collaborator Author

I assume it still works.

It does indeed (at least on my machine).

@JakeQZ

JakeQZ commented Feb 18, 2026

Copy link
Copy Markdown
Collaborator

Relevant PHPStan issues that were not resolved which means we need the Composer workaround:

@JakeQZ

JakeQZ commented Feb 18, 2026

Copy link
Copy Markdown
Collaborator

I assume it still works.

It does indeed (at least on my machine).

I'm now getting errors from Stan saying it can't find the classes, within the PHP-CSS-Parser project alone. But maybe Composer hasn't updated the class loaders. When I run composer update it says there's nothing to update.

@oliverklee

Copy link
Copy Markdown
Collaborator Author

I'm now getting errors from Stan saying it can't find the classes,

I got those as well. It turned out I needed to delete the PHPStan caches (which on my Linux machine are located in /tmp/phstan/).

@JakeQZ

JakeQZ commented Feb 18, 2026

Copy link
Copy Markdown
Collaborator

I'm now getting errors from Stan saying it can't find the classes,

I got those as well. It turned out I needed to delete the PHPStan caches (which on my Linux machine are located in /tmp/phstan/).

"./vendor/bin/phpstan" clear-result-cache

does the job and should work on both Windows and Linux. I think we have some other cache-clearing commands in composer.json that this could be added to...

@JakeQZ

JakeQZ commented Feb 18, 2026

Copy link
Copy Markdown
Collaborator

I think we have some other cache-clearing commands in composer.json that this could be added to...

We don't seem to have any cache-clearing commands any more. Perhaps they were for tools that we stopped using.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PHPStan does not find the class aliases

3 participants