Skip to content
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

Re-add autoloading using PSR-4 #393

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

MWDelaney
Copy link

Changes proposed in this Pull Request:

  • Re-add autoloading using PSR-4 class autoloading. This will prevent the errors indicated in Drop composer autoload #361 because the class won't be loaded until called in wp_nav_menu().

  • Added namespace to prevent conflicts.

  • Moved and renamed class file for autoloading, implemented PSR-2 coding standards.

Testing instructions:

  • require this package in a WordPress theme which includes Composer's autoload.php like Sage 9.

  • Add the walker argument to your wp_nav_menu():

        'walker'            => new \WP_Bootstrap\WP_Bootstrap_Navwalker()

@pattonwebz
Copy link
Member

Hey, for autoloading would a classmap not be better? The navwalker does not currently use namespaces at all an adding those would be a breaking change needing a major version bump. Adding this to the v5 mileston

@pattonwebz pattonwebz added this to In progress in Walker v5 via automation Oct 2, 2019
@ethanclevenger91
Copy link

Would love to see this revived, and a backwards-compat breaking move to namespaces would be required for Composer 2.0 compatibility:

Deprecation Notice: Class WP_Bootstrap_Navwalker located in .../vendor/wp-bootstrap/wp-bootstrap-navwalker\class-wp-bootstrap-navwalker.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Autoload/ClassMapGenerator.php:201
Deprecation Notice: Class WP_Nav_Menu_Args located in .../vendor/wp-bootstrap/wp-bootstrap-navwalker\tests\phpstan\class-wp-nav-menu-args.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Autoload/ClassMapGenerator.php:201
Deprecation Notice: Class WP_Nav_Menu_Item located in .../vendor/wp-bootstrap/wp-bootstrap-navwalker\tests\phpstan\class-wp-nav-menu-item.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Autoload/ClassMapGenerator.php:201
Deprecation Notice: Class Test_WP_Bootstrap_NavWalker located in .../vendor/wp-bootstrap/wp-bootstrap-navwalker\tests\test-navwalker.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Autoload/ClassMapGenerator.php:201

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Walker v5
  
In progress
Development

Successfully merging this pull request may close these issues.

None yet

3 participants